crossorigin_iframe.html (924B)
1 <!DOCTYPE HTML> 2 <html> 3 <body> 4 <pre id="test"> 5 <script type="application/javascript"> 6 /** 7 Runs inside iframe in test_crossorigin_iframe.html. 8 */ 9 10 const BASE_GEO_URL = "http://mochi.test:8888/tests/dom/geolocation/test/mochitest/network_geolocation.sjs"; 11 var pushPrefs = (...p) => SpecialPowers.pushPrefEnv({set: p}); 12 13 (async () => { 14 await pushPrefs(["geo.provider.network.debug.requestCache.enabled", false], 15 ["geo.prompt.testing", true], 16 ["geo.prompt.testing.allow", true], 17 ["geo.provider.network.url", BASE_GEO_URL]); 18 19 navigator.geolocation.getCurrentPosition(() => { 20 navigator.geolocation.watchPosition(() => { 21 parent.postMessage("allowed", "*"); 22 }, () => { 23 parent.postMessage("denied", "*"); 24 }); 25 }, () => { 26 parent.postMessage("denied", "*"); 27 }); 28 29 })().catch(e => setTimeout(() => { throw e; })); 30 </script> 31 </pre> 32 </body> 33 </html>