Index: third_party/WebKit/LayoutTests/http/tests/security/secureContexts/unauthenticated_worker.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/secureContexts/unauthenticated_worker.html b/third_party/WebKit/LayoutTests/http/tests/security/secureContexts/unauthenticated_worker.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0e715cc7430f71efc3dfe3f997397cbf75ab63d0 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/http/tests/security/secureContexts/unauthenticated_worker.html |
@@ -0,0 +1,44 @@ |
+<!DOCTYPE html> |
+<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 { |
+ test(function () { |
+ assert_false(window.isSecureContext); |
+ }, "Sanity-check the test runner."); |
+ |
+ async_test(t => { |
+ var w = new Worker("./resources/post-securecontext.js"); |
+ w.onmessage = t.step_func_done(e => { |
+ assert_false(e.data.isSecureContext); |
+ }); |
+ }, "Non-secure workers are non-secure."); |
+ |
+ async_test(t => { |
+ var url = URL.createObjectURL(new Blob(['postMessage({ "isSecureContext": self.isSecureContext });'])); |
+ var w = new Worker(url); |
+ w.onmessage = t.step_func_done(e => { |
+ assert_false(e.data.isSecureContext); |
+ }); |
+ }, "Non-secure workers created from 'blob:' are non-secure."); |
+ |
+ async_test(t => { |
+ var w = new SharedWorker("./resources/post-securecontext-shared.js"); |
+ w.port.onmessage = t.step_func_done(e => { |
+ assert_false(e.data.isSecureContext); |
+ }); |
+ }, "Non-secure shared workers are non-secure."); |
+ |
+ async_test(t => { |
+ var url = URL.createObjectURL(new Blob(['self.onconnect = e => { e.ports[0].postMessage({ "isSecureContext": self.isSecureContext }); };'])); |
+ var w = new SharedWorker(url); |
+ w.port.onmessage = t.step_func_done(e => { |
+ assert_false(e.data.isSecureContext); |
+ }); |
+ }, "Non-secure shared workers created from 'blob:' are non-secure."); |
+ } |
+</script> |