image/test/mochitest/test_bug865919.html

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=865919
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <meta charset="UTF-8">
michael@0 8 <title>Test for Bug 865919</title>
michael@0 9 <script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
michael@0 10 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 12 </head>
michael@0 13 <body>
michael@0 14 <script type="text/javascript">
michael@0 15 "use strict";
michael@0 16
michael@0 17 /* Test for Bug 865919:
michael@0 18 * BMP with height of INT32_MIN should fail to decode.
michael@0 19 */
michael@0 20
michael@0 21 SimpleTest.waitForExplicitFinish();
michael@0 22
michael@0 23 var req = new XMLHttpRequest();
michael@0 24 req.onload = function() { CallbackAssert(true, 'Request for file succeeded.'); };
michael@0 25 req.onerror = function() { CallbackAssert(false, 'Request for file failed! Failed to test non-existent file.'); };
michael@0 26 req.open('GET', 'INT32_MIN.bmp');
michael@0 27 req.send(null);
michael@0 28
michael@0 29 var outstandingCallbacks = 2;
michael@0 30
michael@0 31 function CallbackAssert(assertVal, failText) {
michael@0 32 ok(assertVal, failText);
michael@0 33
michael@0 34 outstandingCallbacks--;
michael@0 35 ok(outstandingCallbacks >= 0, '`outstandingCallbacks` should be non-negative.');
michael@0 36 if (outstandingCallbacks)
michael@0 37 return;
michael@0 38
michael@0 39 // No outstanding callbacks remain, so we're done.
michael@0 40 SimpleTest.finish();
michael@0 41 }
michael@0 42
michael@0 43 </script>
michael@0 44
michael@0 45 <div id='content'>
michael@0 46 <img src='INT32_MIN.bmp'
michael@0 47 onerror='CallbackAssert(true, "Got expected onerror for INT32_MIN.bmp")'
michael@0 48 onload='CallbackAssert(false, "Got unexpected onload for INT32_MIN.bmp")'>
michael@0 49 </div>
michael@0 50
michael@0 51 </body>
michael@0 52 </html>
michael@0 53

mercurial