Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/insecure-parent-frame.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/insecure-parent-frame.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/insecure-parent-frame.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5f0cb068c3bf9d62cf1586d4dce3c2e5c99bc8de |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/insecure-parent-frame.html |
@@ -0,0 +1,35 @@ |
+<!DOCTYPE html> |
+<meta charset="utf-8"> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+<script src="../resources/get-host-info.js?pipe=sub"></script> |
+<script src="resources/test-helpers.js"></script> |
+<title>Page Title</title> |
+<body></body> |
+<script> |
+var host_info = get_host_info(); |
+ |
+var saw_message = new Promise(resolve => { |
+ window.addEventListener('message', e => resolve(e.data)); |
+ }); |
+ |
+// This test registers a service worker, then creates an in-scope |
+// https iframe inside an insecure http iframe. The in-scope iframe |
+// communicates whether it has a controller to the top-level frame. |
+promise_test(t => { |
+ var script = 'resources/empty-worker.js'; |
+ var scope = 'resources/insecure-inscope'; |
+ return service_worker_unregister_and_register(t, script, scope) |
+ .then(reg => { |
+ add_completion_callback(() => reg.unregister()); |
+ return wait_for_state(t, reg.installing, 'activated'); |
+ }) |
+ .then(() => { |
+ var url = host_info.UNAUTHENTICATED_ORIGIN + |
+ '/serviceworker/resources/insecure-parent.html'; |
+ return with_iframe(url); |
+ }) |
+ .then(() => saw_message) |
+ .then(data => assert_equals(data, 'PASS')); |
+ }, 'Service worker does not control the subframe of an insecure frame'); |
+</script> |