2008-09-05 03:31:09 +04:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
2009-03-15 07:03:21 +03:00
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=478911
|
2008-09-05 03:31:09 +04:00
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Test for watchPosition and clearWatch</title>
|
2009-05-07 00:46:04 +04:00
|
|
|
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
2008-09-05 03:31:09 +04:00
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<script type="text/javascript" src="geolocation_common.js"></script>
|
|
|
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
|
|
</head>
|
|
|
|
<body>
|
2009-03-15 07:03:21 +03:00
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=478911">Mozilla Bug 478911</a>
|
2008-09-05 03:31:09 +04:00
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
|
2010-08-31 20:15:52 +04:00
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
resume_geolocationProvider();
|
|
|
|
force_prompt(true)
|
|
|
|
|
2009-03-15 07:03:21 +03:00
|
|
|
var hasBeenCleared = false;
|
2010-08-31 20:15:52 +04:00
|
|
|
var successWasCalledAfterClear = false;
|
|
|
|
|
2008-11-13 01:52:56 +03:00
|
|
|
function failureCallback(error)
|
|
|
|
{
|
2009-03-15 07:03:21 +03:00
|
|
|
ok(0, "we should not be seeing failures from this watchPosition");
|
2008-11-13 01:52:56 +03:00
|
|
|
}
|
|
|
|
|
2009-03-15 07:03:21 +03:00
|
|
|
function successCallback(position) {
|
|
|
|
if (hasBeenCleared == true) {
|
2010-08-31 20:15:52 +04:00
|
|
|
successWasCalledAfterClear = true;
|
2008-09-05 03:31:09 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-15 07:03:21 +03:00
|
|
|
function clearWatch() {
|
|
|
|
navigator.geolocation.clearWatch(watchID);
|
|
|
|
hasBeenCleared = true;
|
2008-09-05 03:31:09 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
function testAccepted() {
|
2010-08-31 20:15:52 +04:00
|
|
|
ok(!successWasCalledAfterClear, "The successCallback should not be called after clear");
|
|
|
|
reset_prompt();
|
2008-09-05 03:31:09 +04:00
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-15 07:03:21 +03:00
|
|
|
watchID = navigator.geolocation.watchPosition(successCallback, failureCallback, null);
|
2008-09-05 03:31:09 +04:00
|
|
|
|
2010-08-31 20:15:52 +04:00
|
|
|
setTimeout(clearWatch, 250);
|
2008-09-05 03:31:09 +04:00
|
|
|
|
2010-08-31 20:15:52 +04:00
|
|
|
setTimeout(testAccepted, 2000);
|
2008-09-05 03:31:09 +04:00
|
|
|
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|