diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /image/test/mochitest/test_bug497665.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'image/test/mochitest/test_bug497665.html')
-rw-r--r-- | image/test/mochitest/test_bug497665.html | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/image/test/mochitest/test_bug497665.html b/image/test/mochitest/test_bug497665.html new file mode 100644 index 000000000..3a72c0912 --- /dev/null +++ b/image/test/mochitest/test_bug497665.html @@ -0,0 +1,92 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=497665 +--> +<head> + <title>Test for Bug 497665</title> + <script type="application/javascript" src="/MochiKit/MochiKit.js"></script> + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=497665">Mozilla Bug 497665</a> +<p id="display"></p> +<pre id="test"> +<script type="application/javascript"> + +var image1first, image2first, image1second, image2second, image1third, image2third; + +SimpleTest.waitForExplicitFinish(); + +function checkFirst() +{ + var iframeelem = document.getElementById('test-iframe'); + var canvas = document.getElementById('canvas'); + var ctx = canvas.getContext('2d'); + + var firstimg = iframeelem.contentDocument.getElementById('image1'); + var secondimg = iframeelem.contentDocument.getElementById('image2'); + ctx.drawImage(firstimg, 0, 0); + image1first = canvas.toDataURL(); + ctx.drawImage(secondimg, 0, 0); + image2first = canvas.toDataURL(); + + ok(image1first == image2first, "We got different images, but shouldn't have."); + + iframeelem.onload = checkForceReload; + iframeelem.contentWindow.location.reload(true); +} + +function checkForceReload() +{ + var iframeelem = document.getElementById('test-iframe'); + var canvas = document.getElementById('canvas'); + var ctx = canvas.getContext('2d'); + + var firstimg = iframeelem.contentDocument.getElementById('image1'); + var secondimg = iframeelem.contentDocument.getElementById('image2'); + ctx.drawImage(firstimg, 0, 0); + image1second = canvas.toDataURL(); + ctx.drawImage(secondimg, 0, 0); + image2second = canvas.toDataURL(); + + ok(image1second == image2second, "We got different images after a force-reload, but shouldn't have."); + + // Sanity check that we actually reloaded. + ok(image1first != image1second, "We got the same images after a force-reload."); + + iframeelem.onload = checkReload; + iframeelem.contentWindow.location.reload(false); +} + +function checkReload() +{ + var iframeelem = document.getElementById('test-iframe'); + var canvas = document.getElementById('canvas'); + var ctx = canvas.getContext('2d'); + + var firstimg = iframeelem.contentDocument.getElementById('image1'); + var secondimg = iframeelem.contentDocument.getElementById('image2'); + ctx.drawImage(firstimg, 0, 0); + image1third = canvas.toDataURL(); + ctx.drawImage(secondimg, 0, 0); + image2third = canvas.toDataURL(); + + ok(image1third == image2third, "We got different images after a reload, but shouldn't have."); + + // Sanity check that we actually reloaded properly. + ok(image1second != image1third, "We got the same images after a reload."); + ok(image1first == image1third, "We didn't loop back to the first image."); + + SimpleTest.finish(); +} + +</script> +</pre> +<div id="content"> <!-- style="display: none" --> +<canvas id="canvas" width="100" height="100"> </canvas> +<iframe id="test-iframe" src="bug497665-iframe.html" onload="checkFirst()"></iframe> +</div> +</body> +</html> |