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

Delta Between Two Patch Sets: lib/contentPolicy.js

Issue 5320026647166976: Issue 1381 - Element hiding exceptions broken after #432 landing (Closed)
Left Patch Set: Created Sept. 18, 2014, 12:10 p.m.
Right Patch Set: More consistent approach Created Sept. 18, 2014, 1:03 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
193 let locationText = location.spec; 192 let locationText = location.spec;
194 if (!match && contentType == Policy.type.ELEMHIDE) 193 if (!match && contentType == Policy.type.ELEMHIDE)
195 { 194 {
196 let testWnd = wnd; 195 let testWnd = wnd;
197 let parentWndLocation = getWindowLocation(testWnd); 196 let parentWndLocation = getWindowLocation(testWnd);
198 while (true) 197 while (true)
199 { 198 {
200 let testWndLocation = parentWndLocation; 199 let testWndLocation = parentWndLocation;
201 parentWndLocation = (testWnd == testWnd.parent ? testWndLocation : getWi ndowLocation(testWnd.parent)); 200 parentWndLocation = (testWnd == testWnd.parent ? testWndLocation : getWi ndowLocation(testWnd.parent));
202 let parentDocDomain = getHostname(parentWndLocation); 201 let parentDocDomain = getHostname(parentWndLocation);
(...skipping 15 matching lines...) Expand all
218 locationText = match.text.replace(/^.*?#/, '#'); 217 locationText = match.text.replace(/^.*?#/, '#');
219 location = locationText; 218 location = locationText;
220 219
221 if (!match.isActiveOnDomain(docDomain)) 220 if (!match.isActiveOnDomain(docDomain))
222 return true; 221 return true;
223 222
224 let exception = ElemHide.getException(match, docDomain); 223 let exception = ElemHide.getException(match, docDomain);
225 if (exception) 224 if (exception)
226 { 225 {
227 FilterStorage.increaseHitCount(exception, wnd); 226 FilterStorage.increaseHitCount(exception, wnd);
228 RequestNotifier.addNodeData(node, topWnd, contentType, docDomain, thirdP arty, locationText, exception); 227 RequestNotifier.addNodeData(node, topWnd, contentType, docDomain, false, locationText, exception);
229 return true; 228 return true;
230 } 229 }
231 } 230 }
231
232 let thirdParty = (contentType == Policy.type.ELEMHIDE ? false : isThirdParty (location, docDomain));
232 233
233 if (!match && Prefs.enabled) 234 if (!match && Prefs.enabled)
234 { 235 {
235 match = defaultMatcher.matchesAny(locationText, Policy.typeDescr[contentTy pe] || "", docDomain, thirdParty, sitekey); 236 match = defaultMatcher.matchesAny(locationText, Policy.typeDescr[contentTy pe] || "", docDomain, thirdParty, sitekey);
236 if (match instanceof BlockingFilter && node.ownerDocument && !(contentType in Policy.nonVisual)) 237 if (match instanceof BlockingFilter && node.ownerDocument && !(contentType in Policy.nonVisual))
237 { 238 {
238 let prefCollapse = (match.collapse != null ? match.collapse : !Prefs.fas tcollapse); 239 let prefCollapse = (match.collapse != null ? match.collapse : !Prefs.fas tcollapse);
239 if (collapse || prefCollapse) 240 if (collapse || prefCollapse)
240 schedulePostProcess(node); 241 schedulePostProcess(node);
241 } 242 }
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 if (!wnd || wnd.closed) 779 if (!wnd || wnd.closed)
779 return; 780 return;
780 781
781 if (entry.type == Policy.type.OBJECT) 782 if (entry.type == Policy.type.OBJECT)
782 { 783 {
783 node.removeEventListener("mouseover", objectMouseEventHander, true); 784 node.removeEventListener("mouseover", objectMouseEventHander, true);
784 node.removeEventListener("mouseout", objectMouseEventHander, true); 785 node.removeEventListener("mouseout", objectMouseEventHander, true);
785 } 786 }
786 Policy.processNode(wnd, node, entry.type, Utils.makeURI(entry.location), true) ; 787 Policy.processNode(wnd, node, entry.type, Utils.makeURI(entry.location), true) ;
787 } 788 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld