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

Side by Side Diff: ext/background.js

Issue 29793570: Issue 6692 - Update frame structure for about:blank frames earlier (Closed)
Patch Set: Only handle about:blank Created May 29, 2018, 5:26 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-present eyeo GmbH 3 * Copyright (C) 2006-present 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 // update the state of the same document twice, otherewise the number 267 // update the state of the same document twice, otherewise the number
268 // of any ads blocked already and any recorded sitekey could get lost. 268 // of any ads blocked already and any recorded sitekey could get lost.
269 let frame = ext.getFrame(details.tabId, details.frameId); 269 let frame = ext.getFrame(details.tabId, details.frameId);
270 if (!frame || frame.url.href != details.url) 270 if (!frame || frame.url.href != details.url)
271 { 271 {
272 updatePageFrameStructure(details.frameId, details.tabId, details.url, 272 updatePageFrameStructure(details.frameId, details.tabId, details.url,
273 details.parentFrameId); 273 details.parentFrameId);
274 } 274 }
275 }); 275 });
276 276
277 browser.webNavigation.onBeforeNavigate.addListener(details =>
278 {
279 // We also need to update the frame structure for about:blank frames, in
280 // order to properly attribute the requests they make.
Sebastian Noack 2018/05/29 17:35:09 This comment is a bit vague. In my tests about:bla
kzar 2018/05/29 17:46:18 Done.
281 let {url} = details;
Sebastian Noack 2018/05/29 17:35:08 Nit: I don't think this temporary variable is wort
kzar 2018/05/29 17:46:18 Done.
282 if (url == "about:blank")
283 {
284 updatePageFrameStructure(details.frameId, details.tabId, url,
285 details.parentFrameId);
286 }
287 });
288
277 function forgetTab(tabId) 289 function forgetTab(tabId)
278 { 290 {
279 ext.pages.onRemoved._dispatch(tabId); 291 ext.pages.onRemoved._dispatch(tabId);
280 292
281 removeFromAllPageMaps(tabId); 293 removeFromAllPageMaps(tabId);
282 framesOfTabs.delete(tabId); 294 framesOfTabs.delete(tabId);
283 } 295 }
284 296
285 browser.tabs.onReplaced.addListener((addedTabId, removedTabId) => 297 browser.tabs.onReplaced.addListener((addedTabId, removedTabId) =>
286 { 298 {
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 return frames.get(0) || null; 582 return frames.get(0) || null;
571 } 583 }
572 }; 584 };
573 } 585 }
574 586
575 return ext.onMessage._dispatch( 587 return ext.onMessage._dispatch(
576 message, sender, sendResponse 588 message, sender, sendResponse
577 ).includes(true); 589 ).includes(true);
578 }); 590 });
579 } 591 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld