Bug 994291 - Avoid calling SimpleTest.finish more than once. r=dougt, a=test-only
authorBill McCloskey <wmccloskey@mozilla.com>
Tue, 15 Apr 2014 11:35:00 -0400
changeset 192177 3136f0462a23
parent 192176 63a8f593b292
child 192178 461e1c788403
push id3512
push userryanvm@gmail.com
push date2014-04-30 13:07 +0000
Treeherderresults
reviewersdougt, test-only
bugs994291
milestone30.0
Bug 994291 - Avoid calling SimpleTest.finish more than once. r=dougt, a=test-only
dom/tests/mochitest/geolocation/windowTest.html
--- a/dom/tests/mochitest/geolocation/windowTest.html
+++ b/dom/tests/mochitest/geolocation/windowTest.html
@@ -13,18 +13,25 @@ https://bugzilla.mozilla.org/show_bug.cg
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=493615">Mozilla Bug 493615</a>
 <p id="display"></p>
 <div id="content" style="display: none">
   
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
+var finished = false;
 
 function successCallback(position) {
+  // watchPosition can notify more than once.
+  if (finished) {
+    return;
+  }
+  finished = true;
+
   var opener = window.opener;
   window.close();
   opener.done();
 }
 
 navigator.geolocation.watchPosition(successCallback, null, null);
 </script>
 </pre>