blob: 5f0cb068c3bf9d62cf1586d4dce3c2e5c99bc8de [file] [log] [blame]
<!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>
var host_info = get_host_info();
var saw_message = new Promise(resolve => {
window.addEventListener('message', e => resolve(;
// 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 +
return with_iframe(url);
.then(() => saw_message)
.then(data => assert_equals(data, 'PASS'));
}, 'Service worker does not control the subframe of an insecure frame');