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 |
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 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 "use strict"; | 18 "use strict"; |
19 | 19 |
20 let { | 20 let { |
21 createSandbox, setupTimerAndXMLHttp, setupRandomResult, unexpectedError | 21 createSandbox, setupTimerAndXMLHttp, setupRandomResult, unexpectedError |
22 } = require("./_common"); | 22 } = require("./_common"); |
23 | 23 |
24 let Prefs = null; | 24 let Prefs = null; |
25 let Utils = null; | 25 let Utils = null; |
26 let Notification = null; | 26 let Notification = null; |
27 | 27 |
| 28 // Only starting NodeJS 10 that URL is in the global space. |
| 29 const {URL} = require("url"); |
| 30 |
28 exports.setUp = function(callback) | 31 exports.setUp = function(callback) |
29 { | 32 { |
30 // Inject our Array and JSON to make sure that instanceof checks on arrays | 33 // Inject our Array and JSON to make sure that instanceof checks on arrays |
31 // within the sandbox succeed even with data passed in from outside. | 34 // within the sandbox succeed even with data passed in from outside. |
32 let globals = Object.assign({Array, JSON}, | 35 let globals = Object.assign({Array, JSON}, |
33 setupTimerAndXMLHttp.call(this), setupRandomResult.call(this)); | 36 setupTimerAndXMLHttp.call(this), setupRandomResult.call(this)); |
34 | 37 |
35 let sandboxedRequire = createSandbox({globals}); | 38 let sandboxedRequire = createSandbox({globals}); |
36 ( | 39 ( |
37 {Prefs} = sandboxedRequire("./stub-modules/prefs"), | 40 {Prefs} = sandboxedRequire("./stub-modules/prefs"), |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 }; | 565 }; |
563 | 566 |
564 exports.testMissingTranslation = function(test) | 567 exports.testMissingTranslation = function(test) |
565 { | 568 { |
566 let notification = {message: {"en-US": "en-US"}}; | 569 let notification = {message: {"en-US": "en-US"}}; |
567 Utils.appLocale = "fr"; | 570 Utils.appLocale = "fr"; |
568 let texts = Notification.getLocalizedTexts(notification); | 571 let texts = Notification.getLocalizedTexts(notification); |
569 test.equal(texts.message, "en-US"); | 572 test.equal(texts.message, "en-US"); |
570 test.done(); | 573 test.done(); |
571 }; | 574 }; |
OLD | NEW |