tor-browser

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

get-current-position-error.html (947B)


      1 <!doctype html>
      2 <meta charset="utf-8" />
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="/resources/testdriver.js?feature=bidi"></script>
      6 <script src="/resources/testdriver-vendor.js"></script>
      7 
      8 <script>
      9  promise_setup(async () => {
     10    // Ensure permission is denied before proceeding.
     11    await test_driver.bidi.permissions.set_permission({
     12      descriptor: { name: 'geolocation' },
     13      state: 'denied',
     14    });
     15  });
     16 
     17  promise_test(async (t) => {
     18    document.innerHTML +=
     19      '<geolocation id="geolocation-element" autolocate onlocation="onLocation()"></geolocation>';
     20  }, 'Tests Geolocation element\'s error callback');
     21 
     22  function onLocation() {
     23    const el = document.getElementById('geolocation-element');
     24    assert_equals(el.position, null);
     25    assert_equals(el.error.code, 1);
     26    assert_equals(el.error.message, 'User denied Geolocation');
     27  }
     28 </script>