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

Side by Side Diff: lib/child/contentPolicy.js

Issue 29329742: Issue 3251 - Simplify messaging from child scripts to parent (Closed)
Patch Set: Rebased, no return value stringification Created Nov. 9, 2015, 11:01 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/child/bootstrap.js ('k') | lib/child/elemHide.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 * @return {Boolean} false if the request should be blocked 63 * @return {Boolean} false if the request should be blocked
64 */ 64 */
65 function shouldAllow(window, node, contentType, location) 65 function shouldAllow(window, node, contentType, location)
66 { 66 {
67 let response = sendSyncMessage("AdblockPlus:ShouldAllow", { 67 let response = sendSyncMessage("AdblockPlus:ShouldAllow", {
68 contentType: contentType, 68 contentType: contentType,
69 location: location, 69 location: location,
70 frames: getFrames(window), 70 frames: getFrames(window),
71 isPrivate: isPrivate(window) 71 isPrivate: isPrivate(window)
72 }); 72 });
73 if (response.length == 0) 73 if (typeof response == "undefined")
74 return true; 74 return true;
75 75
76 let {allow, collapse, hits} = response[0]; 76 let {allow, collapse, hits} = response;
77 for (let {frameIndex, contentType, docDomain, thirdParty, location, filter} of hits) 77 for (let {frameIndex, contentType, docDomain, thirdParty, location, filter} of hits)
78 { 78 {
79 let context = node; 79 let context = node;
80 if (typeof frameIndex == "number") 80 if (typeof frameIndex == "number")
81 { 81 {
82 context = window; 82 context = window;
83 for (let i = 0; i < frameIndex; i++) 83 for (let i = 0; i < frameIndex; i++)
84 context = context.parent; 84 context = context.parent;
85 context = context.document; 85 context = context.document;
86 } 86 }
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 let property = (hasCols ? "cols" : "rows"); 349 let property = (hasCols ? "cols" : "rows");
350 let weights = parentNode[property].split(","); 350 let weights = parentNode[property].split(",");
351 weights[index] = "0"; 351 weights[index] = "0";
352 parentNode[property] = weights.join(","); 352 parentNode[property] = weights.join(",");
353 } 353 }
354 } 354 }
355 else 355 else
356 node.classList.add(collapsedClass); 356 node.classList.add(collapsedClass);
357 } 357 }
358 } 358 }
OLDNEW
« 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