[Pkg-mozext-commits] [adblock-plus] 08/28: issue #362 - RequestNotifier.getDataForNode should return last entry attached to a node
David Prévot
taffit at moszumanska.debian.org
Wed Nov 12 02:09:49 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository adblock-plus.
commit 461b6529d5299cf2e0652ce74e82c92be13e0e92
Author: Manvel Saroyan <manvel at adblockplus.org>
Date: Mon Aug 18 15:46:19 2014 +0400
issue #362 - RequestNotifier.getDataForNode should return last entry attached to a node
---
lib/requestNotifier.js | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/lib/requestNotifier.js b/lib/requestNotifier.js
index 2ee9ec3..b6e5700 100644
--- a/lib/requestNotifier.js
+++ b/lib/requestNotifier.js
@@ -27,6 +27,7 @@ let {BlockingFilter, WhitelistFilter, ElemHideBase, ElemHideFilter, ElemHideExce
let nodeData = new WeakMap();
let windowStats = new WeakMap();
let windowSelection = new WeakMap();
+let requestEntryMaxId = 0;
let setEntry, hasEntry, getEntry;
// Last issue(Bug 982561) preventing us from using WeakMap fixed for FF version 32
@@ -244,16 +245,19 @@ RequestNotifier.getDataForNode = function(node, noParent, type, location)
let data = getEntry(nodeData, node);
if (typeof data != "undefined")
{
+ let entry = null;
// Look for matching entry
for (let k in data)
{
- let entry = data[k];
- if ((typeof type == "undefined" || entry.type == type) &&
- (typeof location == "undefined" || entry.location == location))
+ if ((!entry || entry.id < data[k].id) &&
+ (typeof type == "undefined" || data[k].type == type) &&
+ (typeof location == "undefined" || data[k].location == location))
{
- return [node, entry];
+ entry = data[k];
}
}
+ if (entry)
+ return [node, entry];
}
// If we don't have any match on this node then maybe its parent will do
@@ -278,6 +282,7 @@ function RequestEntry(node, topWnd, contentType, docDomain, thirdParty, location
this.thirdParty = thirdParty;
this.location = location;
this.filter = filter;
+ this.id = ++requestEntryMaxId;
this.attachToNode(node);
@@ -319,6 +324,11 @@ function RequestEntry(node, topWnd, contentType, docDomain, thirdParty, location
RequestEntry.prototype =
{
/**
+ * id of request (used to determine last entry attached to a node)
+ * @type integer
+ */
+ id: 0,
+ /**
* Content type of the request (one of the nsIContentPolicy constants)
* @type Integer
*/
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git
More information about the Pkg-mozext-commits
mailing list