Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <body> | 3 <body> |
| 4 <script src="../resources/testharness.js"></script> | 4 <script src="../resources/testharness.js"></script> |
| 5 <script src="../resources/testharnessreport.js"></script> | 5 <script src="../resources/testharnessreport.js"></script> |
| 6 <iframe></iframe> | |
| 6 <script> | 7 <script> |
| 7 | 8 |
| 8 if (location.href.endsWith('#after-reload')) { | 9 var iframe = document.querySelector('iframe'); |
| 9 test(function() { | |
| 10 assert_equals(navigator.presentation.defaultRequest, null); | |
| 11 }, "Test that navigator.defaultRequest isn't kept alive after reload.") | |
| 12 } else { | |
| 13 navigator.presentation.defaultRequest = new PresentationRequest("https://examp le.org"); | |
| 14 | 10 |
| 15 location.href += '#after-reload'; | 11 async_test(t => { |
| 16 location.reload(); | 12 t.step(function() { |
|
foolip
2017/01/18 11:13:52
The argument to async_test is called as a step, so
zhaobin
2017/01/18 19:22:42
Done.
| |
| 17 } | 13 iframe.onload = () => { |
|
foolip
2017/01/18 11:13:52
This needs to be iframe.onload = t.step_func(() =>
zhaobin
2017/01/18 19:22:42
Done.
| |
| 14 var defaultRequest = iframe.contentWindow.navigator.presentation.defaultRe quest; | |
|
foolip
2017/01/18 11:13:52
Extracting this out won't work, then you're operat
zhaobin
2017/01/18 19:22:42
Done.
| |
| 15 if (iframe.src.endsWith('#after-reload')) { | |
| 16 assert_equals(defaultRequest, null); | |
|
foolip
2017/01/18 11:13:52
If this test passed like this, how did defaultRequ
zhaobin
2017/01/18 19:22:42
We load iframe twice:
1: iframe loads 'resources/
foolip
2017/01/18 19:42:45
Oh, now I see my misunderstanding. defaultRequest
| |
| 17 t.done(); | |
| 18 } else { | |
| 19 defaultRequest = new PresentationRequest("https://example.org"); | |
| 20 assert_not_equals(defaultRequest, null); | |
| 21 | |
| 22 iframe.src += '#after-reload'; | |
| 23 iframe.contentWindow.location.reload(true); | |
| 24 } | |
| 25 }; | |
| 26 | |
| 27 // Navigate the iframe | |
| 28 iframe.src = 'resources/blank.html'; | |
| 29 }); | |
| 30 }, "Test that navigator.defaultRequest isn't kept alive after reload."); | |
| 18 | 31 |
| 19 </script> | 32 </script> |
| 20 </body> | 33 </body> |
| 21 </html> | 34 </html> |
| OLD | NEW |