LEFT | RIGHT |
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-2017 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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
(...skipping 12 matching lines...) Expand all Loading... |
26 if (!(module in require.scopes)) | 26 if (!(module in require.scopes)) |
27 { | 27 { |
28 let scope = {exports: {}}; | 28 let scope = {exports: {}}; |
29 require.scopes[module] = require.modules[module](scope, scope.exports); | 29 require.scopes[module] = require.modules[module](scope, scope.exports); |
30 } | 30 } |
31 return require.scopes[module]; | 31 return require.scopes[module]; |
32 } | 32 } |
33 require.modules = Object.create(null); | 33 require.modules = Object.create(null); |
34 require.scopes = Object.create(null); | 34 require.scopes = Object.create(null); |
35 | 35 |
36 function importAll(module, globalObj) | |
37 { | |
38 let exports = require(module); | |
39 for (let key in exports) | |
40 globalObj[key] = exports[key]; | |
41 } | |
42 | |
43 let onShutdown = { | 36 let onShutdown = { |
44 done: false, | 37 done: false, |
45 add() {}, | 38 add() {}, |
46 remove() {} | 39 remove() {} |
47 }; | 40 }; |
48 | 41 |
49 // | 42 // |
50 // XPCOM emulation | 43 // XPCOM emulation |
51 // | 44 // |
52 | 45 |
| 46 function nsIFileURL() {} |
| 47 function nsIHttpChannel() {} |
| 48 |
53 let Components = { | 49 let Components = { |
54 interfaces: | 50 interfaces: |
55 { | 51 { |
56 nsIFile: {DIRECTORY_TYPE: 0}, | 52 nsIFile: {DIRECTORY_TYPE: 0}, |
57 nsIFileURL() {}, | 53 nsIFileURL, |
58 nsIHttpChannel() {}, | 54 nsIHttpChannel, |
59 nsITimer: {TYPE_REPEATING_SLACK: 0}, | 55 nsITimer: {TYPE_REPEATING_SLACK: 0}, |
60 nsIInterfaceRequestor: null, | 56 nsIInterfaceRequestor: null, |
61 nsIChannelEventSink: null | 57 nsIChannelEventSink: null |
62 }, | 58 }, |
63 classes: | 59 classes: |
64 { | 60 { |
65 "@mozilla.org/timer;1": | 61 "@mozilla.org/timer;1": |
66 { | 62 { |
67 createInstance() { return new FakeTimer(); } | 63 createInstance() { return new FakeTimer(); } |
68 }, | 64 }, |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 // FileUtils.jsm module emulation | 206 // FileUtils.jsm module emulation |
211 // | 207 // |
212 | 208 |
213 let FileUtils = { | 209 let FileUtils = { |
214 PERMS_DIRECTORY: 0 | 210 PERMS_DIRECTORY: 0 |
215 }; | 211 }; |
216 | 212 |
217 function FakeTimer() | 213 function FakeTimer() |
218 { | 214 { |
219 } | 215 } |
220 FakeTimer.prototype = { | 216 FakeTimer.prototype = |
| 217 { |
221 delay: 0, | 218 delay: 0, |
222 callback: null, | 219 callback: null, |
223 initWithCallback(callback, delay) | 220 initWithCallback(callback, delay) |
224 { | 221 { |
225 this.callback = callback; | 222 this.callback = callback; |
226 this.delay = delay; | 223 this.delay = delay; |
227 this.scheduleTimeout(); | 224 this.scheduleTimeout(); |
228 }, | 225 }, |
229 scheduleTimeout() | 226 scheduleTimeout() |
230 { | 227 { |
(...skipping 20 matching lines...) Expand all Loading... |
251 status: -1, | 248 status: -1, |
252 notificationCallbacks: {}, | 249 notificationCallbacks: {}, |
253 loadFlags: 0, | 250 loadFlags: 0, |
254 INHIBIT_CACHING: 0, | 251 INHIBIT_CACHING: 0, |
255 VALIDATE_ALWAYS: 0, | 252 VALIDATE_ALWAYS: 0, |
256 QueryInterface() | 253 QueryInterface() |
257 { | 254 { |
258 return this; | 255 return this; |
259 } | 256 } |
260 }; | 257 }; |
LEFT | RIGHT |