| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 if (isFrameWhitelisted(tabId, frameId)) | 168 if (isFrameWhitelisted(tabId, frameId)) |
| 169 return false; | 169 return false; |
| 170 | 170 |
| 171 var documentUrl = getFrameUrl(tabId, frameId); | 171 var documentUrl = getFrameUrl(tabId, frameId); |
| 172 if (!documentUrl) | 172 if (!documentUrl) |
| 173 return false; | 173 return false; |
| 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 var filter = defaultMatcher.matchesAny(url, type, documentHost, thirdParty); | 178 return defaultMatcher.matchesAny(url, type, documentHost, thirdParty); |
| 179 | |
| 180 if (filter instanceof BlockingFilter) | |
| 181 { | |
| 182 var collapse = filter.collapse; | |
| 183 if (collapse == null) | |
| 184 collapse = (localStorage["hidePlaceholders"] != "false"); | |
| 185 if (collapse && (type == "SUBDOCUMENT" || type == "IMAGE")) | |
| 186 { | |
| 187 chrome.tabs.sendMessage(tabId, { | |
| 188 reqtype: "hide-element", | |
| 189 type: type, | |
| 190 url: url, | |
| 191 documentUrl: documentUrl | |
| 192 }); | |
| 193 } | |
| 194 } | |
| 195 | |
| 196 return filter; | |
| 197 } | 179 } |
| 198 | 180 |
| 199 function isFrameWhitelisted(tabId, frameId, type) | 181 function isFrameWhitelisted(tabId, frameId, type) |
| 200 { | 182 { |
| 201 var parent = frameId; | 183 var parent = frameId; |
| 202 while (parent != -1) | 184 while (parent != -1) |
| 203 { | 185 { |
| 204 var parentData = getFrameData(tabId, parent); | 186 var parentData = getFrameData(tabId, parent); |
| 205 if (!parentData) | 187 if (!parentData) |
| 206 break; | 188 break; |
| 207 | 189 |
| 208 if (isWhitelisted(parentData.url, type) || "keyException" in parentData) | 190 if (isWhitelisted(parentData.url, type) || "keyException" in parentData) |
| 209 return true; | 191 return true; |
| 210 parent = parentData.parent; | 192 parent = parentData.parent; |
| 211 } | 193 } |
| 212 return false; | 194 return false; |
| 213 } | 195 } |
| OLD | NEW |