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

Delta Between Two Patch Sets: chrome/ext/background.js

Issue 29362203: Issue 4599 - Update the page structure more eagerly (Closed)
Left Patch Set: Only eagerly update structure for new tabs Created Nov. 14, 2016, 2:53 p.m.
Right Patch Set: Improved comment Created Nov. 14, 2016, 3:11 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | 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
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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 var frame = createFrame(tabId, frameId); 160 var frame = createFrame(tabId, frameId);
161 frame.url = new URL(url); 161 frame.url = new URL(url);
162 }; 162 };
163 163
164 chrome.webNavigation.onBeforeNavigate.addListener(function(details) 164 chrome.webNavigation.onBeforeNavigate.addListener(function(details)
165 { 165 {
166 // Capture parent frame here because onCommitted doesn't get this info. 166 // Capture parent frame here because onCommitted doesn't get this info.
167 var frame = createFrame(details.tabId, details.frameId); 167 var frame = createFrame(details.tabId, details.frameId);
168 frame.parent = framesOfTabs[details.tabId][details.parentFrameId] || null; 168 frame.parent = framesOfTabs[details.tabId][details.parentFrameId] || null;
169 169
170 // Chrome will sometimes perform requests for a pre-rendered page before 170 // Chrome will sometimes perform requests for pre-rendered pages before
171 // navigation was confirmed and the onComitted event was fired. Those 171 // navigation was confirmed and the onComitted event was fired. Those
172 // requests will often wrongly be considered as third party, since their 172 // requests will often wrongly be considered to be third party, since we
173 // page structure was not recorded. As a work around we update the page 173 // don't know the correct document domain for requests until after we've
174 // updated the page structure. As a work around we update the page
174 // structure eagerly for new tabs (which includes pre-rendered pages). 175 // structure eagerly for new tabs (which includes pre-rendered pages).
175 if (!(details.tabId in framesOfTabs)) 176 if (!(details.tabId in framesOfTabs))
Wladimir Palant 2016/11/14 15:56:29 While this is probably not wrong, I think that you
kzar 2016/11/15 12:19:28 Well so far the issue only described a problem wit
176 ext._updatePageFrameStructure(details.frameId, details.tabId, details.url) ; 177 ext._updatePageFrameStructure(details.frameId, details.tabId, details.url) ;
177 }); 178 });
178 179
179 chrome.webNavigation.onCommitted.addListener(function(details) 180 chrome.webNavigation.onCommitted.addListener(function(details)
180 { 181 {
181 ext._updatePageFrameStructure(details.frameId, details.tabId, details.url); 182 ext._updatePageFrameStructure(details.frameId, details.tabId, details.url);
182 }); 183 });
183 184
184 function forgetTab(tabId) 185 function forgetTab(tabId)
185 { 186 {
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 ext.windows = { 648 ext.windows = {
648 create: function(createData, callback) 649 create: function(createData, callback)
649 { 650 {
650 chrome.windows.create(createData, function(createdWindow) 651 chrome.windows.create(createData, function(createdWindow)
651 { 652 {
652 afterTabLoaded(callback)(createdWindow.tabs[0]); 653 afterTabLoaded(callback)(createdWindow.tabs[0]);
653 }); 654 });
654 } 655 }
655 }; 656 };
656 })(); 657 })();
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld