Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save daleharvey/0dccaf85f1ce5a2ad6da6d4aba360a63 to your computer and use it in GitHub Desktop.
Save daleharvey/0dccaf85f1ce5a2ad6da6d4aba360a63 to your computer and use it in GitHub Desktop.
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1637402
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1637402</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
const BASE_GEO_URL = "http://mochi.test:8888/tests/dom/tests/mochitest/geolocation/network_geolocation.sjs";
function getCurrentPosition() {
return new Promise(function(resolve, reject) {
navigator.geolocation.getCurrentPosition(resolve, reject);
});
}
SimpleTest.waitForExplicitFinish();
window.onload = () => {
SimpleTest.waitForFocus(() => {
SpecialPowers.pushPrefEnv({"set":
[
["geo.prompt.testing", true],
["geo.prompt.testing.allow", true],
["geo.provider.network.url", BASE_GEO_URL],
["geo.provider.network.backup.url", BASE_GEO_URL],
["geo.provider.network.logging.enabled", true],
],
}, doTest);
}, window);
};
async function doTest() {
dump("Making request\n");
try {
let pos = await getCurrentPosition();
dump("YAY GOT: " + JSON.stringify(pos) + "\n");
} catch (err) {
dump("Boo broken: " + err.message + "\n");
}
ok(false, "test bork ed");
}
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1637402">Mozilla Bug </a>
<pre id="test"></pre>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment