tor-browser

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

test_clipboard_events.html (1150B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <title>Test for Clipboard Events</title>
      5  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      6  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
      7 </head>
      8 <body>
      9 <p id="display"></p>
     10 <script>
     11 "use strict";
     12 
     13 // The clipboard event tests require `GlobalEventHandlers.onbeforeinput`
     14 // attribute which is available only when `beforeinput` event is enabled.
     15 // For ensuring it's available with any element in the document, we need
     16 // to enable it in this window and then, create elements in the new
     17 // document in a child window.
     18 
     19 SimpleTest.waitForExplicitFinish();
     20 SimpleTest.waitForFocus(async () => {
     21  await SpecialPowers.pushPrefEnv({
     22    set: [
     23      // NOTE: The tests operate under the assumption that the protected mode of
     24      // DataTransfer is enabled.
     25      ["dom.events.dataTransfer.protected.enabled", true],
     26    ]
     27  });
     28  let childWindow =
     29    window.open("window_clipboard_events.html", "_blank", "width=500,height=800");
     30  ok(childWindow, "A child window should've been opened");
     31  childWindow.onclose = () => {
     32    SimpleTest.finish();
     33  };
     34 });
     35 </script>
     36 </body>
     37 </html>