| 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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 RequestNotifier.getWindowStatistics = function(outerWindowID, callback) | 219 RequestNotifier.getWindowStatistics = function(outerWindowID, callback) |
| 220 { | 220 { |
| 221 let id = ++windowStatsMaxResponseID; | 221 let id = ++windowStatsMaxResponseID; |
| 222 windowStatsCallbacks.set(id, callback); | 222 windowStatsCallbacks.set(id, callback); |
| 223 | 223 |
| 224 messageManager.broadcastAsyncMessage("AdblockPlus:RetrieveWindowStats", { | 224 messageManager.broadcastAsyncMessage("AdblockPlus:RetrieveWindowStats", { |
| 225 responseID: id, | 225 responseID: id, |
| 226 outerWindowID | 226 outerWindowID |
| 227 }); | 227 }); |
| 228 } | 228 } |
| 229 | |
| 230 /** | |
| 231 * Retrieves the request data associated with a DOM node. | |
| 232 * @param {Node} node | |
| 233 * @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 {Integer} [type] request type to be looking for | |
| 235 * @param {String} [location] request location to be looking for | |
| 236 * @result {[Node, Object]} | |
| 237 * @static | |
| 238 */ | |
| 239 RequestNotifier.getDataForNode = function(node, noParent, type, location) | |
| 240 { | |
| 241 while (node) | |
| 242 { | |
| 243 let data = nodeData.get(node); | |
| 244 if (typeof data != "undefined") | |
| 245 { | |
| 246 let entry = null; | |
| 247 // Look for matching entry | |
| 248 for (let k in data) | |
| 249 { | |
| 250 if ((!entry || entry.id < data[k].id) && | |
| 251 (typeof type == "undefined" || data[k].type == type) && | |
| 252 (typeof location == "undefined" || data[k].location == location)) | |
| 253 { | |
| 254 entry = data[k]; | |
| 255 } | |
| 256 } | |
| 257 if (entry) | |
| 258 return [node, entry]; | |
| 259 } | |
| 260 | |
| 261 // If we don't have any match on this node then maybe its parent will do | |
| 262 if ((typeof noParent != "boolean" || !noParent) && | |
| 263 node.parentNode instanceof Ci.nsIDOMElement) | |
| 264 { | |
| 265 node = node.parentNode; | |
| 266 } | |
| 267 else | |
| 268 { | |
| 269 node = null; | |
| 270 } | |
| 271 } | |
| 272 | |
| 273 return null; | |
| 274 }; | |
| OLD | NEW |