image/test/mochitest/test_bug865919.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/image/test/mochitest/test_bug865919.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=865919
     1.8 +-->
     1.9 +<head>
    1.10 +  <meta charset="UTF-8">
    1.11 +  <title>Test for Bug 865919</title>
    1.12 +  <script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
    1.13 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.14 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.15 +</head>
    1.16 +<body>
    1.17 +<script type="text/javascript">
    1.18 +"use strict";
    1.19 +
    1.20 +/* Test for Bug 865919:
    1.21 + *  BMP with height of INT32_MIN should fail to decode.
    1.22 + */
    1.23 +
    1.24 +SimpleTest.waitForExplicitFinish();
    1.25 +
    1.26 +var req = new XMLHttpRequest();
    1.27 +req.onload  = function() { CallbackAssert(true,  'Request for file succeeded.'); };
    1.28 +req.onerror = function() { CallbackAssert(false, 'Request for file failed! Failed to test non-existent file.'); };
    1.29 +req.open('GET', 'INT32_MIN.bmp');
    1.30 +req.send(null);
    1.31 +
    1.32 +var outstandingCallbacks = 2;
    1.33 +
    1.34 +function CallbackAssert(assertVal, failText) {
    1.35 +  ok(assertVal, failText);
    1.36 +  
    1.37 +  outstandingCallbacks--;
    1.38 +  ok(outstandingCallbacks >= 0, '`outstandingCallbacks` should be non-negative.');
    1.39 +  if (outstandingCallbacks)
    1.40 +    return;
    1.41 +
    1.42 +  // No outstanding callbacks remain, so we're done.
    1.43 +  SimpleTest.finish();
    1.44 +}
    1.45 +
    1.46 +</script>
    1.47 +
    1.48 +<div id='content'>
    1.49 +  <img src='INT32_MIN.bmp'
    1.50 +       onerror='CallbackAssert(true, "Got expected onerror for INT32_MIN.bmp")'
    1.51 +       onload='CallbackAssert(false, "Got unexpected onload for INT32_MIN.bmp")'>
    1.52 +</div>
    1.53 +
    1.54 +</body>
    1.55 +</html>
    1.56 +

mercurial