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: Created Nov. 4, 2015, 2:58 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
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} = JSON.parse(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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 let property = (hasCols ? "cols" : "rows"); 348 let property = (hasCols ? "cols" : "rows");
349 let weights = parentNode[property].split(","); 349 let weights = parentNode[property].split(",");
350 weights[index] = "0"; 350 weights[index] = "0";
351 parentNode[property] = weights.join(","); 351 parentNode[property] = weights.join(",");
352 } 352 }
353 } 353 }
354 else 354 else
355 node.classList.add(collapsedClass); 355 node.classList.add(collapsedClass);
356 } 356 }
357 } 357 }
OLDNEW
« lib/child/bootstrap.js ('K') | « lib/child/bootstrap.js ('k') | lib/child/elemHide.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld