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

Unified Diff: lib/elemHide.js

Issue 29329754: Issue 3251 - Delegate processing of element hiding hits to shouldAllowAsync() so that hits show up (Closed)
Patch Set: Rebased Created Nov. 12, 2015, 3:04 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
« lib/child/elemHide.js ('K') | « lib/contentPolicy.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/elemHide.js
===================================================================
--- a/lib/elemHide.js
+++ b/lib/elemHide.js
@@ -75,20 +75,16 @@ let ElemHide = exports.ElemHide =
*/
applied: false,
/**
* Called on module startup.
*/
init: function()
{
- Utils.addChildMessageListener("AdblockPlus:ElemHideHit", (data) => {
- return ElemHide.shouldHide(data);
- });
-
Prefs.addListener(function(name)
{
if (name == "enabled")
ElemHide.apply();
});
onShutdown.add(() => ElemHide.unapply());
let styleFile = IO.resolveFilePath(Prefs.data_directory);
@@ -184,40 +180,16 @@ let ElemHide = exports.ElemHide =
for (let i = list.length - 1; i >= 0; i--)
if (list[i].isActiveOnDomain(docDomain))
return list[i];
return null;
},
/**
- * Processes an element hiding hit
- * @param {String} message.key
- * key of the matching element hiding rule
- * @param {Object[]} message.frames
- * information required to reconstruct frame
- * data for the hit
- * @return {Boolean}
- */
- shouldHide: function(message)
- {
- let filter = ElemHide.getFilterByKey(message.key);
- if (!filter || !message.frames.length)
- return false;
-
- let {Policy} = require("contentPolicy");
- return !Policy.shouldAllow({
- contentType: "ELEMHIDE",
- location: filter,
- frames: message.frames,
- isPrivate: message.isPrivate
- }).allow;
- },
-
- /**
* Will be set to true if apply() is running (reentrance protection).
* @type Boolean
*/
_applying: false,
/**
* Will be set to true if an apply() call arrives while apply() is already
* running (delayed execution).
« lib/child/elemHide.js ('K') | « lib/contentPolicy.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld