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-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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 }, | 63 }, |
64 console: { | 64 console: { |
65 log() {}, | 65 log() {}, |
66 error() {} | 66 error() {} |
67 }, | 67 }, |
68 navigator: { | 68 navigator: { |
69 }, | 69 }, |
70 onShutdown: { | 70 onShutdown: { |
71 add() {} | 71 add() {} |
72 }, | 72 }, |
73 URL | 73 // URL is global in Node 10. In Node 7+ it must be imported. |
| 74 URL: typeof URL == "undefined" ? require("url").URL : URL |
74 }; | 75 }; |
75 | 76 |
76 let knownModules = new Map(); | 77 let knownModules = new Map(); |
77 for (let dir of [path.join(__dirname, "stub-modules"), | 78 for (let dir of [path.join(__dirname, "stub-modules"), |
78 path.join(__dirname, "..", "lib")]) | 79 path.join(__dirname, "..", "lib")]) |
79 { | 80 { |
80 for (let file of fs.readdirSync(path.resolve(dir))) | 81 for (let file of fs.readdirSync(path.resolve(dir))) |
81 { | 82 { |
82 if (path.extname(file) == ".js") | 83 if (path.extname(file) == ".js") |
83 knownModules[path.basename(file, ".js")] = path.resolve(dir, file); | 84 knownModules[path.basename(file, ".js")] = path.resolve(dir, file); |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 } | 405 } |
405 }) | 406 }) |
406 }; | 407 }; |
407 }; | 408 }; |
408 | 409 |
409 exports.unexpectedError = function(error) | 410 exports.unexpectedError = function(error) |
410 { | 411 { |
411 console.error(error); | 412 console.error(error); |
412 this.ok(false, "Unexpected error: " + error); | 413 this.ok(false, "Unexpected error: " + error); |
413 }; | 414 }; |
LEFT | RIGHT |