test_bug865919.html 1.4 KB

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