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