test_timeoutCurrent.html (1276B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=858827 5 --> 6 <head> 7 <title>Test for timeout option </title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <script type="text/javascript" src="geolocation_common.js"></script> 10 11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 12 </head> 13 <body> 14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=858827">Mozilla Bug 858827</a> 15 <p id="display"></p> 16 <div id="content" style="display: none"> 17 18 </div> 19 <pre id="test"> 20 <script class="testbody" type="text/javascript"> 21 22 SimpleTest.waitForExplicitFinish(); 23 24 resume_geolocationProvider(function() { 25 force_prompt(true, test1); 26 }); 27 28 29 function successCallback(_position) { 30 ok(false, "we should not be seeing successCallback here."); 31 SimpleTest.finish(); 32 } 33 34 function errorCallback(err) { 35 ok(err.code == err.TIMEOUT, "ensure error is a timeout."); 36 resume_geolocationProvider(function() { 37 SimpleTest.finish(); 38 }); 39 } 40 41 42 var options = { 43 maximumAge: 0, 44 timeout: 0 45 }; 46 47 function test1() { 48 navigator.geolocation.getCurrentPosition(successCallback, 49 errorCallback, 50 options); 51 } 52 </script> 53 </pre> 54 </body> 55 </html>