tor-browser

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

enabled-on-self-origin-by-permissions-policy.https.sub.html (1838B)


      1 <!DOCTYPE html>
      2 <body>
      3  <script src="/resources/testharness.js"></script>
      4  <script src="/resources/testharnessreport.js"></script>
      5  <script src="/resources/testdriver.js"></script>
      6  <script src="/resources/testdriver-vendor.js"></script>
      7  <script src="/permissions-policy/resources/permissions-policy.js"></script>
      8 
      9  <script>
     10    "use strict";
     11 
     12    const same_origin_src =
     13      "/permissions-policy/resources/permissions-policy-geolocation.html";
     14    const cross_origin_src =
     15      "https://{{hosts[alt][]}}:{{ports[https][0]}}" + same_origin_src;
     16 
     17 
     18    promise_setup(async () => {
     19      await test_driver.set_permission({ name: "geolocation" }, "granted");
     20    });
     21 
     22    promise_test(async (t) => {
     23      const position = await new Promise((resolve, reject) => {
     24        navigator.geolocation.getCurrentPosition(resolve, reject);
     25      });
     26      assert_true(
     27        position instanceof GeolocationPosition,
     28        "Expected a GeolocationPosition"
     29      );
     30    }, "Permissions-Policy header geolocation=(self) allows the top-level document.");
     31 
     32    promise_test(async (test) => {
     33      await test_feature_availability({
     34        feature_description: "Geolocation API",
     35        test,
     36        src: same_origin_src,
     37        expect_feature_available: expect_feature_available_default,
     38        is_promise_test: true,
     39      });
     40    }, "Permissions-Policy header geolocation=(self) allows same-origin iframes.");
     41 
     42    promise_test(async (test) => {
     43      await test_feature_availability({
     44        feature_description: "Geolocation API",
     45        test,
     46        src: cross_origin_src,
     47        expect_feature_available: expect_feature_unavailable_default,
     48        feature_name: "geolocation",
     49        is_promise_test: true,
     50      });
     51    }, "Permissions-Policy header geolocation=(self) disallows cross-origin iframes.");
     52  </script>
     53 </body>