diff options
Diffstat (limited to 'dom/ipc/tests/JSWindowActor/browser_uri_combination.js')
-rw-r--r-- | dom/ipc/tests/JSWindowActor/browser_uri_combination.js | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/dom/ipc/tests/JSWindowActor/browser_uri_combination.js b/dom/ipc/tests/JSWindowActor/browser_uri_combination.js new file mode 100644 index 0000000000..ce46a3e3b6 --- /dev/null +++ b/dom/ipc/tests/JSWindowActor/browser_uri_combination.js @@ -0,0 +1,81 @@ +add_task(function specify_both() { + // Specifying both should throw. + + SimpleTest.doesThrow(() => { + ChromeUtils.registerWindowActor("TestWindow", { + parent: { + moduleURI: "resource://testing-common/TestWindowParent.jsm", + }, + child: { + moduleURI: "resource://testing-common/TestWindowChild.jsm", + esModuleURI: "resource://testing-common/TestWindowChild.sys.mjs", + }, + }); + }, "Should throw if both moduleURI and esModuleURI are specified."); + + SimpleTest.doesThrow(() => { + ChromeUtils.registerWindowActor("TestWindow", { + parent: { + esModuleURI: "resource://testing-common/TestWindowParent.sys.mjs", + }, + child: { + moduleURI: "resource://testing-common/TestWindowChild.jsm", + esModuleURI: "resource://testing-common/TestWindowChild.sys.mjs", + }, + }); + }, "Should throw if both moduleURI and esModuleURI are specified."); + + SimpleTest.doesThrow(() => { + ChromeUtils.registerWindowActor("TestWindow", { + parent: { + moduleURI: "resource://testing-common/TestWindowParent.jsm", + esModuleURI: "resource://testing-common/TestWindowParent.sys.mjs", + }, + child: { + moduleURI: "resource://testing-common/TestWindowChild.jsm", + }, + }); + }, "Should throw if both moduleURI and esModuleURI are specified."); + + SimpleTest.doesThrow(() => { + ChromeUtils.registerWindowActor("TestWindow", { + parent: { + moduleURI: "resource://testing-common/TestWindowParent.jsm", + esModuleURI: "resource://testing-common/TestWindowParent.sys.mjs", + }, + child: { + esModuleURI: "resource://testing-common/TestWindowChild.sys.mjs", + }, + }); + }, "Should throw if both moduleURI and esModuleURI are specified."); +}); + +add_task(function specify_mixed() { + // Mixing JSM and ESM should work. + + try { + ChromeUtils.registerWindowActor("TestWindow", { + parent: { + moduleURI: "resource://testing-common/TestWindowParent.jsm", + }, + child: { + esModuleURI: "resource://testing-common/TestWindowChild.sys.mjs", + }, + }); + } finally { + ChromeUtils.unregisterWindowActor("TestWindow"); + } + + try { + ChromeUtils.registerWindowActor("TestWindow", { + parent: { + esModuleURI: "resource://testing-common/TestWindowParent.sys.mjs", + }, + child: { + moduleURI: "resource://testing-common/TestWindowChild.jsm", + }, + }); + } finally { + ChromeUtils.unregisterWindowActor("TestWindow"); + } +}); |