Index: lib/contentPolicy.js |
=================================================================== |
--- a/lib/contentPolicy.js |
+++ b/lib/contentPolicy.js |
@@ -261,28 +261,41 @@ var Policy = exports.Policy = |
* @return {Filter} matching exception rule or null if not whitelisted |
*/ |
isWindowWhitelisted: function(wnd) |
{ |
return this.isWhitelisted(getWindowLocation(wnd)); |
}, |
/** |
- * Asynchronously re-checks filters for given nodes. |
- * @param {Node[]} nodes |
+ * Deletes nodes that were previously stored with a |
+ * RequestNotifier.storeNodesForEntries() call or similar. |
+ * @param {string} id unique ID of the nodes |
+ */ |
+ deleteNodes: function(id) |
+ { |
+ let messageManager = Cc["@mozilla.org/parentprocessmessagemanager;1"] |
+ .getService(Ci.nsIMessageBroadcaster); |
+ messageManager.broadcastAsyncMessage("AdblockPlus:DeleteNodes", id); |
+ }, |
+ |
+ /** |
+ * Asynchronously re-checks filters for nodes given by an ID previously |
+ * returned by a RequestNotifier.storeNodesForEntries() call or similar. |
+ * @param {string} id unique ID of the nodes |
* @param {RequestEntry} entry |
*/ |
- refilterNodes: function(nodes, entry) |
+ refilterNodes: function(id, entry) |
{ |
- // Ignore nodes that have been blocked already |
- if (entry.filter && !(entry.filter instanceof WhitelistFilter)) |
- return; |
- |
- for (let node of nodes) |
- Utils.runAsync(() => refilterNode(node, entry)); |
+ let messageManager = Cc["@mozilla.org/parentprocessmessagemanager;1"] |
+ .getService(Ci.nsIMessageBroadcaster); |
+ messageManager.broadcastAsyncMessage("AdblockPlus:RefilterNodes", { |
+ nodesID: id, |
+ entry: entry |
+ }); |
} |
}; |
Policy.init(); |
/** |
* Extracts the hostname from a URL (might return null). |
*/ |
function getHostname(/**String*/ url) /**String*/ |
@@ -388,25 +401,8 @@ function isThirdParty(/**String*/locatio |
let host = ""; |
try |
{ |
host = uri.host; |
} catch (e) {} |
return host != docDomain; |
} |
} |
- |
-/** |
- * Re-checks filters on an element. |
- */ |
-function refilterNode(/**Node*/ node, /**RequestEntry*/ entry) |
-{ |
- let wnd = Utils.getWindow(node); |
- if (!wnd || wnd.closed) |
- return; |
- |
- if (entry.type == "OBJECT") |
- { |
- node.removeEventListener("mouseover", objectMouseEventHander, true); |
- node.removeEventListener("mouseout", objectMouseEventHander, true); |
- } |
- Policy.processNode(wnd, node, entry.type, entry.location, true); |
-} |