Test ServiceWorkerContainer.register() with a data: URL
The proper response to a registration attempt with a data: URL is a TypeError,
yet we currently reject with a Security error. See spec.:
https://w3c.github.io/ServiceWorker/#start-register
Currently this test is expected to fail.
Differential Revision: https://phabricator.services.mozilla.com/D3406
bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1483505
gecko-commit: 0e8f94baa6075cb38b8782ab05c5306eb3490f5e
gecko-integration-branch: autoland
gecko-reviewers: asuth
diff --git a/service-workers/service-worker/resources/registration-tests-script-url.js b/service-workers/service-worker/resources/registration-tests-script-url.js
index 8d777a8..0dc5af1 100644
--- a/service-workers/service-worker/resources/registration-tests-script-url.js
+++ b/service-workers/service-worker/resources/registration-tests-script-url.js
@@ -37,6 +37,15 @@
}, 'Script URL including uppercase URL-encoded backslash');
promise_test(function(t) {
+ var script = 'data:application/javascript,';
+ var scope = 'resources/scope/data-url-in-script-url';
+ return promise_rejects(t,
+ check_error_types ? new TypeError : null,
+ register_method(script, {scope: scope}),
+ 'Data URLs should not be registered as service workers.');
+ }, 'Script URL is a data URL');
+
+ promise_test(function(t) {
var script = 'resources/././empty-worker.js';
var scope = 'resources/scope/parent-reference-in-script-url';
return register_method(script, {scope: scope})