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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 245 |
246 updatePageFrameStructure(details.frameId, details.tabId, details.url, | 246 updatePageFrameStructure(details.frameId, details.tabId, details.url, |
247 details.parentFrameId); | 247 details.parentFrameId); |
248 }, | 248 }, |
249 {types: ["main_frame", "sub_frame"], urls: ["http://*/*", "https://*/*"]}, | 249 {types: ["main_frame", "sub_frame"], urls: ["http://*/*", "https://*/*"]}, |
250 ["responseHeaders"]); | 250 ["responseHeaders"]); |
251 | 251 |
252 browser.webNavigation.onBeforeNavigate.addListener(details => | 252 browser.webNavigation.onBeforeNavigate.addListener(details => |
253 { | 253 { |
254 // Requests can be made by about:blank frames before the frame's | 254 // Requests can be made by about:blank frames before the frame's |
255 // onCommitted event has fired, so we update the frame structure | 255 // onCommitted event has fired; besides, the parent frame's ID is not |
256 // for those now. | 256 // available in onCommitted, nor is the onHeadersReceived event fired for |
257 if (details.url.startsWith("about:")) | 257 // about: and data: frames; so we update the frame structure for such |
| 258 // frames here. |
| 259 if (details.url.startsWith("about:") || details.url.startsWith("data:")) |
258 { | 260 { |
259 updatePageFrameStructure(details.frameId, details.tabId, details.url, | 261 updatePageFrameStructure(details.frameId, details.tabId, details.url, |
260 details.parentFrameId); | 262 details.parentFrameId); |
261 } | 263 } |
262 }); | 264 }); |
263 | 265 |
264 browser.webNavigation.onCommitted.addListener(details => | 266 browser.webNavigation.onCommitted.addListener(details => |
265 { | 267 { |
266 // We have to update the frame structure for documents that weren't | 268 // We have to update the frame structure for documents that weren't |
267 // loaded over HTTP (including documents cached by Service Workers), | 269 // loaded over HTTP (including documents cached by Service Workers), |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 return frames.get(0) || null; | 603 return frames.get(0) || null; |
602 } | 604 } |
603 }; | 605 }; |
604 } | 606 } |
605 | 607 |
606 return ext.onMessage._dispatch( | 608 return ext.onMessage._dispatch( |
607 message, sender, sendResponse | 609 message, sender, sendResponse |
608 ).includes(true); | 610 ).includes(true); |
609 }); | 611 }); |
610 } | 612 } |
OLD | NEW |