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 199031 331ceaa4b34e5b942efc509ad607f03ffb533591
parent 199030 7f1fffe7cbcb9f5e19bb94125323623f3c2b6dfe
child 199032 bb3fcf304252c6c523531b4de413543f98a4f07b
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdougt, test-only
bugs994291
milestone31.0a2
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>