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

Side by Side Diff: lib/child/elemHide.js

Issue 29347296: Issue 4227 - Add some checks to consider edge conditions when element hiding stylesheet is applied (Closed)
Patch Set: Created July 6, 2016, 1: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 | « 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 <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 return; 326 return;
327 327
328 port.emitWithResponse("elemhideEnabled", { 328 port.emitWithResponse("elemhideEnabled", {
329 frames: getFrames(subject), 329 frames: getFrames(subject),
330 isPrivate: isPrivate(subject) 330 isPrivate: isPrivate(subject)
331 }).then(({ 331 }).then(({
332 enabled, contentType, docDomain, thirdParty, location, filter, 332 enabled, contentType, docDomain, thirdParty, location, filter,
333 filterType 333 filterType
334 }) => 334 }) =>
335 { 335 {
336 if (Cu.isDeadWrapper(subject))
337 {
338 // We are too late, the window is gone already.
339 return;
340 }
341
336 if (enabled) 342 if (enabled)
337 { 343 {
338 if (!this.sheet) 344 if (!this.sheet)
339 { 345 {
340 this.sheet = Utils.styleService.preloadSheet(this.styleURL, 346 this.sheet = Utils.styleService.preloadSheet(this.styleURL,
341 Ci.nsIStyleSheetService.USER_SHEET); 347 Ci.nsIStyleSheetService.USER_SHEET);
342 } 348 }
343 349
344 let utils = subject.QueryInterface(Ci.nsIInterfaceRequestor) 350 let utils = subject.QueryInterface(Ci.nsIInterfaceRequestor)
345 .getInterface(Ci.nsIDOMWindowUtils); 351 .getInterface(Ci.nsIDOMWindowUtils);
346 utils.addSheet(this.sheet, Ci.nsIStyleSheetService.USER_SHEET); 352 try
353 {
354 utils.addSheet(this.sheet, Ci.nsIStyleSheetService.USER_SHEET);
355 }
356 catch (e)
357 {
358 // Ignore NS_ERROR_ILLEGAL_VALUE - it will be thrown if we try to add
359 // the stylesheet multiple times to the same document (the observer
360 // will be notified twice for some documents).
361 if (e.result != Cr.NS_ERROR_ILLEGAL_VALUE)
362 throw e;
363 }
347 } 364 }
348 else if (filter) 365 else if (filter)
349 { 366 {
350 RequestNotifier.addNodeData(subject.document, subject.top, { 367 RequestNotifier.addNodeData(subject.document, subject.top, {
351 contentType, docDomain, thirdParty, location, filter, filterType 368 contentType, docDomain, thirdParty, location, filter, filterType
352 }); 369 });
353 } 370 }
354 }); 371 });
355 } 372 }
356 }; 373 };
357 observer.init(); 374 observer.init();
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