Left: | ||
Right: |
OLD | NEW |
---|---|
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
234 * @param {Boolean} noParent if missing or false, the search will extend to the parent nodes until one is found that has data associated with it | 234 * @param {Boolean} noParent if missing or false, the search will extend to the parent nodes until one is found that has data associated with it |
235 * @param {Integer} [type] request type to be looking for | 235 * @param {Integer} [type] request type to be looking for |
236 * @param {String} [location] request location to be looking for | 236 * @param {String} [location] request location to be looking for |
237 * @result {[Node, RequestEntry]} | 237 * @result {[Node, RequestEntry]} |
238 * @static | 238 * @static |
239 */ | 239 */ |
240 RequestNotifier.getDataForNode = function(node, noParent, type, location) | 240 RequestNotifier.getDataForNode = function(node, noParent, type, location) |
241 { | 241 { |
242 while (node) | 242 while (node) |
243 { | 243 { |
244 let data = getEntry(nodeData, node); | 244 let entry = getEntry(nodeData, node); |
245 if (typeof data != "undefined") | 245 if (typeof entry != "undefined" && |
246 (typeof type == "undefined" || entry.type == type) && | |
247 (typeof location == "undefined" || entry.location == location)) | |
246 { | 248 { |
247 // Look for matching entry | 249 return [node, entry]; |
248 for (let k in data) | |
249 { | |
250 let entry = data[k]; | |
251 if ((typeof type == "undefined" || entry.type == type) && | |
252 (typeof location == "undefined" || entry.location == location)) | |
253 { | |
254 return [node, entry]; | |
255 } | |
256 } | |
257 } | 250 } |
258 | 251 |
259 // If we don't have any match on this node then maybe its parent will do | 252 // If we don't have any match on this node then maybe its parent will do |
260 if ((typeof noParent != "boolean" || !noParent) && | 253 if ((typeof noParent != "boolean" || !noParent) && |
261 node.parentNode instanceof Ci.nsIDOMElement) | 254 node.parentNode instanceof Ci.nsIDOMElement) |
262 { | 255 { |
263 node = node.parentNode; | 256 node = node.parentNode; |
264 } | 257 } |
265 else | 258 else |
266 { | 259 { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
358 get localizedDescr() | 351 get localizedDescr() |
359 { | 352 { |
360 return require("contentPolicy").Policy.localizedDescr[this.type]; | 353 return require("contentPolicy").Policy.localizedDescr[this.type]; |
361 }, | 354 }, |
362 | 355 |
363 /** | 356 /** |
364 * Attaches this request object to a DOM node. | 357 * Attaches this request object to a DOM node. |
365 */ | 358 */ |
366 attachToNode: function(/**Node*/ node) | 359 attachToNode: function(/**Node*/ node) |
367 { | 360 { |
368 let existingData = getEntry(nodeData, node); | 361 setEntry(nodeData, node, this); |
Wladimir Palant
2014/08/14 20:44:57
The the list of blockable items is broken now beca
saroyanm
2014/08/17 14:25:21
Oops, Thanks for that.
| |
369 if (typeof existingData == "undefined") | |
370 { | |
371 existingData = {}; | |
372 setEntry(nodeData, node, existingData); | |
373 } | |
374 | |
375 // Add this request to the node data | |
376 existingData[this.type + " " + this.location] = this; | |
377 } | 362 } |
378 }; | 363 }; |
OLD | NEW |