| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of the Adblock Plus, | 2 * This file is part of the Adblock Plus, |
| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 Utils.httpProtocol.userAgent // HTTP_USER_AGENT | 189 Utils.httpProtocol.userAgent // HTTP_USER_AGENT |
| 190 ]; | 190 ]; |
| 191 if (Utils.verifySignature(key, signature, params.join("\0"))) | 191 if (Utils.verifySignature(key, signature, params.join("\0"))) |
| 192 match = keyMatch; | 192 match = keyMatch; |
| 193 } | 193 } |
| 194 } | 194 } |
| 195 } | 195 } |
| 196 | 196 |
| 197 if (match instanceof WhitelistFilter) | 197 if (match instanceof WhitelistFilter) |
| 198 { | 198 { |
| 199 FilterStorage.increaseHitCount(match); | 199 FilterStorage.increaseHitCount(match, wnd); |
| 200 RequestNotifier.addNodeData(testWnd.document, topWnd, Policy.type.DOCU
MENT, getHostname(parentWndLocation), false, testWndLocation, match); | 200 RequestNotifier.addNodeData(testWnd.document, topWnd, Policy.type.DOCU
MENT, getHostname(parentWndLocation), false, testWndLocation, match); |
| 201 return true; | 201 return true; |
| 202 } | 202 } |
| 203 | 203 |
| 204 if (testWnd.parent == testWnd) | 204 if (testWnd.parent == testWnd) |
| 205 break; | 205 break; |
| 206 else | 206 else |
| 207 testWnd = testWnd.parent; | 207 testWnd = testWnd.parent; |
| 208 } | 208 } |
| 209 } | 209 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 222 let testWnd = wnd; | 222 let testWnd = wnd; |
| 223 let parentWndLocation = getWindowLocation(testWnd); | 223 let parentWndLocation = getWindowLocation(testWnd); |
| 224 while (true) | 224 while (true) |
| 225 { | 225 { |
| 226 let testWndLocation = parentWndLocation; | 226 let testWndLocation = parentWndLocation; |
| 227 parentWndLocation = (testWnd == testWnd.parent ? testWndLocation : getWi
ndowLocation(testWnd.parent)); | 227 parentWndLocation = (testWnd == testWnd.parent ? testWndLocation : getWi
ndowLocation(testWnd.parent)); |
| 228 let parentDocDomain = getHostname(parentWndLocation); | 228 let parentDocDomain = getHostname(parentWndLocation); |
| 229 match = defaultMatcher.matchesAny(testWndLocation, "ELEMHIDE", parentDoc
Domain, false); | 229 match = defaultMatcher.matchesAny(testWndLocation, "ELEMHIDE", parentDoc
Domain, false); |
| 230 if (match instanceof WhitelistFilter) | 230 if (match instanceof WhitelistFilter) |
| 231 { | 231 { |
| 232 FilterStorage.increaseHitCount(match); | 232 FilterStorage.increaseHitCount(match, wnd); |
| 233 RequestNotifier.addNodeData(testWnd.document, topWnd, contentType, par
entDocDomain, false, testWndLocation, match); | 233 RequestNotifier.addNodeData(testWnd.document, topWnd, contentType, par
entDocDomain, false, testWndLocation, match); |
| 234 return true; | 234 return true; |
| 235 } | 235 } |
| 236 | 236 |
| 237 if (testWnd.parent == testWnd) | 237 if (testWnd.parent == testWnd) |
| 238 break; | 238 break; |
| 239 else | 239 else |
| 240 testWnd = testWnd.parent; | 240 testWnd = testWnd.parent; |
| 241 } | 241 } |
| 242 | 242 |
| 243 match = location; | 243 match = location; |
| 244 locationText = match.text.replace(/^.*?#/, '#'); | 244 locationText = match.text.replace(/^.*?#/, '#'); |
| 245 location = locationText; | 245 location = locationText; |
| 246 | 246 |
| 247 if (!match.isActiveOnDomain(docDomain)) | 247 if (!match.isActiveOnDomain(docDomain)) |
| 248 return true; | 248 return true; |
| 249 | 249 |
| 250 let exception = ElemHide.getException(match, docDomain); | 250 let exception = ElemHide.getException(match, docDomain); |
| 251 if (exception) | 251 if (exception) |
| 252 { | 252 { |
| 253 FilterStorage.increaseHitCount(exception); | 253 FilterStorage.increaseHitCount(exception, wnd); |
| 254 RequestNotifier.addNodeData(node, topWnd, contentType, docDomain, thirdP
arty, locationText, exception); | 254 RequestNotifier.addNodeData(node, topWnd, contentType, docDomain, thirdP
arty, locationText, exception); |
| 255 return true; | 255 return true; |
| 256 } | 256 } |
| 257 } | 257 } |
| 258 | 258 |
| 259 let thirdParty = (contentType == Policy.type.ELEMHIDE ? false : isThirdParty
(location, docDomain)); | 259 let thirdParty = (contentType == Policy.type.ELEMHIDE ? false : isThirdParty
(location, docDomain)); |
| 260 | 260 |
| 261 if (!match && Prefs.enabled) | 261 if (!match && Prefs.enabled) |
| 262 { | 262 { |
| 263 match = defaultMatcher.matchesAny(locationText, Policy.typeDescr[contentTy
pe] || "", docDomain, thirdParty); | 263 match = defaultMatcher.matchesAny(locationText, Policy.typeDescr[contentTy
pe] || "", docDomain, thirdParty); |
| 264 if (match instanceof BlockingFilter && node.ownerDocument && !(contentType
in Policy.nonVisual)) | 264 if (match instanceof BlockingFilter && node.ownerDocument && !(contentType
in Policy.nonVisual)) |
| 265 { | 265 { |
| 266 let prefCollapse = (match.collapse != null ? match.collapse : !Prefs.fas
tcollapse); | 266 let prefCollapse = (match.collapse != null ? match.collapse : !Prefs.fas
tcollapse); |
| 267 if (collapse || prefCollapse) | 267 if (collapse || prefCollapse) |
| 268 schedulePostProcess(node); | 268 schedulePostProcess(node); |
| 269 } | 269 } |
| 270 | 270 |
| 271 // Track mouse events for objects | 271 // Track mouse events for objects |
| 272 if (!match && contentType == Policy.type.OBJECT && node.nodeType == Ci.nsI
DOMNode.ELEMENT_NODE) | 272 if (!match && contentType == Policy.type.OBJECT && node.nodeType == Ci.nsI
DOMNode.ELEMENT_NODE) |
| 273 { | 273 { |
| 274 node.addEventListener("mouseover", objectMouseEventHander, true); | 274 node.addEventListener("mouseover", objectMouseEventHander, true); |
| 275 node.addEventListener("mouseout", objectMouseEventHander, true); | 275 node.addEventListener("mouseout", objectMouseEventHander, true); |
| 276 } | 276 } |
| 277 } | 277 } |
| 278 | 278 |
| 279 // Store node data | 279 // Store node data |
| 280 RequestNotifier.addNodeData(node, topWnd, contentType, docDomain, thirdParty
, locationText, match); | 280 RequestNotifier.addNodeData(node, topWnd, contentType, docDomain, thirdParty
, locationText, match); |
| 281 if (match) | 281 if (match) |
| 282 FilterStorage.increaseHitCount(match); | 282 FilterStorage.increaseHitCount(match, wnd); |
| 283 | 283 |
| 284 return !match || match instanceof WhitelistFilter; | 284 return !match || match instanceof WhitelistFilter; |
| 285 }, | 285 }, |
| 286 | 286 |
| 287 /** | 287 /** |
| 288 * Checks whether the location's scheme is blockable. | 288 * Checks whether the location's scheme is blockable. |
| 289 * @param location {nsIURI} | 289 * @param location {nsIURI} |
| 290 * @return {Boolean} | 290 * @return {Boolean} |
| 291 */ | 291 */ |
| 292 isBlockableScheme: function(location) | 292 isBlockableScheme: function(location) |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 if (!wnd || wnd.closed) | 713 if (!wnd || wnd.closed) |
| 714 return; | 714 return; |
| 715 | 715 |
| 716 if (entry.type == Policy.type.OBJECT) | 716 if (entry.type == Policy.type.OBJECT) |
| 717 { | 717 { |
| 718 node.removeEventListener("mouseover", objectMouseEventHander, true); | 718 node.removeEventListener("mouseover", objectMouseEventHander, true); |
| 719 node.removeEventListener("mouseout", objectMouseEventHander, true); | 719 node.removeEventListener("mouseout", objectMouseEventHander, true); |
| 720 } | 720 } |
| 721 Policy.processNode(wnd, node, entry.type, Utils.makeURI(entry.location), true)
; | 721 Policy.processNode(wnd, node, entry.type, Utils.makeURI(entry.location), true)
; |
| 722 } | 722 } |
| OLD | NEW |