Unreviewed post-review test fixup
[WebKit-https.git] / LayoutTests / editing / pasteboard / img-srcset-copy-paste-canonicalization.html
index efb6797f9531ab43e4a2e8bc1967f99a0cbc9fd1..427c6679f0f54f3cbebfcdb935eaed7712e51361 100644 (file)
     var sourceImageSegments;
     var destinationImageSegments;
 
+    var finishTestCount = 0;
+    function maybeFinishTest() {
+        ++finishTestCount;
+        if (finishTestCount == 2)
+            finishJSTest();
+    }
+
     function runTests(href) {
         iframeHref = href;
 
 
         destinationImage.onerror = function() {
             testFailed("Image should not fail to load");
-            finishJSTest();
+            maybeFinishTest();
         }
-        image.onload = function() {
-            finishJSTest();
+        destinationImage.onload = function() {
+            maybeFinishTest();
         }
 
         sourceImageSegments = sourceImage.getAttribute("srcset").split(" ");
@@ -69,6 +76,7 @@
         shouldBe("destinationImageSegments[1]", "\"2x,\"");
         shouldBe("sourceImageSegments[3]", "\"1x\"");
         shouldBe("destinationImageSegments[3]", "\"1x\"");
+        maybeFinishTest();
     }
 </script>
 <script src="../../resources/js-test-post.js"></script>