Left: | ||
Right: |
OLD | NEW |
---|---|
1 /* | 1 /* |
2 * This file is part of the Adblock Plus extension, | 2 * This file is part of the Adblock Plus extension, |
3 * Copyright (C) 2006-2012 Eyeo GmbH | 3 * Copyright (C) 2006-2012 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 | 174 |
175 var requestHost = extractHostFromURL(url); | 175 var requestHost = extractHostFromURL(url); |
176 var documentHost = extractHostFromURL(documentUrl); | 176 var documentHost = extractHostFromURL(documentUrl); |
177 var thirdParty = isThirdParty(requestHost, documentHost); | 177 var thirdParty = isThirdParty(requestHost, documentHost); |
178 return defaultMatcher.matchesAny(url, type, documentHost, thirdParty); | 178 return defaultMatcher.matchesAny(url, type, documentHost, thirdParty); |
179 } | 179 } |
180 | 180 |
181 function isFrameWhitelisted(tabId, frameId, type) | 181 function isFrameWhitelisted(tabId, frameId, type) |
182 { | 182 { |
183 var parent = frameId; | 183 var parent = frameId; |
184 while (parent != -1) | 184 var parentData = getFrameData(tabId, parent); |
Felix Dahlke
2012/11/06 10:20:59
Can the supplied frameId be -1? The previous versi
Wladimir Palant
2012/11/06 11:02:02
Yes, it could be -1. getFrameData() will return nu
| |
185 while (parentData) | |
185 { | 186 { |
186 var parentData = getFrameData(tabId, parent); | 187 var frame = parent; |
187 if (!parentData) | 188 var frameData = parentData; |
188 break; | |
189 | 189 |
190 if (isWhitelisted(parentData.url, type) || "keyException" in parentData) | 190 parent = frameData.parent; |
191 parentData = (parent != -1 ? getFrameData(tabId, parent) : null); | |
192 | |
193 var frameUrl = frameData.url; | |
194 var parentUrl = (parentData ? parentData.url : frameUrl); | |
Felix Dahlke
2012/11/06 10:20:59
Shouldn't parentUrl be null if there is no parent?
Wladimir Palant
2012/11/06 11:02:02
I considered this but decided that it would be bet
| |
195 if ("keyException" in frameData || isWhitelisted(frameUrl, parentUrl, type)) | |
191 return true; | 196 return true; |
192 parent = parentData.parent; | |
193 } | 197 } |
194 return false; | 198 return false; |
195 } | 199 } |
OLD | NEW |