Index: LayoutTests/http/tests/security/powerfulFeatureRestrictions/cachestorage-on-insecure-origin.html |
diff --git a/LayoutTests/http/tests/security/powerfulFeatureRestrictions/cachestorage-on-insecure-origin.html b/LayoutTests/http/tests/security/powerfulFeatureRestrictions/cachestorage-on-insecure-origin.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..953eb8b2da53cd67646e4e816700d318dc3ef1e8 |
--- /dev/null |
+++ b/LayoutTests/http/tests/security/powerfulFeatureRestrictions/cachestorage-on-insecure-origin.html |
@@ -0,0 +1,63 @@ |
+<!DOCTYPE html> |
+<title>Cache Storage On An Insecure Origin</title> |
+<script src="/resources/testharness.js"></script> |
+<script src="/resources/testharnessreport.js"></script> |
+<script src="/resources/get-host-info.js"></script> |
+<script> |
+if (window.location.origin != get_host_info().UNAUTHENTICATED_ORIGIN) { |
+ window.location = get_host_info().UNAUTHENTICATED_ORIGIN + window.location.pathname; |
+} else { |
+ if (window.testRunner) |
+ testRunner.overridePreference("WebKitStrictPowerfulFeatureRestrictions", true); |
+ |
+ promise_test(function(test) { |
+ return window.caches.match('http://example.com/resource.html') |
+ .then( |
+ test.unreached_func('promise should not be fulfilled'), |
+ function(reason) { |
+ assert_equals(reason.name, 'SecurityError', |
+ 'match should reject with SecurityError'); |
+ }); |
+ }, 'CacheStorage match() on insecure origin'); |
+ |
+ promise_test(function(test) { |
+ return window.caches.has('name') |
+ .then( |
+ test.unreached_func('promise should not be fulfilled'), |
+ function(reason) { |
+ assert_equals(reason.name, 'SecurityError', |
+ 'match should reject with SecurityError'); |
+ }); |
+ }, 'CacheStorage has() on insecure origin'); |
+ |
+ promise_test(function(test) { |
+ return window.caches.open('name') |
+ .then( |
+ test.unreached_func('promise should not be fulfilled'), |
+ function(reason) { |
+ assert_equals(reason.name, 'SecurityError', |
+ 'match should reject with SecurityError'); |
+ }); |
+ }, 'CacheStorage open() on insecure origin'); |
+ |
+ promise_test(function(test) { |
+ return window.caches.delete('name') |
+ .then( |
+ test.unreached_func('promise should not be fulfilled'), |
+ function(reason) { |
+ assert_equals(reason.name, 'SecurityError', |
+ 'match should reject with SecurityError'); |
+ }); |
+ }, 'CacheStorage delete() on insecure origin'); |
+ |
+ promise_test(function(test) { |
+ return window.caches.keys() |
+ .then( |
+ test.unreached_func('promise should not be fulfilled'), |
+ function(reason) { |
+ assert_equals(reason.name, 'SecurityError', |
+ 'match should reject with SecurityError'); |
+ }); |
+ }, 'CacheStorage keys() on insecure origin'); |
+} |
+</script> |