| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 if (windowSelection.has(wnd.document)) | 170 if (windowSelection.has(wnd.document)) |
| 171 return windowSelection.get(wnd.document); | 171 return windowSelection.get(wnd.document); |
| 172 else | 172 else |
| 173 return null; | 173 return null; |
| 174 }; | 174 }; |
| 175 | 175 |
| 176 /** | 176 /** |
| 177 * Attaches request data to a DOM node. | 177 * Attaches request data to a DOM node. |
| 178 * @param {Node} node node to attach data to | 178 * @param {Node} node node to attach data to |
| 179 * @param {Window} topWnd top-level window the node belongs to | 179 * @param {Window} topWnd top-level window the node belongs to |
| 180 * @param {Integer} contentType request type, one of the Policy.type.* constan
ts | 180 * @param {String} contentType request type, e.g. "IMAGE" |
| 181 * @param {String} docDomain domain of the document that initiated the request | 181 * @param {String} docDomain domain of the document that initiated the request |
| 182 * @param {Boolean} thirdParty will be true if a third-party server has been re
quested | 182 * @param {Boolean} thirdParty will be true if a third-party server has been re
quested |
| 183 * @param {String} location the address that has been requested | 183 * @param {String} location the address that has been requested |
| 184 * @param {Filter} filter filter applied to the request or null if none | 184 * @param {Filter} filter filter applied to the request or null if none |
| 185 */ | 185 */ |
| 186 RequestNotifier.addNodeData = function(/**Node*/ node, /**Window*/ topWnd, /**In
teger*/ contentType, /**String*/ docDomain, /**Boolean*/ thirdParty, /**String*/
location, /**Filter*/ filter) | 186 RequestNotifier.addNodeData = function(/**Node*/ node, /**Window*/ topWnd, /**St
ring*/ contentType, /**String*/ docDomain, /**Boolean*/ thirdParty, /**String*/
location, /**Filter*/ filter) |
| 187 { | 187 { |
| 188 return new RequestEntry(node, topWnd, contentType, docDomain, thirdParty, loca
tion, filter); | 188 return new RequestEntry(node, topWnd, contentType, docDomain, thirdParty, loca
tion, filter); |
| 189 } | 189 } |
| 190 | 190 |
| 191 /** | 191 /** |
| 192 * Retrieves the statistics for a window. | 192 * Retrieves the statistics for a window. |
| 193 * @result {Object} Object with the properties items, blocked, whitelisted, hidd
en, filters containing statistics for the window (might be null) | 193 * @result {Object} Object with the properties items, blocked, whitelisted, hidd
en, filters containing statistics for the window (might be null) |
| 194 */ | 194 */ |
| 195 RequestNotifier.getWindowStatistics = function(/**Window*/ wnd) | 195 RequestNotifier.getWindowStatistics = function(/**Window*/ wnd) |
| 196 { | 196 { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 notifier.notifyListener(topWnd, node, this); | 293 notifier.notifyListener(topWnd, node, this); |
| 294 } | 294 } |
| 295 RequestEntry.prototype = | 295 RequestEntry.prototype = |
| 296 { | 296 { |
| 297 /** | 297 /** |
| 298 * id of request (used to determine last entry attached to a node) | 298 * id of request (used to determine last entry attached to a node) |
| 299 * @type integer | 299 * @type integer |
| 300 */ | 300 */ |
| 301 id: 0, | 301 id: 0, |
| 302 /** | 302 /** |
| 303 * Content type of the request (one of the nsIContentPolicy constants) | 303 * Content type of the request, e.g. "IMAGE" |
| 304 * @type Integer | 304 * @type String |
| 305 */ | 305 */ |
| 306 type: null, | 306 type: null, |
| 307 /** | 307 /** |
| 308 * Domain name of the requesting document | 308 * Domain name of the requesting document |
| 309 * @type String | 309 * @type String |
| 310 */ | 310 */ |
| 311 docDomain: null, | 311 docDomain: null, |
| 312 /** | 312 /** |
| 313 * True if the request goes to a different domain than the domain of the conta
ining document | 313 * True if the request goes to a different domain than the domain of the conta
ining document |
| 314 * @type Boolean | 314 * @type Boolean |
| 315 */ | 315 */ |
| 316 thirdParty: false, | 316 thirdParty: false, |
| 317 /** | 317 /** |
| 318 * Address being requested | 318 * Address being requested |
| 319 * @type String | 319 * @type String |
| 320 */ | 320 */ |
| 321 location: null, | 321 location: null, |
| 322 /** | 322 /** |
| 323 * Filter that was applied to this request (if any) | 323 * Filter that was applied to this request (if any) |
| 324 * @type Filter | 324 * @type Filter |
| 325 */ | 325 */ |
| 326 filter: null, | 326 filter: null, |
| 327 /** | 327 /** |
| 328 * String representation of the content type, e.g. "subdocument" | 328 * String representation of the content type, e.g. "subdocument" |
| 329 * @type String | 329 * @type String |
| 330 */ | 330 */ |
| 331 get typeDescr() | 331 get typeDescr() |
| 332 { | 332 { |
| 333 return require("contentPolicy").Policy.typeDescr[this.type]; | 333 return this.type; |
| 334 }, | 334 }, |
| 335 /** | 335 /** |
| 336 * User-visible localized representation of the content type, e.g. "frame" | 336 * User-visible localized representation of the content type, e.g. "frame" |
| 337 * @type String | 337 * @type String |
| 338 */ | 338 */ |
| 339 get localizedDescr() | 339 get localizedDescr() |
| 340 { | 340 { |
| 341 return require("contentPolicy").Policy.localizedDescr[this.type]; | 341 return require("contentPolicy").Policy.localizedDescr.get(this.type); |
| 342 }, | 342 }, |
| 343 | 343 |
| 344 /** | 344 /** |
| 345 * Attaches this request object to a DOM node. | 345 * Attaches this request object to a DOM node. |
| 346 */ | 346 */ |
| 347 attachToNode: function(/**Node*/ node) | 347 attachToNode: function(/**Node*/ node) |
| 348 { | 348 { |
| 349 let existingData = nodeData.get(node); | 349 let existingData = nodeData.get(node); |
| 350 if (typeof existingData == "undefined") | 350 if (typeof existingData == "undefined") |
| 351 { | 351 { |
| 352 existingData = {}; | 352 existingData = {}; |
| 353 nodeData.set(node, existingData); | 353 nodeData.set(node, existingData); |
| 354 } | 354 } |
| 355 | 355 |
| 356 // Add this request to the node data | 356 // Add this request to the node data |
| 357 existingData[this.type + " " + this.location] = this; | 357 existingData[this.type + " " + this.location] = this; |
| 358 } | 358 } |
| 359 }; | 359 }; |
| OLD | NEW |