| OLD | NEW | 
|   1 importScripts('../../../resources/js-test.js'); |   1 importScripts('../../../resources/js-test.js'); | 
|   2  |   2  | 
|   3 self.jsTestIsAsync = true; |   3 self.jsTestIsAsync = true; | 
|   4  |   4  | 
|   5 description('Test createImageBitmap with invalid arguments in workers.'); |   5 description('Test createImageBitmap with invalid arguments in workers.'); | 
|   6  |   6  | 
 |   7 var reason; | 
 |   8  | 
 |   9 function shouldBeRejected(promise, message) { | 
 |  10     return promise.then(function() { | 
 |  11         testFailed('Resolved unexpectedly: ' + message); | 
 |  12     }, function(e) { | 
 |  13         reason = e; | 
 |  14         testPassed('Rejected as expected: ' + message); | 
 |  15         shouldBeTrue('reason instanceof Error'); | 
 |  16         debug(String(e)); | 
 |  17     }); | 
 |  18 } | 
 |  19  | 
|   7 var data; |  20 var data; | 
|   8  |  21  | 
|   9 self.addEventListener('message', function(e) { |  22 self.addEventListener('message', function(e) { | 
|  10   data = e.data; |  23     data = e.data; | 
|  11   shouldThrow("createImageBitmap(null, 0, 0, 10, 10)"); |  24     Promise.resolve().then(function() { | 
|  12   shouldThrow("createImageBitmap(data, 0, 0, 10, 0)"); |  25         return shouldBeRejected(createImageBitmap(null, 0, 0, 10, 10), 'null'); | 
|  13   shouldThrow("createImageBitmap(data, 0, 0, 0, 10)"); |  26     }).then(function() { | 
|  14   finishJSTest(); |  27         return shouldBeRejected(createImageBitmap(data, 0, 0, 10, 0), 'invalid a
    rea'); | 
 |  28     }).then(function() { | 
 |  29         return shouldBeRejected(createImageBitmap(data, 0, 0, 0, 10), 'invalid a
    rea'); | 
 |  30     }).catch(function(e) { | 
 |  31         testFailed('Unexpected rejection: ' + e); | 
 |  32     }).then(finishJSTest, finishJSTest); | 
|  15 }); |  33 }); | 
| OLD | NEW |