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

Unified Diff: lib/contentPolicy.js

Issue 29329884: Issue 3224 - Unbreak filter assistant (Closed)
Patch Set: Rebased Created Nov. 12, 2015, 3:10 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/contentPolicy.js
===================================================================
--- a/lib/contentPolicy.js
+++ b/lib/contentPolicy.js
@@ -257,28 +257,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*/
@@ -384,25 +397,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);
-}

Powered by Google App Engine
This is Rietveld