Index: LayoutTests/http/tests/serviceworker/registration.html |
diff --git a/LayoutTests/http/tests/serviceworker/registration.html b/LayoutTests/http/tests/serviceworker/registration.html |
index 1430812d3a5a4bde0fd85d2b8eb02af1bfa1c773..6e13e0320259a5817552efc8fc78bf2265e8510f 100644 |
--- a/LayoutTests/http/tests/serviceworker/registration.html |
+++ b/LayoutTests/http/tests/serviceworker/registration.html |
@@ -19,6 +19,37 @@ promise_test(function(t) { |
promise_test(function(t) { |
var script = 'resources/registration-worker.js'; |
+ var scope = 'resources/'; |
+ return navigator.serviceWorker.register(script, {scope: scope}) |
+ .then(function(registration) { |
+ assert_true(registration instanceof ServiceWorkerRegistration, |
+ 'Successfully registered.'); |
+ service_worker_unregister_and_done(t, scope); |
+ }) |
+ }, 'Registering same scope as the script directory'); |
+ |
+promise_test(function(t) { |
+ var script = 'resources/registration-worker.js'; |
+ var scope = 'resources'; |
+ return assert_promise_rejects( |
+ navigator.serviceWorker.register(script, {scope: scope}), |
+ 'SecurityError', |
+ 'Registering same scope as the script directory without the last ' + |
+ 'slash should fail with SecurityError.'); |
+ }, 'Registering same scope as the script directory without the last slash'); |
+ |
+promise_test(function(t) { |
+ var script = 'resources/registration-worker.js'; |
+ var scope = 'different-directory/'; |
+ return assert_promise_rejects( |
+ navigator.serviceWorker.register(script, {scope: scope}), |
+ 'SecurityError', |
+ 'Registration scope outside the script directory should fail ' + |
+ 'with SecurityError.'); |
+ }, 'Registration scope outside the script directory'); |
+ |
+promise_test(function(t) { |
+ var script = 'resources/registration-worker.js'; |
var scope = 'http://example.com/'; |
return assert_promise_rejects( |
navigator.serviceWorker.register(script, {scope: scope}), |