content/base/test/test_bug421602.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/test/test_bug421602.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,53 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=421602
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 421602</title>
    1.11 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.13 +</head>
    1.14 +<body>
    1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=421602">Mozilla Bug 421602</a>
    1.16 +<p id="display"></p>
    1.17 +<div id="content" style="display: none">
    1.18 +  
    1.19 +</div>
    1.20 +<pre id="test">
    1.21 +<script class="testbody" type="text/javascript">
    1.22 +
    1.23 +/** Test for Bug 421602 **/
    1.24 +SimpleTest.waitForExplicitFinish();
    1.25 +
    1.26 +var img1loaded = false;
    1.27 +var img1errored = false;
    1.28 +
    1.29 +// Our test image
    1.30 +function loadTestImage() {
    1.31 +  var img1 = new Image();
    1.32 +  img1.onload = function() {
    1.33 +    img1loaded = true;
    1.34 +    finishTest();
    1.35 +  }
    1.36 +  img1.onerror = function() {
    1.37 +    img1errored = true;
    1.38 +    finishTest();
    1.39 +  }
    1.40 +  img1.src = window.location.href + "?image1=true";
    1.41 +}
    1.42 +loadTestImage();
    1.43 +
    1.44 +// Probably overkill to gc() more than once, but let's be safe
    1.45 +SpecialPowers.gc(); SpecialPowers.gc(); SpecialPowers.gc();
    1.46 +
    1.47 +function finishTest() {
    1.48 +  is(img1errored, true, "Image 1 should error");
    1.49 +  is(img1loaded, false, "Image 1 should not load");
    1.50 +  SimpleTest.finish();
    1.51 +}
    1.52 +</script>
    1.53 +</pre>
    1.54 +</body>
    1.55 +</html>
    1.56 +

mercurial