Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!doctype html>
<meta charset="utf-8" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js?feature=bidi"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script>
promise_setup(async () => {
// Ensure permission is denied before proceeding.
await test_driver.bidi.permissions.set_permission({
descriptor: { name: 'geolocation' },
state: 'denied',
});
});
promise_test(async (t) => {
document.innerHTML +=
'<geolocation id="geolocation-element" autolocate onlocation="onLocation()"></geolocation>';
}, 'Tests Geolocation element\'s error callback');
function onLocation() {
const el = document.getElementById('geolocation-element');
assert_equals(el.position, null);
assert_equals(el.error.code, 1);
assert_equals(el.error.message, 'User denied Geolocation');
}
</script>