commit 14962d82fd6c226cb038781bfafb5bf19b51a92f parent 19e9ef1bce3ed49c583c7ec0ea647d7aef794aaa Author: Harveer Singh <hsingh@mozilla.com> Date: Fri, 14 Nov 2025 15:53:27 +0000 Bug 1360870: Test changes.r=edenchuang,dom-worker-reviewers Differential Revision: https://phabricator.services.mozilla.com/D264457 Diffstat:
18 files changed, 49 insertions(+), 78 deletions(-)
diff --git a/dom/serviceworkers/test/gtest/TestReadWrite.cpp b/dom/serviceworkers/test/gtest/TestReadWrite.cpp @@ -233,12 +233,6 @@ TEST(ServiceWorkerRegistrar, TestReadData) buffer.AppendInt(static_cast<uint32_t>(SERVICEWORKERREGISTRAR_VERSION)); buffer.Append("\n"); - buffer.AppendInt(0); - buffer.AppendLiteral("\n"); - buffer.AppendInt(0); - buffer.AppendLiteral("\n"); - buffer.AppendInt(0); - buffer.AppendLiteral("\n"); buffer.AppendLiteral("^inBrowser=1\n"); buffer.AppendLiteral("https://scope_0.org\ncurrentWorkerURL 0\n"); buffer.Append(SERVICEWORKERREGISTRAR_TRUE "\n"); @@ -257,14 +251,16 @@ TEST(ServiceWorkerRegistrar, TestReadData) buffer.AppendLiteral("true\n"); buffer.AppendInt(0); buffer.AppendLiteral("\n"); - buffer.Append(SERVICEWORKERREGISTRAR_TERMINATOR "\n"); - buffer.AppendInt(0); buffer.AppendLiteral("\n"); buffer.AppendInt(0); buffer.AppendLiteral("\n"); buffer.AppendInt(0); buffer.AppendLiteral("\n"); + buffer.AppendInt(0); + buffer.AppendLiteral("\n"); + buffer.Append(SERVICEWORKERREGISTRAR_TERMINATOR "\n"); + buffer.AppendLiteral("\n"); buffer.AppendLiteral("https://scope_1.org\ncurrentWorkerURL 1\n"); buffer.Append(SERVICEWORKERREGISTRAR_FALSE "\n"); @@ -283,6 +279,14 @@ TEST(ServiceWorkerRegistrar, TestReadData) buffer.AppendLiteral("false\n"); buffer.AppendInt(0); buffer.AppendLiteral("\n"); + buffer.AppendInt(0); + buffer.AppendLiteral("\n"); + buffer.AppendInt(0); + buffer.AppendLiteral("\n"); + buffer.AppendInt(0); + buffer.AppendLiteral("\n"); + buffer.AppendInt(0); + buffer.AppendLiteral("\n"); buffer.Append(SERVICEWORKERREGISTRAR_TERMINATOR "\n"); ASSERT_TRUE(CreateFile(buffer)) @@ -1022,6 +1026,7 @@ TEST(ServiceWorkerRegistrar, TestDedupeWrite) ServiceWorkerRegistrationData reg; reg.scope() = "https://scope_write.dedupe"_ns; + reg.type() = WorkerType::Classic; reg.currentWorkerURL() = nsPrintfCString("currentWorkerURL write %d", i); reg.currentWorkerHandlesFetch() = true; reg.cacheName() = @@ -1086,12 +1091,6 @@ TEST(ServiceWorkerRegistrar, TestLoadHandler) buffer.AppendInt(static_cast<uint32_t>(SERVICEWORKERREGISTRAR_VERSION)); buffer.Append("\n"); - buffer.AppendInt(0); - buffer.AppendLiteral("\n"); - buffer.AppendInt(0); - buffer.AppendLiteral("\n"); - buffer.AppendInt(0); - buffer.AppendLiteral("\n"); buffer.AppendLiteral("^inBrowser=1\n"); buffer.AppendLiteral("https://scope_0.org\ncurrentWorkerURL 0\n"); buffer.Append(SERVICEWORKERREGISTRAR_TRUE "\n"); @@ -1114,6 +1113,14 @@ TEST(ServiceWorkerRegistrar, TestLoadHandler) buffer.AppendLiteral("hello world!\n"); buffer.AppendLiteral("handler_test2\n"); buffer.AppendLiteral("hello\n"); + buffer.AppendInt(0); + buffer.AppendLiteral("\n"); + buffer.AppendInt(0); + buffer.AppendLiteral("\n"); + buffer.AppendInt(0); + buffer.AppendLiteral("\n"); + buffer.AppendInt(0); + buffer.AppendLiteral("\n"); buffer.Append(SERVICEWORKERREGISTRAR_TERMINATOR "\n"); ASSERT_TRUE(CreateFile(buffer)) diff --git a/testing/web-platform/meta/html/cross-origin-embedder-policy/reflection-credentialless.tentative.https.any.js.ini b/testing/web-platform/meta/html/cross-origin-embedder-policy/reflection-credentialless.tentative.https.any.js.ini @@ -24,4 +24,5 @@ [reflection-credentialless.tentative.https.any.serviceworker-module.html] - expected: ERROR + [reflection-credentialless] + expected: FAIL diff --git a/testing/web-platform/meta/html/cross-origin-embedder-policy/reflection-require-corp.tentative.https.any.js.ini b/testing/web-platform/meta/html/cross-origin-embedder-policy/reflection-require-corp.tentative.https.any.js.ini @@ -31,4 +31,5 @@ [reflection-require-corp.tentative.https.any.serviceworker-module.html] - expected: ERROR + [reflection-require-corp] + expected: FAIL diff --git a/testing/web-platform/meta/html/cross-origin-embedder-policy/reflection-unsafe-none.tentative.https.any.js.ini b/testing/web-platform/meta/html/cross-origin-embedder-policy/reflection-unsafe-none.tentative.https.any.js.ini @@ -26,4 +26,5 @@ [reflection-unsafe-none.tentative.https.any.serviceworker-module.html] - expected: ERROR + [reflection-unsafe-none] + expected: FAIL diff --git a/testing/web-platform/meta/html/semantics/scripting-1/the-script-element/json-module/json-module-service-worker-test.https.html.ini b/testing/web-platform/meta/html/semantics/scripting-1/the-script-element/json-module/json-module-service-worker-test.https.html.ini @@ -1,3 +1,4 @@ [json-module-service-worker-test.https.html] - [Javascript importing JSON Module should load within the context of a service worker] - expected: FAIL + # JSON module as a top-level is not throwing error, could be because of async script evaluation + [Trying to register a service worker with a top-level JSON Module should fail] + expected: FAIL +\ No newline at end of file diff --git a/testing/web-platform/meta/html/semantics/scripting-1/the-script-element/module/import-meta/import-meta-object.any.js.ini b/testing/web-platform/meta/html/semantics/scripting-1/the-script-element/module/import-meta/import-meta-object.any.js.ini @@ -1,2 +0,0 @@ -[import-meta-object.any.serviceworker-module.html] - expected: ERROR diff --git a/testing/web-platform/meta/html/semantics/scripting-1/the-script-element/module/import-meta/import-meta-resolve.any.js.ini b/testing/web-platform/meta/html/semantics/scripting-1/the-script-element/module/import-meta/import-meta-resolve.any.js.ini @@ -4,8 +4,3 @@ if not fission and (os == "linux"): CRASH [import-meta-resolve.any.sharedworker-module.html] - -[import-meta-resolve.any.serviceworker-module.html] - expected: - if tsan: TIMEOUT - ERROR diff --git a/testing/web-platform/meta/html/semantics/scripting-1/the-script-element/module/import-meta/import-meta-url.any.js.ini b/testing/web-platform/meta/html/semantics/scripting-1/the-script-element/module/import-meta/import-meta-url.any.js.ini @@ -11,4 +11,6 @@ if (os == "android") and not debug: [OK, CRASH] [import-meta-url.any.serviceworker-module.html] - expected: ERROR + expected: + if (os == "mac") and not debug: [OK, CRASH] + if (os == "android") and not debug: [OK, CRASH] diff --git a/testing/web-platform/meta/infrastructure/server/context.any.js.ini b/testing/web-platform/meta/infrastructure/server/context.any.js.ini @@ -1,7 +1,8 @@ [context.any.sharedworker-module.html] [context.any.serviceworker-module.html] - expected: ERROR + expected: + if (os == "android") and not debug: [OK, ERROR] [context.any.worker.html] expected: diff --git a/testing/web-platform/meta/service-workers/service-worker/no-dynamic-import-in-module.any.js.ini b/testing/web-platform/meta/service-workers/service-worker/no-dynamic-import-in-module.any.js.ini @@ -1,4 +0,0 @@ -[no-dynamic-import-in-module.any.serviceworker-module.html] - expected: - if (os == "android") and fission: [ERROR, TIMEOUT] - ERROR diff --git a/testing/web-platform/meta/service-workers/service-worker/registration-scope-module-static-import.https.html.ini b/testing/web-platform/meta/service-workers/service-worker/registration-scope-module-static-import.https.html.ini @@ -1,9 +0,0 @@ -[registration-scope-module-static-import.https.html] - [static imports redirecting to outside path restriction should be allowed] - expected: FAIL - - [static imports to outside path restriction should be allowed] - expected: FAIL - - [imported-module-script.js works when used as top-level] - expected: FAIL diff --git a/testing/web-platform/meta/service-workers/service-worker/registration-script-module.https.html.ini b/testing/web-platform/meta/service-workers/service-worker/registration-script-module.https.html.ini @@ -3,4 +3,4 @@ if (os == "mac") and not debug: [OK, TIMEOUT] [Registering script including caught exception] expected: - if (os == "mac") and not debug: [PASS, TIMEOUT] + if (os == "mac") and not debug: [PASS, TIMEOUT] +\ No newline at end of file diff --git a/testing/web-platform/meta/service-workers/service-worker/registration-script.https.html.ini b/testing/web-platform/meta/service-workers/service-worker/registration-script.https.html.ini @@ -17,7 +17,7 @@ expected: if (os == "android") and not debug: [PASS, TIMEOUT] - [Registering script including undefined error] + [Registering script including undefined error: classic] expected: if (os == "android") and not debug: [PASS, NOTRUN] @@ -25,6 +25,6 @@ expected: if (os == "android") and not debug: [PASS, NOTRUN] - [Registering script including uncaught exception] + [Registering script including uncaught exception: classic] expected: if (os == "android") and not debug: [PASS, NOTRUN] diff --git a/testing/web-platform/meta/service-workers/service-worker/update-bytecheck-cors-import.https.html.ini b/testing/web-platform/meta/service-workers/service-worker/update-bytecheck-cors-import.https.html.ini @@ -1,14 +1,3 @@ [update-bytecheck-cors-import.https.html] expected: if (os == "android") and debug: [OK, ERROR] - [Test module script(main: default, imported: default)] - expected: FAIL - - [Test module script(main: default, imported: time)] - expected: FAIL - - [Test module script(main: time, imported: default)] - expected: FAIL - - [Test module script(main: time, imported: time)] - expected: FAIL diff --git a/testing/web-platform/meta/service-workers/service-worker/update-bytecheck.https.html.ini b/testing/web-platform/meta/service-workers/service-worker/update-bytecheck.https.html.ini @@ -2,17 +2,10 @@ max-asserts: 2 expected: if (os == "android") and debug: [OK, ERROR] - [Test module script(main: default, imported: default)] - expected: FAIL - - [Test module script(main: default, imported: time)] - expected: FAIL [Test module script(main: time, imported: default)] - expected: FAIL - - [Test module script(main: time, imported: time)] - expected: FAIL + expected: + if (processor == "x86") and not debug: [PASS, FAIL] [Test(main: time, imported: default)] expected: diff --git a/testing/web-platform/meta/service-workers/service-worker/update-registration-with-type.https.html.ini b/testing/web-platform/meta/service-workers/service-worker/update-registration-with-type.https.html.ini @@ -1,10 +1,4 @@ [update-registration-with-type.https.html] - [Update the registration with a different script type (module => classic).] - expected: FAIL - - [Update the registration with a different script type (classic => module).] - expected: FAIL - [Update the registration with a different script type (classic => module) and with a same main script. Expect evaluation failed.] expected: FAIL diff --git a/testing/web-platform/tests/infrastructure/metadata/infrastructure/server/context.any.js.ini b/testing/web-platform/tests/infrastructure/metadata/infrastructure/server/context.any.js.ini @@ -4,10 +4,9 @@ if product == "epiphany" or product == "webkit": FAIL # https://bugs.webkit.org/show_bug.cgi?id=200815 [context.any.serviceworker-module.html] - expected: - if product == "firefox_android": [OK, ERROR] - # See e.g. https://community-tc.services.mozilla.com/tasks/IouM2LcdQy6b6ImEvgZ0kg - if product == "firefox": [ERROR, OK] + [context] + expected: + if product == "epiphany" or product == "webkit": FAIL # https://bugs.webkit.org/show_bug.cgi?id=200815 [context.any.worker-module.html] diff --git a/testing/web-platform/tests/service-workers/service-worker/resources/registration-tests-script.js b/testing/web-platform/tests/service-workers/service-worker/resources/registration-tests-script.js @@ -30,21 +30,21 @@ function registration_tests_script(register_method, type) { promise_test(function(t) { var script = 'resources/malformed-worker.py?undefined-error'; - var scope = 'resources/scope/undefined-error'; + var scope = `resources/scope/undefined-error/${type}`; return promise_rejects_js(t, TypeError, register_method(script, {scope: scope}), 'Registration of script including undefined error should fail.'); - }, 'Registering script including undefined error'); + }, `Registering script including undefined error: ${type}`); promise_test(function(t) { var script = 'resources/malformed-worker.py?uncaught-exception'; - var scope = 'resources/scope/uncaught-exception'; + var scope = `resources/scope/uncaught-exception/${type}`; return promise_rejects_js(t, TypeError, register_method(script, {scope: scope}), 'Registration of script including uncaught exception should fail.'); - }, 'Registering script including uncaught exception'); + }, `Registering script including uncaught exception: ${type}`); if (type === 'classic') { promise_test(function(t) {