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

Side by Side Diff: lib/child/requestNotifier.js

Issue 29329839: Issue 3228 - Unbreak object tabs (Closed)
Patch Set: Created Nov. 6, 2015, 7:45 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 * Retrieves the statistics for a window. 357 * Retrieves the statistics for a window.
358 * @result {Object} Object with the properties items, blocked, whitelisted, hidd en, filters containing statistics for the window (might be null) 358 * @result {Object} Object with the properties items, blocked, whitelisted, hidd en, filters containing statistics for the window (might be null)
359 */ 359 */
360 RequestNotifier.getWindowStatistics = function(/**Window*/ wnd) 360 RequestNotifier.getWindowStatistics = function(/**Window*/ wnd)
361 { 361 {
362 if (windowStats.has(wnd.document)) 362 if (windowStats.has(wnd.document))
363 return windowStats.get(wnd.document); 363 return windowStats.get(wnd.document);
364 else 364 else
365 return null; 365 return null;
366 } 366 }
367
368 /**
369 * Retrieves the request data associated with a DOM node.
370 * @param {Node} node
371 * @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
372 * @param {Integer} [type] request type to be looking for
373 * @param {String} [location] request location to be looking for
374 * @result {[Node, Object]}
375 * @static
376 */
377 RequestNotifier.getDataForNode = function(node, noParent, type, location)
Wladimir Palant 2015/11/06 19:52:43 This function moved from lib/requestNotifier.js wi
378 {
379 while (node)
380 {
381 let data = nodeData.get(node);
382 if (typeof data != "undefined")
383 {
384 let entry = null;
385 // Look for matching entry
386 for (let k in data)
387 {
388 if ((!entry || entry.id < data[k].id) &&
389 (typeof type == "undefined" || data[k].type == type) &&
390 (typeof location == "undefined" || data[k].location == location))
391 {
392 entry = data[k];
393 }
394 }
395 if (entry)
396 return [node, entry];
397 }
398
399 // If we don't have any match on this node then maybe its parent will do
400 if ((typeof noParent != "boolean" || !noParent) &&
401 node.parentNode instanceof Ci.nsIDOMElement)
402 {
403 node = node.parentNode;
404 }
405 else
406 {
407 node = null;
408 }
409 }
410
411 return null;
412 };
OLDNEW

Powered by Google App Engine
This is Rietveld