tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

dialog-no-throw-requested-state.html (1006B)


      1 <!DOCTYPE html>
      2 <link rel=author href="mailto:jarhar@chromium.org">
      3 <link rel=help href="https://github.com/whatwg/html/pull/9142">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 
      7 <dialog>hello</dialog>
      8 
      9 <script>
     10 test(() => {
     11  const dialog = document.querySelector('dialog');
     12 
     13  // calling close() on a dialog that is already closed should not throw.
     14  dialog.close();
     15 
     16  dialog.show();
     17  // calling show() on a dialog that is already showing non-modal should not throw.
     18  dialog.show();
     19  assert_throws_dom('InvalidStateError', () => dialog.showModal(),
     20    'Calling showModal() on a dialog that is already showing non-modal should throw.');
     21  dialog.close();
     22 
     23  dialog.showModal();
     24  assert_throws_dom('InvalidStateError', () => dialog.show(),
     25    'Calling show() on a dialog that is already showing modal should throw.');
     26  // calling showModal() on a dialog that is already showing modal should not throw.
     27  dialog.showModal();
     28 });
     29 </script>