Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / serviceworker / chromium / frame-detached-by-navigation.html
blob8d9cf1355f60b4c72a57cf7c3937b88b3f773cf3
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>navigator.serviceWorker should return null when frame is detached</title>
5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script>
7 </head>
8 <body>
9 <iframe id="subframe" src="about:blank"></iframe>
10 <script>
11 promise_test(function(t) {
12 var iframe = document.querySelector("#subframe");
13 var f = iframe.contentWindow.Function;
14 function get_navigator() {
15 return f("return navigator")();
17 return new Promise(function(resolve) {
18 assert_equals(iframe.contentWindow.navigator, get_navigator());
19 iframe.src = "resources/a.html";
20 iframe.onload = resolve;
21 }).then(function() {
22 assert_equals(get_navigator().serviceWorker, null);
23 });
24 });
25 </script>
27 </body>
28 </html>