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

Side by Side Diff: lib/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. 11, 2015, 5:47 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 | « lib/child/elemHide.js ('k') | lib/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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 onShutdown.add(() => 94 onShutdown.add(() =>
95 { 95 {
96 Utils.styleService.unregisterSheet(collapseStyle, Ci.nsIStyleSheetService. USER_SHEET); 96 Utils.styleService.unregisterSheet(collapseStyle, Ci.nsIStyleSheetService. USER_SHEET);
97 }); 97 });
98 }, 98 },
99 99
100 /** 100 /**
101 * Checks whether a node should be blocked, hides it if necessary 101 * Checks whether a node should be blocked, hides it if necessary
102 * @param {Object} data request data 102 * @param {Object} data request data
103 * @param {String} data.contentType 103 * @param {String} data.contentType
104 * @param {String} data.location 104 * @param {String} data.location location of the request, filter key if conte ntType is ELEMHIDE
105 * @param {Object[]} data.frames 105 * @param {Object[]} data.frames
106 * @param {Boolean} data.isPrivate true if the request belongs to a private b rowsing window 106 * @param {Boolean} data.isPrivate true if the request belongs to a private b rowsing window
107 * @return {Object} An object containing properties block, collapse and hits 107 * @return {Object} An object containing properties block, collapse and hits
108 * indicating how this request should be handled. 108 * indicating how this request should be handled.
109 */ 109 */
110 shouldAllow: function({contentType, location, frames, isPrivate}) 110 shouldAllow: function({contentType, location, frames, isPrivate})
111 { 111 {
112 let hits = []; 112 let hits = [];
113 113
114 function addHit(frameIndex, contentType, docDomain, thirdParty, location, fi lter) 114 function addHit(frameIndex, contentType, docDomain, thirdParty, location, fi lter)
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 nogenericMatch); 172 nogenericMatch);
173 } 173 }
174 174
175 if (frame == testSitekeyFrame) 175 if (frame == testSitekeyFrame)
176 [testSitekey, testSitekeyFrame] = getSitekey(frames.slice(i + 1)); 176 [testSitekey, testSitekeyFrame] = getSitekey(frames.slice(i + 1));
177 } 177 }
178 } 178 }
179 179
180 if (!match && contentType == "ELEMHIDE") 180 if (!match && contentType == "ELEMHIDE")
181 { 181 {
182 match = location; 182 match = ElemHide.getFilterByKey(location);
183 location = match.text.replace(/^.*?#/, '#'); 183 location = match.text.replace(/^.*?#/, '#');
184 184
185 if (!match.isActiveOnDomain(docDomain)) 185 if (!match.isActiveOnDomain(docDomain))
186 return response(true, false); 186 return response(true, false);
187 187
188 let exception = ElemHide.getException(match, docDomain); 188 let exception = ElemHide.getException(match, docDomain);
189 if (exception) 189 if (exception)
190 { 190 {
191 addHit(null, contentType, docDomain, false, location, exception); 191 addHit(null, contentType, docDomain, false, location, exception);
192 return response(true, false); 192 return response(true, false);
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 if (!wnd || wnd.closed) 404 if (!wnd || wnd.closed)
405 return; 405 return;
406 406
407 if (entry.type == "OBJECT") 407 if (entry.type == "OBJECT")
408 { 408 {
409 node.removeEventListener("mouseover", objectMouseEventHander, true); 409 node.removeEventListener("mouseover", objectMouseEventHander, true);
410 node.removeEventListener("mouseout", objectMouseEventHander, true); 410 node.removeEventListener("mouseout", objectMouseEventHander, true);
411 } 411 }
412 Policy.processNode(wnd, node, entry.type, entry.location, true); 412 Policy.processNode(wnd, node, entry.type, entry.location, true);
413 } 413 }
OLDNEW
« no previous file with comments | « lib/child/elemHide.js ('k') | lib/elemHide.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld