diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /devtools/shared/worker/tests | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/shared/worker/tests')
3 files changed, 13 insertions, 19 deletions
diff --git a/devtools/shared/worker/tests/browser/browser_worker-01.js b/devtools/shared/worker/tests/browser/browser_worker-01.js index a8dafcf4cb..f8323e218e 100644 --- a/devtools/shared/worker/tests/browser/browser_worker-01.js +++ b/devtools/shared/worker/tests/browser/browser_worker-01.js @@ -3,8 +3,9 @@ "use strict"; -// Tests that the devtools/shared/worker communicates properly -// as both CommonJS module and as a JSM. +const { DevToolsWorker, workerify } = ChromeUtils.importESModule( + "resource://devtools/shared/worker/worker.sys.mjs" +); const BUFFER_SIZE = 8; @@ -15,22 +16,16 @@ registerCleanupFunction(function () { add_task(async function () { // Test both CJS and JSM versions - await testWorker("JSM", () => - ChromeUtils.import("resource://devtools/shared/worker/worker.js") - ); - await testWorker("CommonJS", () => - require("resource://devtools/shared/worker/worker.js") - ); + await testWorker(); await testTransfer(); }); -async function testWorker(context, workerFactory) { +async function testWorker() { // Needed for blob:null Services.prefs.setBoolPref( "security.allow_parent_unrestricted_js_loads", true ); - const { DevToolsWorker, workerify } = workerFactory(); const blob = new Blob( [ @@ -71,13 +66,13 @@ createTask(self, "groupByField", function({ is( Object.keys(results.groups).join(","), "France,Nigeria", - `worker should have returned the expected result in ${context}` + `worker should have returned the expected result` ); URL.revokeObjectURL(WORKER_URL); const fn = workerify(x => x * x); - is(await fn(5), 25, `workerify works in ${context}`); + is(await fn(5), 25, `workerify works`); fn.destroy(); worker.destroy(); @@ -88,9 +83,6 @@ async function testTransfer() { "security.allow_parent_unrestricted_js_loads", true ); - const { workerify } = ChromeUtils.import( - "resource://devtools/shared/worker/worker.js" - ); const workerFn = workerify(({ buf }) => buf.byteLength); const buf = new ArrayBuffer(BUFFER_SIZE); diff --git a/devtools/shared/worker/tests/browser/browser_worker-02.js b/devtools/shared/worker/tests/browser/browser_worker-02.js index 80c50cf887..c051946aee 100644 --- a/devtools/shared/worker/tests/browser/browser_worker-02.js +++ b/devtools/shared/worker/tests/browser/browser_worker-02.js @@ -5,9 +5,9 @@ // Tests errors are handled properly by the DevToolsWorker. -const { - DevToolsWorker, -} = require("resource://devtools/shared/worker/worker.js"); +const { DevToolsWorker } = ChromeUtils.importESModule( + "resource://devtools/shared/worker/worker.sys.mjs" +); const blob = new Blob( [ diff --git a/devtools/shared/worker/tests/browser/browser_worker-03.js b/devtools/shared/worker/tests/browser/browser_worker-03.js index 34e7688e73..9a7659979e 100644 --- a/devtools/shared/worker/tests/browser/browser_worker-03.js +++ b/devtools/shared/worker/tests/browser/browser_worker-03.js @@ -8,7 +8,9 @@ // // And tests `workerify` by doing so. -const { workerify } = require("resource://devtools/shared/worker/worker.js"); +const { workerify } = ChromeUtils.importESModule( + "resource://devtools/shared/worker/worker.sys.mjs" +); function square(x) { return x * x; } |