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

Side by Side 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. 12, 2015, 3:04 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
« no previous file with comments | « no previous file | lib/child/elemHide.js » ('j') | lib/child/elemHide.js » ('J')
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 schedulePostProcess(node); 97 schedulePostProcess(node);
98 } 98 }
99 return allow; 99 return allow;
100 } 100 }
101 101
102 /** 102 /**
103 * Checks whether a request should be allowed, hides it if necessary 103 * Checks whether a request should be allowed, hides it if necessary
104 * @param {nsIDOMWindow} window 104 * @param {nsIDOMWindow} window
105 * @param {nsIDOMElement} node 105 * @param {nsIDOMElement} node
106 * @param {String} contentType 106 * @param {String} contentType
107 * @param {String} location 107 * @param {String} location location of the request, filter key if contentType i s ELEMHIDE
108 * @return {Boolean} false if the request should be blocked 108 * @return {Boolean} false if the request should be blocked
109 */ 109 */
110 function shouldAllow(window, node, contentType, location) 110 let shouldAllow = exports.shouldAllow = function(window, node, contentType, loca tion)
111 { 111 {
112 return processPolicyResponse(window, node, sendSyncMessage("AdblockPlus:Should Allow", { 112 return processPolicyResponse(window, node, sendSyncMessage("AdblockPlus:Should Allow", {
113 contentType, 113 contentType,
114 location, 114 location,
115 frames: getFrames(window), 115 frames: getFrames(window),
116 isPrivate: isPrivate(window) 116 isPrivate: isPrivate(window)
117 })); 117 }));
118 } 118 };
119 119
120 /** 120 /**
121 * Asynchronously checks whether a request should be allowed. 121 * Asynchronously checks whether a request should be allowed.
122 * @param {nsIDOMWindow} window 122 * @param {nsIDOMWindow} window
123 * @param {nsIDOMElement} node 123 * @param {nsIDOMElement} node
124 * @param {String} contentType 124 * @param {String} contentType
125 * @param {String} location 125 * @param {String} location location of the request, filter key if contentType i s ELEMHIDE
126 * @param {Function} callback callback to be called with a boolean value, if 126 * @param {Function} callback callback to be called with a boolean value, if
127 * false the request should be blocked 127 * false the request should be blocked
128 */ 128 */
129 function shouldAllowAsync(window, node, contentType, location, callback) 129 let shouldAllowAsync = exports.shouldAllowAsync = function(window, node, content Type, location, callback)
130 { 130 {
131 sendAsyncMessage("AdblockPlus:ShouldAllow", { 131 sendAsyncMessage("AdblockPlus:ShouldAllow", {
132 contentType, 132 contentType,
133 location, 133 location,
134 frames: getFrames(window), 134 frames: getFrames(window),
135 isPrivate: isPrivate(window) 135 isPrivate: isPrivate(window)
136 }, response => callback(processPolicyResponse(window, node, response))); 136 }, response => callback(processPolicyResponse(window, node, response)));
137 } 137 };
138 138
139 /** 139 /**
140 * Actual nsIContentPolicy and nsIChannelEventSink implementation 140 * Actual nsIContentPolicy and nsIChannelEventSink implementation
141 * @class 141 * @class
142 */ 142 */
143 var PolicyImplementation = 143 var PolicyImplementation =
144 { 144 {
145 classDescription: "Adblock Plus content policy", 145 classDescription: "Adblock Plus content policy",
146 classID: Components.ID("cfeaabe6-1dd1-11b2-a0c6-cb5c268894c9"), 146 classID: Components.ID("cfeaabe6-1dd1-11b2-a0c6-cb5c268894c9"),
147 contractID: "@adblockplus.org/abp/policy;1", 147 contractID: "@adblockplus.org/abp/policy;1",
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 let property = (hasCols ? "cols" : "rows"); 379 let property = (hasCols ? "cols" : "rows");
380 let weights = parentNode[property].split(","); 380 let weights = parentNode[property].split(",");
381 weights[index] = "0"; 381 weights[index] = "0";
382 parentNode[property] = weights.join(","); 382 parentNode[property] = weights.join(",");
383 } 383 }
384 } 384 }
385 else 385 else
386 node.classList.add(collapsedClass); 386 node.classList.add(collapsedClass);
387 } 387 }
388 } 388 }
OLDNEW
« no previous file with comments | « no previous file | lib/child/elemHide.js » ('j') | lib/child/elemHide.js » ('J')

Powered by Google App Engine
This is Rietveld