Index: LayoutTests/fast/serviceworker/access-container-on-local-file.html |
diff --git a/LayoutTests/fast/serviceworker/access-container-on-local-file.html b/LayoutTests/fast/serviceworker/access-container-on-local-file.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5e14587019a03015b7f74e90ad7e505fcc487cc9 |
--- /dev/null |
+++ b/LayoutTests/fast/serviceworker/access-container-on-local-file.html |
@@ -0,0 +1,39 @@ |
+<!DOCTYPE html> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script> |
+ |
+async_test(function(t) { |
+ var script = 'no-such-worker'; |
falken
2014/11/12 09:04:41
Doesn't this need to be a "file:///" URL? But then
falken
2014/11/12 09:07:03
Please disregard.
|
+ navigator.serviceWorker.register(script, { scope: script }) |
+ .then(function() { |
+ assert_unreached('A returned promise should be rejected'); |
falken
2014/11/12 09:04:41
More grammatical is "The returned promise should b
nhiroki
2014/11/12 09:42:09
Done.
|
+ }, function(e) { |
falken
2014/11/12 09:04:41
Maybe we should assert on the error message conten
falken
2014/11/12 09:07:03
I still think this may be a good idea, WDYT?
nhiroki
2014/11/12 09:42:09
+1! Added the check.
falken
2014/11/13 08:27:55
Ah, sorry. I just realized this was bad advice sin
|
+ assert_throws( |
+ 'SecurityError', function() { throw e; }, |
+ 'Calling register() on local file should fail'); |
+ t.done(); |
+ }) |
+ .catch(t.step_func(function(e) { |
+ assert_unreached(e); |
+ t.done(); |
+ })); |
+}, 'Calling register() on local file'); |
+ |
+async_test(function(t) { |
+ navigator.serviceWorker.getRegistration() |
+ .then(function() { |
+ assert_unreached('A returned promise should be rejected') |
+ }, function(e) { |
+ assert_throws( |
+ 'SecurityError', function() { throw e; }, |
+ 'Calling getRegistration() on local file should fail'); |
+ t.done(); |
+ }) |
+ .catch(t.step_func(function(e) { |
+ assert_unreached(e); |
+ t.done(); |
+ })); |
+}, 'Calling getRegistration() on local file'); |
+ |
+</script> |