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

Unified Diff: lib/child/contentPolicy.js

Issue 29329754: Issue 3251 - Delegate processing of element hiding hits to shouldAllowAsync() so that hits show up (Closed)
Patch Set: Rebased Created Nov. 11, 2015, 5:47 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
« no previous file with comments | « no previous file | lib/child/elemHide.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/child/contentPolicy.js
===================================================================
--- a/lib/child/contentPolicy.js
+++ b/lib/child/contentPolicy.js
@@ -54,23 +54,23 @@ let collapsedClass = null;
*/
let types = new Map();
/**
* Checks whether a request should be allowed, hides it if necessary
* @param wnd {nsIDOMWindow}
* @param node {nsIDOMElement}
* @param contentType {String}
- * @param location {String}
+ * @param location {String} location of the request, filter key if contentType is ELEMHIDE
* @param [callback] {Function} If present, the request will be sent
* asynchronously and callback called with the
* response
* @return {Boolean} false if the request should be blocked
*/
-function shouldAllow(window, node, contentType, location, callback)
+let shouldAllow = exports.shouldAllow = function(window, node, contentType, location, callback)
{
function processResponse(response)
{
if (typeof response == "undefined")
return true;
let {allow, collapse, hits} = response;
for (let {frameIndex, contentType, docDomain, thirdParty, location, filter} of hits)
@@ -110,17 +110,17 @@ function shouldAllow(window, node, conte
if (typeof callback == "function")
{
sendAsyncMessage("AdblockPlus:ShouldAllow", data, (data) => {
callback(processResponse(data));
});
}
else
return processResponse(sendSyncMessage("AdblockPlus:ShouldAllow", data));
-}
+};
/**
* Actual nsIContentPolicy and nsIChannelEventSink implementation
* @class
*/
var PolicyImplementation =
{
classDescription: "Adblock Plus content policy",
« no previous file with comments | « no previous file | lib/child/elemHide.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld