diff --git a/testing/web-platform/mozilla/meta/MANIFEST.json b/testing/web-platform/mozilla/meta/MANIFEST.json index 4e676dbaa7e1..094946fb6e7d 100644 --- a/testing/web-platform/mozilla/meta/MANIFEST.json +++ b/testing/web-platform/mozilla/meta/MANIFEST.json @@ -436,10 +436,10 @@ "url": "/_mozilla/service-workers/service-worker/service-worker-csp-script.https.html" } ], - "service-workers/service-worker/serviceworkerobject-scripturl.sub.html": [ + "service-workers/service-worker/serviceworkerobject-scripturl.https.html": [ { - "path": "service-workers/service-worker/serviceworkerobject-scripturl.sub.html", - "url": "/_mozilla/service-workers/service-worker/serviceworkerobject-scripturl.sub.html" + "path": "service-workers/service-worker/serviceworkerobject-scripturl.https.html", + "url": "/_mozilla/service-workers/service-worker/serviceworkerobject-scripturl.https.html" } ], "service-workers/service-worker/shared-worker-controlled.https.html": [ @@ -552,4 +552,4 @@ "rev": null, "url_base": "/_mozilla/", "version": 2 -} \ No newline at end of file +} diff --git a/testing/web-platform/mozilla/meta/service-workers/service-worker/serviceworkerobject-scripturl.sub.html.ini b/testing/web-platform/mozilla/meta/service-workers/service-worker/serviceworkerobject-scripturl.sub.html.ini deleted file mode 100644 index d157bae54841..000000000000 --- a/testing/web-platform/mozilla/meta/service-workers/service-worker/serviceworkerobject-scripturl.sub.html.ini +++ /dev/null @@ -1,11 +0,0 @@ -[serviceworkerobject-scripturl.sub.html] - type: testharness - [Verify the scriptURL property: relative] - expected: FAIL - - [Verify the scriptURL property: with-fragment] - expected: FAIL - - [Verify the scriptURL property: absolute] - expected: FAIL - diff --git a/testing/web-platform/mozilla/tests/service-workers/service-worker/resources/test-helpers.sub.js b/testing/web-platform/mozilla/tests/service-workers/service-worker/resources/test-helpers.sub.js index 4afa9fd84f1b..f11b94ee023f 100644 --- a/testing/web-platform/mozilla/tests/service-workers/service-worker/resources/test-helpers.sub.js +++ b/testing/web-platform/mozilla/tests/service-workers/service-worker/resources/test-helpers.sub.js @@ -13,10 +13,13 @@ function service_worker_unregister_and_register(test, url, scope) { 'unregister and register should not fail')); } -function service_worker_unregister(test, documentUrl) { - return navigator.serviceWorker.getRegistration(documentUrl) +// This unregisters the registration that precisely matches scope. Use this +// when unregistering by scope. If no registration is found, it just resolves. +function service_worker_unregister(test, scope) { + var absoluteScope = (new URL(scope, window.location).href); + return navigator.serviceWorker.getRegistration(scope) .then(function(registration) { - if (registration) + if (registration && registration.scope === absoluteScope) return registration.unregister(); }) .catch(unreached_rejection(test, 'unregister should not fail')); diff --git a/testing/web-platform/mozilla/tests/service-workers/service-worker/serviceworkerobject-scripturl.sub.html b/testing/web-platform/mozilla/tests/service-workers/service-worker/serviceworkerobject-scripturl.https.html similarity index 84% rename from testing/web-platform/mozilla/tests/service-workers/service-worker/serviceworkerobject-scripturl.sub.html rename to testing/web-platform/mozilla/tests/service-workers/service-worker/serviceworkerobject-scripturl.https.html index b4a531061d01..c359fdfa0f1f 100644 --- a/testing/web-platform/mozilla/tests/service-workers/service-worker/serviceworkerobject-scripturl.sub.html +++ b/testing/web-platform/mozilla/tests/service-workers/service-worker/serviceworkerobject-scripturl.https.html @@ -8,7 +8,7 @@ function url_test(name, url) { var scope = 'resources/scope/' + name; async_test(function(t) { - var expectedURL = normalizeURL(url); + var expectedURL = (new URL(url, window.location)).toString(); service_worker_unregister_and_register(t, url, scope) .then(function(registration) { var worker = registration.installing; @@ -22,7 +22,6 @@ function url_test(name, url) { url_test('relative', 'resources/empty-worker.js'); url_test('with-fragment', 'resources/empty-worker.js#ref'); -url_test('absolute', - 'http://{{domains[www]}}:{{ports[http][0]}}/service-worker/resources/empty-worker.js'); +url_test('absolute', (new URL('./resources/empty-worker.js', window.location)).href);