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

Powered by Google App Engine
This is Rietveld