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: Created Nov. 4, 2015, 3 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') | lib/contentPolicy.js » ('J')
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
@@ -60,17 +60,17 @@ let types = new Map();
* @param node {nsIDOMElement}
* @param contentType {String}
* @param location {String}
* @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') | lib/contentPolicy.js » ('J')

Powered by Google App Engine
This is Rietveld