tor-browser

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

window-open.html (1359B)


      1 <!DOCTYPE html>
      2 <title>window.open() and consuming user activation</title>
      3 <link rel="help" href="https://html.spec.whatwg.org/#the-rules-for-choosing-a-navigable">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="/resources/testdriver.js"></script>
      7 <script src="/resources/testdriver-vendor.js"></script>
      8 <script>
      9 'use strict';
     10 
     11 promise_test(async function(t) {
     12  await test_driver.bless("user activation");
     13  const testWin = window.open("/resources/blank.html", "_blank");
     14  t.add_cleanup(() => {
     15    testWin.close();
     16  });
     17  assert_false(navigator.userActivation.isActive, "User activation should be consumed");
     18 }, "Opening a new window should consume user activation");
     19 
     20 promise_test(async function(t) {
     21  await test_driver.bless("user activation");
     22  const testWin = window.open("/resources/blank.html", "testWindow");
     23  assert_false(navigator.userActivation.isActive, "User activation should be consumed");
     24  t.add_cleanup(() => {
     25    testWin.close();
     26  });
     27 
     28  // Open the existing window again
     29  await test_driver.bless("user activation");
     30  const testWin2 = window.open("/resources/blank.html", "testWindow");
     31  assert_true(navigator.userActivation.isActive, "User activation should not be consumed");
     32 }, "Opening an existing window should not consume user activation");
     33 </script>