commit 558b5eee3048328ed03a85b8cac60e43d5140186 parent 1d9941da4f73630b88029aeb34338cf9a2ee56e3 Author: Erich Gubler <erichdongubler@gmail.com> Date: Wed, 17 Dec 2025 19:38:04 +0000 Bug 1942430 - test(webgpu): work around broken service worker script URLs r=webgpu-reviewers,teoxoy Follow-up to come in <https://bugzilla.mozilla.org/show_bug.cgi?id=???????>. Differential Revision: https://phabricator.services.mozilla.com/D275671 Diffstat:
4 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/dom/webgpu/tests/cts/checkout/src/common/runtime/helper/test_worker.ts b/dom/webgpu/tests/cts/checkout/src/common/runtime/helper/test_worker.ts @@ -200,7 +200,9 @@ export class TestServiceWorker extends TestBaseWorker { const selfPathDir = selfPath.substring(0, selfPath.lastIndexOf('/')); // Construct the path to the worker file, then use URL to resolve the `../` components. const serviceWorkerURL = new URL( - `${selfPathDir}/../../../${suite}/webworker/${fileName}.as_worker.js` + // NOTE: This is a Mozilla-specific hack! Please follow-up at + // <https://bugzilla.mozilla.org/asdf> for removal. + `${location.origin}/_mozilla/webgpu/${suite}/webworker/${fileName}.as_worker.js` ).toString(); // Ensure the correct service worker is registered. diff --git a/dom/webgpu/tests/cts/moz.yaml b/dom/webgpu/tests/cts/moz.yaml @@ -57,6 +57,16 @@ vendoring: - -i - ../patches/0001-base-resource-path.patch + # Patch the `serviceWorkerURL` used by the CTS so that the tests we generate are able to load + # resources correctly. + - action: run-command + cwd: '{yaml_dir}/checkout/' + command: patch + args: + - -p1 + - -i + - ../patches/0002-service-worker-url.patch + - action: run-command cwd: '{yaml_dir}/vendor/' command: cargo diff --git a/dom/webgpu/tests/cts/patches/0002-service-worker-url.patch b/dom/webgpu/tests/cts/patches/0002-service-worker-url.patch @@ -0,0 +1,15 @@ +diff --git a/src/common/runtime/helper/test_worker.ts b/src/common/runtime/helper/test_worker.ts +index 7b7922a88f..9e10b666da 100644 +--- a/src/common/runtime/helper/test_worker.ts ++++ b/src/common/runtime/helper/test_worker.ts +@@ -200,7 +200,9 @@ + const selfPathDir = selfPath.substring(0, selfPath.lastIndexOf('/')); + // Construct the path to the worker file, then use URL to resolve the `../` components. + const serviceWorkerURL = new URL( +- `${selfPathDir}/../../../${suite}/webworker/${fileName}.as_worker.js` ++ // NOTE: This is a Mozilla-specific hack! Please follow-up at ++ // <https://bugzilla.mozilla.org/asdf> for removal. ++ `${location.origin}/_mozilla/webgpu/${suite}/webworker/${fileName}.as_worker.js` + ).toString(); + + // Ensure the correct service worker is registered. diff --git a/testing/web-platform/mozilla/tests/webgpu/common/runtime/helper/test_worker.js b/testing/web-platform/mozilla/tests/webgpu/common/runtime/helper/test_worker.js @@ -200,7 +200,9 @@ export class TestServiceWorker extends TestBaseWorker { const selfPathDir = selfPath.substring(0, selfPath.lastIndexOf('/')); // Construct the path to the worker file, then use URL to resolve the `../` components. const serviceWorkerURL = new URL( - `${selfPathDir}/../../../${suite}/webworker/${fileName}.as_worker.js` + // NOTE: This is a Mozilla-specific hack! Please follow-up at + // <https://bugzilla.mozilla.org/asdf> for removal. + `${location.origin}/_mozilla/webgpu/${suite}/webworker/${fileName}.as_worker.js` ).toString(); // Ensure the correct service worker is registered.