Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/requestNotifier.js

Issue 29329450: Issue 3208 - Don`t use numerical content types outside nsIContentPolicy.shouldLoad (Closed)
Patch Set: Created Oct. 29, 2015, 12:23 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 if (hasEntry(windowSelection, wnd.document)) 202 if (hasEntry(windowSelection, wnd.document))
203 return getEntry(windowSelection, wnd.document); 203 return getEntry(windowSelection, wnd.document);
204 else 204 else
205 return null; 205 return null;
206 }; 206 };
207 207
208 /** 208 /**
209 * Attaches request data to a DOM node. 209 * Attaches request data to a DOM node.
210 * @param {Node} node node to attach data to 210 * @param {Node} node node to attach data to
211 * @param {Window} topWnd top-level window the node belongs to 211 * @param {Window} topWnd top-level window the node belongs to
212 * @param {Integer} contentType request type, one of the Policy.type.* constan ts 212 * @param {String} contentType request type, e.g. "IMAGE"
213 * @param {String} docDomain domain of the document that initiated the request 213 * @param {String} docDomain domain of the document that initiated the request
214 * @param {Boolean} thirdParty will be true if a third-party server has been re quested 214 * @param {Boolean} thirdParty will be true if a third-party server has been re quested
215 * @param {String} location the address that has been requested 215 * @param {String} location the address that has been requested
216 * @param {Filter} filter filter applied to the request or null if none 216 * @param {Filter} filter filter applied to the request or null if none
217 */ 217 */
218 RequestNotifier.addNodeData = function(/**Node*/ node, /**Window*/ topWnd, /**In teger*/ contentType, /**String*/ docDomain, /**Boolean*/ thirdParty, /**String*/ location, /**Filter*/ filter) 218 RequestNotifier.addNodeData = function(/**Node*/ node, /**Window*/ topWnd, /**St ring*/ contentType, /**String*/ docDomain, /**Boolean*/ thirdParty, /**String*/ location, /**Filter*/ filter)
Thomas Greiner 2015/11/02 18:54:37 Detail: The inline documentation here is highly re
Wladimir Palant 2015/11/03 11:26:49 True, this aspect of my original patch got lost. W
219 { 219 {
220 return new RequestEntry(node, topWnd, contentType, docDomain, thirdParty, loca tion, filter); 220 return new RequestEntry(node, topWnd, contentType, docDomain, thirdParty, loca tion, filter);
221 } 221 }
222 222
223 /** 223 /**
224 * Retrieves the statistics for a window. 224 * Retrieves the statistics for a window.
225 * @result {Object} Object with the properties items, blocked, whitelisted, hidd en, filters containing statistics for the window (might be null) 225 * @result {Object} Object with the properties items, blocked, whitelisted, hidd en, filters containing statistics for the window (might be null)
226 */ 226 */
227 RequestNotifier.getWindowStatistics = function(/**Window*/ wnd) 227 RequestNotifier.getWindowStatistics = function(/**Window*/ wnd)
228 { 228 {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 notifier.notifyListener(topWnd, node, this); 325 notifier.notifyListener(topWnd, node, this);
326 } 326 }
327 RequestEntry.prototype = 327 RequestEntry.prototype =
328 { 328 {
329 /** 329 /**
330 * id of request (used to determine last entry attached to a node) 330 * id of request (used to determine last entry attached to a node)
331 * @type integer 331 * @type integer
332 */ 332 */
333 id: 0, 333 id: 0,
334 /** 334 /**
335 * Content type of the request (one of the nsIContentPolicy constants) 335 * Content type of the request, e.g. "IMAGE"
336 * @type Integer 336 * @type String
337 */ 337 */
338 type: null, 338 type: null,
339 /** 339 /**
340 * Domain name of the requesting document 340 * Domain name of the requesting document
341 * @type String 341 * @type String
342 */ 342 */
343 docDomain: null, 343 docDomain: null,
344 /** 344 /**
345 * True if the request goes to a different domain than the domain of the conta ining document 345 * True if the request goes to a different domain than the domain of the conta ining document
346 * @type Boolean 346 * @type Boolean
347 */ 347 */
348 thirdParty: false, 348 thirdParty: false,
349 /** 349 /**
350 * Address being requested 350 * Address being requested
351 * @type String 351 * @type String
352 */ 352 */
353 location: null, 353 location: null,
354 /** 354 /**
355 * Filter that was applied to this request (if any) 355 * Filter that was applied to this request (if any)
356 * @type Filter 356 * @type Filter
357 */ 357 */
358 filter: null, 358 filter: null,
359 /** 359 /**
360 * String representation of the content type, e.g. "subdocument" 360 * String representation of the content type, e.g. "subdocument"
361 * @type String 361 * @type String
362 */ 362 */
363 get typeDescr() 363 get typeDescr()
364 { 364 {
365 return require("contentPolicy").Policy.typeDescr[this.type]; 365 return this.type;
366 }, 366 },
367 /** 367 /**
368 * User-visible localized representation of the content type, e.g. "frame" 368 * User-visible localized representation of the content type, e.g. "frame"
369 * @type String 369 * @type String
370 */ 370 */
371 get localizedDescr() 371 get localizedDescr()
372 { 372 {
373 return require("contentPolicy").Policy.localizedDescr[this.type]; 373 return require("contentPolicy").Policy.localizedDescr.get(this.type);
374 }, 374 },
375 375
376 /** 376 /**
377 * Attaches this request object to a DOM node. 377 * Attaches this request object to a DOM node.
378 */ 378 */
379 attachToNode: function(/**Node*/ node) 379 attachToNode: function(/**Node*/ node)
380 { 380 {
381 let existingData = getEntry(nodeData, node); 381 let existingData = getEntry(nodeData, node);
382 if (typeof existingData == "undefined") 382 if (typeof existingData == "undefined")
383 { 383 {
384 existingData = {}; 384 existingData = {};
385 setEntry(nodeData, node, existingData); 385 setEntry(nodeData, node, existingData);
386 } 386 }
387 387
388 // Add this request to the node data 388 // Add this request to the node data
389 existingData[this.type + " " + this.location] = this; 389 existingData[this.type + " " + this.location] = this;
390 } 390 }
391 }; 391 };
OLDNEW
« lib/contentPolicy.js ('K') | « lib/objectTabs.js ('k') | lib/ui.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld