diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /js/xpconnect/tests/unit/es6module_devtoolsLoader.sys.mjs | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/xpconnect/tests/unit/es6module_devtoolsLoader.sys.mjs')
-rw-r--r-- | js/xpconnect/tests/unit/es6module_devtoolsLoader.sys.mjs | 91 |
1 files changed, 78 insertions, 13 deletions
diff --git a/js/xpconnect/tests/unit/es6module_devtoolsLoader.sys.mjs b/js/xpconnect/tests/unit/es6module_devtoolsLoader.sys.mjs index c7de54c82f..c8262f5f5c 100644 --- a/js/xpconnect/tests/unit/es6module_devtoolsLoader.sys.mjs +++ b/js/xpconnect/tests/unit/es6module_devtoolsLoader.sys.mjs @@ -7,23 +7,88 @@ export function increment() { import { object } from "resource://test/es6module_devtoolsLoader.js"; export const importedObject = object; -const importTrue = ChromeUtils.importESModule("resource://test/es6module_devtoolsLoader.js", { loadInDevToolsLoader : true }); -export const importESModuleTrue = importTrue.object; +const importDevTools = ChromeUtils.importESModule("resource://test/es6module_devtoolsLoader.js", { global: "devtools" }); +export const importESModuleDevTools = importDevTools.object; -const importFalse = ChromeUtils.importESModule("resource://test/es6module_devtoolsLoader.js", { loadInDevToolsLoader : false }); -export const importESModuleFalse = importFalse.object; +const importShared = ChromeUtils.importESModule("resource://test/es6module_devtoolsLoader.js", { global: "shared" }); +export const importESModuleShared = importShared.object; -const importNull = ChromeUtils.importESModule("resource://test/es6module_devtoolsLoader.js", {}); -export const importESModuleNull = importNull.object; +const importCurrent = ChromeUtils.importESModule("resource://test/es6module_devtoolsLoader.js", { global: "current" }); +export const importESModuleCurrent = importCurrent.object; -const importNull2 = ChromeUtils.importESModule("resource://test/es6module_devtoolsLoader.js"); -export const importESModuleNull2 = importNull2.object; +const importContextual = ChromeUtils.importESModule("resource://test/es6module_devtoolsLoader.js", { global: "contextual" }); +export const importESModuleContextual = importContextual.object; -const lazy = {}; -ChromeUtils.defineESModuleGetters(lazy, { +let caught = false; +try { + ChromeUtils.importESModule("resource://test/es6module_devtoolsLoader.js"); +} catch (e) { + caught = true; +} +export const importESModuleNoOptionFailed1 = caught; + +caught = false; +try { + ChromeUtils.importESModule("resource://test/es6module_devtoolsLoader.js", {}); +} catch (e) { + caught = true; +} +export const importESModuleNoOptionFailed2 = caught; + +const lazyDevTools = {}; +ChromeUtils.defineESModuleGetters(lazyDevTools, { + object: "resource://test/es6module_devtoolsLoader.js", +}, { global: "devtools" }); + +export function importLazyDevTools() { + return lazyDevTools.object; +} + +const lazyShared = {}; +ChromeUtils.defineESModuleGetters(lazyShared, { + object: "resource://test/es6module_devtoolsLoader.js", +}, { global: "shared" }); + +export function importLazyShared() { + return lazyShared.object; +} + +const lazyCurrent = {}; +ChromeUtils.defineESModuleGetters(lazyCurrent, { + object: "resource://test/es6module_devtoolsLoader.js", +}, { global: "current" }); + +export function importLazyCurrent() { + return lazyCurrent.object; +} + +const lazyContextual = {}; +ChromeUtils.defineESModuleGetters(lazyContextual, { object: "resource://test/es6module_devtoolsLoader.js", -}); +}, { global: "contextual" }); + +export function importLazyContextual() { + return lazyContextual.object; +} + +caught = false; +try { + let lazy = {}; + ChromeUtils.defineESModuleGetters({}, { + object: "resource://test/es6module_devtoolsLoader.js", + }); +} catch (e) { + caught = true; +} +export const importLazyNoOptionFailed1 = caught; -export function importLazy() { - return lazy.object; +caught = false; +try { + let lazy = {}; + ChromeUtils.defineESModuleGetters({}, { + object: "resource://test/es6module_devtoolsLoader.js", + }, {}); +} catch (e) { + caught = true; } +export const importLazyNoOptionFailed2 = caught; |