user-prompt.html (1302B)
1 <!DOCTYPE html> 2 <title>Unhandled user prompt dismisses and notifies</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <meta name="variant" content="?type=alert"> 6 <meta name="variant" content="?type=confirm"> 7 <meta name="variant" content="?type=prompt"> 8 <meta name="variant" content="?type=alert&wait"> 9 <meta name="variant" content="?type=confirm&wait"> 10 <meta name="variant" content="?type=prompt&wait"> 11 <script> 12 let params = new URL(location).searchParams; 13 setup({ single_test: true }); 14 // Waiting exercises the case where a user prompt appears while waiting for 15 // the next testdriver event. The WebDriver-specified behavior is to resolve 16 // with `null` [1, 2], which the WebDriver executor should ignore. The 17 // testdriver event loop will handle the open prompt on its next cycle. For 18 // the default "dismiss and notify" handler, this throws an unexpected alert 19 // open error in the executor. 20 // 21 // [1]: Step 5.3 of https://www.w3.org/TR/webdriver/#execute-async-script 22 // [2]: https://www.w3.org/TR/webdriver/#dfn-execute-a-function-body 23 step_timeout(() => { 24 let type = params.get("type"); 25 window[type]("this user prompt should be dismissed"); 26 done(); 27 }, params.has("wait") ? 1000 : 0); 28 </script>