stable-state-beforeunload-manual.html (1088B)
1 <!doctype html> 2 <title>stable state in beforeunload</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <div id=log></div> 6 <button>click this button and cancel navigation</button> 7 <a href="data:text/plain,FAIL: did not cancel navigation"></a> 8 <script> 9 async_test(function(t) { 10 window.onbeforeunload = t.step_func(function(event) { 11 var message = "foo bar"; 12 event.returnValue = message; 13 return message; 14 }); 15 var button = document.querySelector('button'); 16 var link = document.querySelector('a'); 17 button.onclick = t.step_func(function() { 18 v = document.createElement('video'); 19 v.src = 'data:,'; 20 assert_equals(v.networkState, v.NETWORK_NO_SOURCE, 'networkState before dialog'); 21 assert_equals(v.currentSrc, '', 'currentSrc before dialog'); 22 link.click(); 23 assert_equals(v.networkState, v.NETWORK_NO_SOURCE, 'networkState after dialog'); 24 assert_equals(v.currentSrc, '', 'currentSrc after dialog'); 25 t.done(); 26 window.onbeforeonload = null; 27 button.remove(); 28 }); 29 }); 30 </script>