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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 "Services", | 79 "Services", |
80 { | 80 { |
81 obs: { | 81 obs: { |
82 addObserver() {}, | 82 addObserver() {}, |
83 removeObserver() {} | 83 removeObserver() {} |
84 } | 84 } |
85 } | 85 } |
86 ] | 86 ] |
87 ]); | 87 ]); |
88 | 88 |
89 function FakeTimer() | 89 class FakeTimer |
90 { | 90 { |
91 } | |
92 FakeTimer.prototype = | |
93 { | |
94 delay: 0, | |
95 callback: null, | |
96 initWithCallback(callback, delay) | 91 initWithCallback(callback, delay) |
97 { | 92 { |
98 this.callback = callback; | 93 this.callback = callback; |
99 this.delay = delay; | 94 this.delay = delay; |
100 this.scheduleTimeout(); | 95 this.scheduleTimeout(); |
101 }, | 96 } |
| 97 |
102 scheduleTimeout() | 98 scheduleTimeout() |
103 { | 99 { |
104 window.setTimeout(() => | 100 window.setTimeout(() => |
105 { | 101 { |
106 try | 102 try |
107 { | 103 { |
108 this.callback(); | 104 this.callback(); |
109 } | 105 } |
110 catch (e) | 106 catch (e) |
111 { | 107 { |
112 Cu.reportError(e); | 108 Cu.reportError(e); |
113 } | 109 } |
114 this.scheduleTimeout(); | 110 this.scheduleTimeout(); |
115 }, this.delay); | 111 }, this.delay); |
116 } | 112 } |
117 }; | 113 } |
118 | 114 |
119 // | 115 // |
120 // Add a channel property to XMLHttpRequest, Synchronizer needs it | 116 // Add a channel property to XMLHttpRequest, Synchronizer needs it |
121 // | 117 // |
122 | 118 |
123 XMLHttpRequest.prototype.channel = { | 119 XMLHttpRequest.prototype.channel = { |
124 status: -1, | 120 status: -1, |
125 loadFlags: 0, | 121 loadFlags: 0, |
126 INHIBIT_CACHING: 0, | 122 INHIBIT_CACHING: 0, |
127 VALIDATE_ALWAYS: 0 | 123 VALIDATE_ALWAYS: 0 |
128 }; | 124 }; |
OLD | NEW |