Bug 994291 - Avoid calling SimpleTest.finish more than once. r=dougt
authorBill McCloskey <wmccloskey@mozilla.com>
Tue, 15 Apr 2014 11:35:00 -0400
changeset 181276 6bb86257e36aac92c89cd5eb7fc27a66e957c635
parent 181275 5b722269feee1758bc7c7dfb20e9bca8fcee9900
child 181277 d1da7f04c1098a35cf009c9ed2ae66ab5307fe63
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersdougt
bugs994291
milestone32.0a1
Bug 994291 - Avoid calling SimpleTest.finish more than once. r=dougt
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>