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

Side by Side Diff: lib/contentPolicy.js

Issue 5320026647166976: Issue 1381 - Element hiding exceptions broken after #432 landing (Closed)
Patch Set: Created Sept. 18, 2014, 12:10 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 | no next file » | 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 <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 } 182 }
183 183
184 // Data loaded by plugins should be attached to the document 184 // Data loaded by plugins should be attached to the document
185 if (contentType == Policy.type.OBJECT_SUBREQUEST && node instanceof Ci.nsIDO MElement) 185 if (contentType == Policy.type.OBJECT_SUBREQUEST && node instanceof Ci.nsIDO MElement)
186 node = node.ownerDocument; 186 node = node.ownerDocument;
187 187
188 // Fix type for objects misrepresented as frames or images 188 // Fix type for objects misrepresented as frames or images
189 if (contentType != Policy.type.OBJECT && (node instanceof Ci.nsIDOMHTMLObjec tElement || node instanceof Ci.nsIDOMHTMLEmbedElement)) 189 if (contentType != Policy.type.OBJECT && (node instanceof Ci.nsIDOMHTMLObjec tElement || node instanceof Ci.nsIDOMHTMLEmbedElement))
190 contentType = Policy.type.OBJECT; 190 contentType = Policy.type.OBJECT;
191 191
192 let thirdParty = (contentType == Policy.type.ELEMHIDE ? false : isThirdParty (location, docDomain));
Thomas Greiner 2014/09/18 12:45:37 I'm sure you tried it out but I don't see how movi
Wladimir Palant 2014/09/18 12:56:22 That variable is being accessed in line 227/228 be
Thomas Greiner 2014/09/18 13:15:10 Got it, I guess I relied to much on the browser se
Wladimir Palant 2014/09/18 13:26:16 The browser search feature is fine, it's actually
192 let locationText = location.spec; 193 let locationText = location.spec;
193 if (!match && contentType == Policy.type.ELEMHIDE) 194 if (!match && contentType == Policy.type.ELEMHIDE)
194 { 195 {
195 let testWnd = wnd; 196 let testWnd = wnd;
196 let parentWndLocation = getWindowLocation(testWnd); 197 let parentWndLocation = getWindowLocation(testWnd);
197 while (true) 198 while (true)
198 { 199 {
199 let testWndLocation = parentWndLocation; 200 let testWndLocation = parentWndLocation;
200 parentWndLocation = (testWnd == testWnd.parent ? testWndLocation : getWi ndowLocation(testWnd.parent)); 201 parentWndLocation = (testWnd == testWnd.parent ? testWndLocation : getWi ndowLocation(testWnd.parent));
201 let parentDocDomain = getHostname(parentWndLocation); 202 let parentDocDomain = getHostname(parentWndLocation);
(...skipping 20 matching lines...) Expand all
222 223
223 let exception = ElemHide.getException(match, docDomain); 224 let exception = ElemHide.getException(match, docDomain);
224 if (exception) 225 if (exception)
225 { 226 {
226 FilterStorage.increaseHitCount(exception, wnd); 227 FilterStorage.increaseHitCount(exception, wnd);
227 RequestNotifier.addNodeData(node, topWnd, contentType, docDomain, thirdP arty, locationText, exception); 228 RequestNotifier.addNodeData(node, topWnd, contentType, docDomain, thirdP arty, locationText, exception);
228 return true; 229 return true;
229 } 230 }
230 } 231 }
231 232
232 let thirdParty = (contentType == Policy.type.ELEMHIDE ? false : isThirdParty (location, docDomain));
233
234 if (!match && Prefs.enabled) 233 if (!match && Prefs.enabled)
235 { 234 {
236 match = defaultMatcher.matchesAny(locationText, Policy.typeDescr[contentTy pe] || "", docDomain, thirdParty, sitekey); 235 match = defaultMatcher.matchesAny(locationText, Policy.typeDescr[contentTy pe] || "", docDomain, thirdParty, sitekey);
237 if (match instanceof BlockingFilter && node.ownerDocument && !(contentType in Policy.nonVisual)) 236 if (match instanceof BlockingFilter && node.ownerDocument && !(contentType in Policy.nonVisual))
238 { 237 {
239 let prefCollapse = (match.collapse != null ? match.collapse : !Prefs.fas tcollapse); 238 let prefCollapse = (match.collapse != null ? match.collapse : !Prefs.fas tcollapse);
240 if (collapse || prefCollapse) 239 if (collapse || prefCollapse)
241 schedulePostProcess(node); 240 schedulePostProcess(node);
242 } 241 }
243 242
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 if (!wnd || wnd.closed) 778 if (!wnd || wnd.closed)
780 return; 779 return;
781 780
782 if (entry.type == Policy.type.OBJECT) 781 if (entry.type == Policy.type.OBJECT)
783 { 782 {
784 node.removeEventListener("mouseover", objectMouseEventHander, true); 783 node.removeEventListener("mouseover", objectMouseEventHander, true);
785 node.removeEventListener("mouseout", objectMouseEventHander, true); 784 node.removeEventListener("mouseout", objectMouseEventHander, true);
786 } 785 }
787 Policy.processNode(wnd, node, entry.type, Utils.makeURI(entry.location), true) ; 786 Policy.processNode(wnd, node, entry.type, Utils.makeURI(entry.location), true) ;
788 } 787 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld