file_featurePolicy.html (924B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <script src="/tests/SimpleTest/SimpleTest.js"></script> 5 <script type="text/javascript" src="geolocation_common.js"></script> 6 </head> 7 <body> 8 <script class="testbody" type="text/javascript"> 9 10 resume_geolocationProvider(function() { 11 force_prompt(true, test_currentPosition); 12 }); 13 14 let tests = []; 15 16 function test_currentPosition() { 17 navigator.geolocation.getCurrentPosition(() => { 18 tests.push("allowed"); 19 test_watchPosition(); 20 }, () => { 21 tests.push("denied"); 22 test_watchPosition(); 23 }) 24 } 25 26 function test_watchPosition() { 27 navigator.geolocation.watchPosition(() => { 28 tests.push("allowed"); 29 send_results(); 30 }, () => { 31 tests.push("denied"); 32 send_results(); 33 }); 34 } 35 36 function send_results() { 37 if (tests.length != 2 || tests[0] != tests[1]) { 38 parent.continueTest("error"); 39 return; 40 } 41 42 parent.continueTest(tests[0]); 43 } 44 45 </script> 46 </body> 47 </html>