| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 } |
| OLD | NEW |