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

Unified Diff: lib/child/contentPolicy.js

Issue 29329742: Issue 3251 - Simplify messaging from child scripts to parent (Closed)
Patch Set: Adjusted a caller that was forgotten Created Nov. 9, 2015, 1:36 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 | « lib/child/bootstrap.js ('k') | 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
@@ -65,20 +65,20 @@ let types = new Map();
function shouldAllow(window, node, contentType, location)
{
let response = sendSyncMessage("AdblockPlus:ShouldAllow", {
contentType: contentType,
location: location,
frames: getFrames(window),
isPrivate: isPrivate(window)
});
- if (response.length == 0)
+ if (typeof response == "undefined")
return true;
- let {allow, collapse, hits} = response[0];
+ let {allow, collapse, hits} = response;
for (let {frameIndex, contentType, docDomain, thirdParty, location, filter} of hits)
{
let context = node;
if (typeof frameIndex == "number")
{
context = window;
for (let i = 0; i < frameIndex; i++)
context = context.parent;
@@ -312,20 +312,17 @@ function schedulePostProcess(/**Element*
/**
* Processes nodes scheduled for post-processing (typically hides them).
*/
function postProcessNodes()
{
if (!collapsedClass)
{
- let response = sendSyncMessage("AdblockPlus:GetCollapsedClass");
- if (response.length)
- collapsedClass = response[0];
-
+ collapsedClass = sendSyncMessage("AdblockPlus:GetCollapsedClass");
if (!collapsedClass)
{
Utils.runAsync(postProcessNodes);
return;
}
}
let nodes = scheduledNodes;
« no previous file with comments | « lib/child/bootstrap.js ('k') | lib/child/elemHide.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld