<!DOCTYPE html>
<div id="container"></div>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
var test = async_test("This test checks if accessing navigator.serviceWorker doesn't crash with invalid frame");
if (window.testRunner)
testRunner.setPopupBlockingEnabled(false);
function callback() {
// At this time window.navigator may be replaced with a new iframe's one,
// which could be now invalid.
var sw = navigator.serviceWorker;
test.done();
}
test.step(function() {
var w = window.open("x", "y");
window.navigator = w.navigator;
setTimeout(callback, 1);
});
</script>