Bug 686026 - test_mozGetAsFile.html runs finish three times, instead of once; r=joedrew

This commit is contained in:
Ehsan Akhgari 2011-09-09 18:17:50 -04:00
parent dea5dcabf0
commit 85f4bfade8

View File

@ -7,16 +7,20 @@
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<script>
var gCompares = 0;
function compareAsync(file, canvas, type)
{
SimpleTest.waitForExplicitFinish();
++gCompares;
var reader = new FileReader();
reader.onload =
function(e) {
is(e.target.result, canvas.toDataURL(type),
"<canvas>.mozGetAsFile().getAsDataURL() should equal <canvas>.toDataURL()");
SimpleTest.finish();
if (--gCompares == 0) {
SimpleTest.finish();
}
};
reader.readAsDataURL(file);
}
@ -40,8 +44,6 @@ is(jpegfile.type, "image/jpeg",
compareAsync(jpegfile, canvas, "image/jpeg");
is(jpegfile.name, "bar.jpg", "File name should be what we passed in");
SimpleTest.finish();
});
</script>
<img src="image_yellow75.png" id="yellow75.png" class="resource">