Index: lib/requestNotifier.js |
=================================================================== |
--- a/lib/requestNotifier.js |
+++ b/lib/requestNotifier.js |
@@ -27,6 +27,7 @@ |
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 @@ |
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 @@ |
this.thirdParty = thirdParty; |
this.location = location; |
this.filter = filter; |
+ this.id = ++requestEntryMaxId; |
this.attachToNode(node); |
@@ -319,6 +324,11 @@ |
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 |
*/ |