Bug 819412 - Test for Bug 733553 gets desynched under load r=joe
authorAdam Dane [:hobophobe] <unusualtears@gmail.com>
Mon, 10 Dec 2012 15:13:42 -0600
changeset 121354 2ce14c9551fa3e280fbf2a2a036ba7bf64900d31
parent 121353 f99c04a0afc54356509f222902988c3c8d53ab8f
child 121355 b3b5e2392ea57375ddafd681e6bc85bb8f78ab05
push idunknown
push userunknown
push dateunknown
reviewersjoe
bugs819412, 733553
milestone20.0a1
Bug 819412 - Test for Bug 733553 gets desynched under load r=joe
image/test/mochitest/test_bug733553.html
--- a/image/test/mochitest/test_bug733553.html
+++ b/image/test/mochitest/test_bug733553.html
@@ -64,17 +64,20 @@ function readyForNext() {
 
 function imageLoad(aEvent) {
   var [width, fileName] = testParts[testIndex];
   is(aEvent.target.width, width,
      "Test " + testIndex + " " + fileName + " width correct");
 
   // Always call readyForNext here, as it's the closest we have to a cleanup
   readyForNext();
-  if ((testParts.length - 1) == testIndex) {
+  if (testParts.length == testIndex) {
+    var firstimg = document.getElementsByTagName('img')[0];
+    firstimg.removeEventListener("load", imageLoad, false);
+    firstimg.removeEventListener("error", imageLoad, false);
     SimpleTest.finish();
   }
 }
 
 </script>
 </pre>
 <div id="content"> <!-- style="display: none" -->
 <iframe id="loader"></iframe>