OLD | NEW |
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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 this._scheduledProcessing = {stylesheets}; | 544 this._scheduledProcessing = {stylesheets}; |
545 setTimeout(() => | 545 setTimeout(() => |
546 { | 546 { |
547 let newStylesheets = this._scheduledProcessing.stylesheets; | 547 let newStylesheets = this._scheduledProcessing.stylesheets; |
548 this._filteringInProgress = true; | 548 this._filteringInProgress = true; |
549 this._scheduledProcessing = null; | 549 this._scheduledProcessing = null; |
550 this._addSelectors(newStylesheets, completion); | 550 this._addSelectors(newStylesheets, completion); |
551 }, | 551 }, |
552 MIN_INVOCATION_INTERVAL - (performance.now() - this._lastInvocation)); | 552 MIN_INVOCATION_INTERVAL - (performance.now() - this._lastInvocation)); |
553 } | 553 } |
| 554 else if (this.document.readyState == "loading") |
| 555 { |
| 556 this._scheduledProcessing = {stylesheets}; |
| 557 let handler = () => |
| 558 { |
| 559 document.removeEventListener("DOMContentLoaded", handler); |
| 560 let newStylesheets = this._scheduledProcessing.stylesheets; |
| 561 this._filteringInProgress = true; |
| 562 this._scheduledProcessing = null; |
| 563 this._addSelectors(newStylesheets, completion); |
| 564 }; |
| 565 document.addEventListener("DOMContentLoaded", handler); |
| 566 } |
554 else | 567 else |
555 { | 568 { |
556 this._filteringInProgress = true; | 569 this._filteringInProgress = true; |
557 this._addSelectors(stylesheets, completion); | 570 this._addSelectors(stylesheets, completion); |
558 } | 571 } |
559 }, | 572 }, |
560 | 573 |
561 onLoad(event) | 574 onLoad(event) |
562 { | 575 { |
563 let stylesheet = event.target.sheet; | 576 let stylesheet = event.target.sheet; |
(...skipping 27 matching lines...) Expand all Loading... |
591 characterData: true, | 604 characterData: true, |
592 subtree: true | 605 subtree: true |
593 } | 606 } |
594 ); | 607 ); |
595 this.document.addEventListener("load", this.onLoad.bind(this), true); | 608 this.document.addEventListener("load", this.onLoad.bind(this), true); |
596 } | 609 } |
597 } | 610 } |
598 }; | 611 }; |
599 | 612 |
600 exports.ElemHideEmulation = ElemHideEmulation; | 613 exports.ElemHideEmulation = ElemHideEmulation; |
OLD | NEW |