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

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

Issue 29348026: Issue 4251 - Fixed hang trying to apply element hiding rules to blocked frames (Closed)
Patch Set: Created July 19, 2016, 4:19 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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 }, 321 },
322 322
323 observe: function(subject, topic, data) 323 observe: function(subject, topic, data)
324 { 324 {
325 if (topic != this.topic) 325 if (topic != this.topic)
326 return; 326 return;
327 327
328 if (subject.document.readyState == "uninitialized") 328 if (subject.document.readyState == "uninitialized")
329 { 329 {
330 // It would be nice to listen to the readystatechange event here. However, 330 // It would be nice to listen to the readystatechange event here. However,
331 // it doesn't fire when changing from "uninitialized" state. 331 // adding event listeners on uninitialized documents isn't possible. So
332 Utils.runAsync(() => 332 // we listen for DOMContentLoaded and beforescriptexecute - whichever
333 // fires first.
334 let listener = () =>
333 { 335 {
334 if (!Cu.isDeadWrapper(subject)) 336 subject.removeEventListener("DOMContentLoaded", listener);
335 this.observe(subject, topic, data); 337 subject.removeEventListener("beforescriptexecute", listener);
336 }); 338 this.observe(subject, topic, data);
339 };
340 subject.addEventListener("DOMContentLoaded", listener);
341 subject.addEventListener("beforescriptexecute", listener);
Wladimir Palant 2016/07/19 16:23:25 For reference, DOMContentLoaded fires too late - w
337 return; 342 return;
338 } 343 }
339 344
340 port.emitWithResponse("elemhideEnabled", { 345 port.emitWithResponse("elemhideEnabled", {
341 frames: getFrames(subject), 346 frames: getFrames(subject),
342 isPrivate: isPrivate(subject) 347 isPrivate: isPrivate(subject)
343 }).then(({ 348 }).then(({
344 enabled, contentType, docDomain, thirdParty, location, filter, 349 enabled, contentType, docDomain, thirdParty, location, filter,
345 filterType 350 filterType
346 }) => 351 }) =>
(...skipping 30 matching lines...) Expand all
377 else if (filter) 382 else if (filter)
378 { 383 {
379 RequestNotifier.addNodeData(subject.document, subject.top, { 384 RequestNotifier.addNodeData(subject.document, subject.top, {
380 contentType, docDomain, thirdParty, location, filter, filterType 385 contentType, docDomain, thirdParty, location, filter, filterType
381 }); 386 });
382 } 387 }
383 }); 388 });
384 } 389 }
385 }; 390 };
386 observer.init(); 391 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