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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 * @param {number} [typeMask=RegExpFilter.typeMap.DOCUMENT] | 58 * @param {number} [typeMask=RegExpFilter.typeMap.DOCUMENT] |
59 * @return {?WhitelistFilter} | 59 * @return {?WhitelistFilter} |
60 */ | 60 */ |
61 exports.checkWhitelisted = (page, frame, originUrl, | 61 exports.checkWhitelisted = (page, frame, originUrl, |
62 typeMask = RegExpFilter.typeMap.DOCUMENT) => | 62 typeMask = RegExpFilter.typeMap.DOCUMENT) => |
63 { | 63 { |
64 if (frame || originUrl) | 64 if (frame || originUrl) |
65 { | 65 { |
66 while (frame) | 66 while (frame) |
67 { | 67 { |
68 let parentFrame = frame.parent; | |
69 let filter = match(page, frame.url, typeMask, | 68 let filter = match(page, frame.url, typeMask, |
70 extractHostFromFrame(parentFrame, originUrl), | 69 extractHostFromFrame(frame, originUrl), |
71 getKey(page, frame, originUrl)); | 70 getKey(page, frame, originUrl)); |
72 | 71 |
73 if (filter) | 72 if (filter) |
74 return filter; | 73 return filter; |
75 | 74 |
76 frame = parentFrame; | 75 frame = frame.parent; |
77 } | 76 } |
78 | 77 |
79 return originUrl && match(page, originUrl, typeMask, null, | 78 return originUrl && match(page, originUrl, typeMask, null, |
80 getKey(null, null, originUrl)); | 79 getKey(null, null, originUrl)); |
81 } | 80 } |
82 | 81 |
83 return page && match(page, page.url, typeMask); | 82 return page && match(page, page.url, typeMask); |
84 }; | 83 }; |
85 | 84 |
86 port.on("filters.isWhitelisted", message => | 85 port.on("filters.isWhitelisted", message => |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 { | 233 { |
235 browser.webRequest.onHeadersReceived.addListener( | 234 browser.webRequest.onHeadersReceived.addListener( |
236 onHeadersReceived, | 235 onHeadersReceived, |
237 { | 236 { |
238 urls: ["http://*/*", "https://*/*"], | 237 urls: ["http://*/*", "https://*/*"], |
239 types: ["main_frame", "sub_frame"] | 238 types: ["main_frame", "sub_frame"] |
240 }, | 239 }, |
241 ["responseHeaders"] | 240 ["responseHeaders"] |
242 ); | 241 ); |
243 } | 242 } |
OLD | NEW |