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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
244 } | 244 } |
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: and data: frames before the frame's |
255 // onCommitted event has fired, so we update the frame structure | 255 // onCommitted event has fired, so we update the frame structure for those |
256 // for those now. | 256 // now. |
257 if (details.url.startsWith("about:")) | 257 if (/^(about|data):/.test(details.url)) |
Sebastian Noack
2018/09/17 16:02:31
Nit: I'm not sure if a regular expression is justi
Manish Jethani
2018/09/21 20:32:24
Changed to String.startsWith.
I have a hunch that
| |
258 { | 258 { |
259 updatePageFrameStructure(details.frameId, details.tabId, details.url, | 259 updatePageFrameStructure(details.frameId, details.tabId, details.url, |
260 details.parentFrameId); | 260 details.parentFrameId); |
261 } | 261 } |
262 }); | 262 }); |
263 | 263 |
264 browser.webNavigation.onCommitted.addListener(details => | 264 browser.webNavigation.onCommitted.addListener(details => |
265 { | 265 { |
266 // We have to update the frame structure for documents that weren't | 266 // We have to update the frame structure for documents that weren't |
267 // loaded over HTTP (including documents cached by Service Workers), | 267 // 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; | 601 return frames.get(0) || null; |
602 } | 602 } |
603 }; | 603 }; |
604 } | 604 } |
605 | 605 |
606 return ext.onMessage._dispatch( | 606 return ext.onMessage._dispatch( |
607 message, sender, sendResponse | 607 message, sender, sendResponse |
608 ).includes(true); | 608 ).includes(true); |
609 }); | 609 }); |
610 } | 610 } |
OLD | NEW |