anchor-download.html (990B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <iframe id="i" src="/common/blank.html"></iframe> 5 <script> 6 promise_test(async t => { 7 await new Promise(resolve => window.onload = resolve); 8 9 let navigate_called = false; 10 i.contentWindow.navigation.onnavigate = () => navigate_called = true; 11 navigation.onnavigate = t.unreached_func("navigate must not fire"); 12 13 let a = i.contentDocument.createElement("a"); 14 a.href = "?1"; 15 a.download = ""; 16 i.contentDocument.body.appendChild(a); 17 a.click(); 18 19 i.contentWindow.navigation.onnavigatesuccess = t.unreached_func("navigatesuccess must not fire"); 20 i.contentWindow.navigation.onnavigateerror = t.unreached_func("navigateerror must not fire"); 21 await new Promise(resolve => t.step_timeout(resolve, 20)); 22 assert_true(navigate_called); 23 }, "<a download> fires navigate, but not navigatesuccess or navigateerror when not intercepted by intercept()"); 24 </script>