tor-browser

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

permissions-cg.https.html (1118B)


      1 <!doctype html>
      2 <meta charset=utf-8>
      3 <title>Test PermissionStatus's name attribute.</title>
      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 src="/common/gc.js"></script>
      9 
     10 <script>
     11 promise_test(async () => {
     12  const { state: initialState } = await navigator.permissions.query({
     13    name: "geolocation",
     14  });
     15 
     16  const pass = new Promise(async (resolve) => {
     17    let status = await navigator.permissions.query({
     18      name: "geolocation",
     19    });
     20    status.addEventListener("change", resolve, { once: true });
     21 
     22    status = null;
     23    await garbageCollect();
     24 
     25    // Will cause change event to be dispatched.
     26    await test_driver.set_permission({ name: "geolocation" }, "granted");
     27  });
     28 
     29  // Wait for the change event to be dispatched.
     30  await pass;
     31 
     32  // Reset the permission to its default value.
     33  await test_driver.set_permission({ name: "geolocation" }, initialState);
     34 }, "status is not garbage collected when it goes out of scope");
     35 
     36 </script>