Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: lib/whitelisting.js

Issue 29372398: Issue 4804 - Avoid trashing pagemaps prematurely (Closed)
Left Patch Set: Created Jan. 18, 2017, 8:08 a.m.
Right Patch Set: Rebased Created Jan. 23, 2017, 10:19 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « chrome/ext/background.js ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 let page = new ext.Page({id: details.tabId}); 175 let page = new ext.Page({id: details.tabId});
176 176
177 for (let header of details.responseHeaders) 177 for (let header of details.responseHeaders)
178 { 178 {
179 if (header.name.toLowerCase() == "x-adblock-key" && header.value) 179 if (header.name.toLowerCase() == "x-adblock-key" && header.value)
180 { 180 {
181 let url = new URL(details.url); 181 let url = new URL(details.url);
182 let key = checkKey(header.value, url); 182 let key = checkKey(header.value, url);
183 if (key) 183 if (key)
184 { 184 {
185 // For pre-rendered tabs we don't know for sure the navigation is going
186 // to happen until the onCommitted event fires. Unfortunately if we want
187 // sitekey whitelisting to work for requests made before onCommitted has
188 // been fired we must update the page structure now anyway.
189 ext._updatePageFrameStructure(details.frameId, details.tabId, details.ur l, true);
190 recordKey(key, page, url); 185 recordKey(key, page, url);
191 break; 186 break;
192 } 187 }
193 } 188 }
194 } 189 }
195 } 190 }
196 191
197 if (typeof chrome == "object") 192 if (typeof chrome == "object")
198 chrome.webRequest.onHeadersReceived.addListener( 193 chrome.webRequest.onHeadersReceived.addListener(
199 onHeadersReceived, 194 onHeadersReceived,
200 { 195 {
201 urls: ["http://*/*", "https://*/*"], 196 urls: ["http://*/*", "https://*/*"],
202 types: ["main_frame", "sub_frame"] 197 types: ["main_frame", "sub_frame"]
203 }, 198 },
204 ["responseHeaders"] 199 ["responseHeaders"]
205 ); 200 );
LEFTRIGHT

Powered by Google App Engine
This is Rietveld