| OLD | NEW | 
|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> | 
| 2 <html> | 2 <html> | 
| 3 <head> | 3 <head> | 
| 4 <script src="resources/js-test-pre.js"></script> | 4 <script src="resources/js-test-pre.js"></script> | 
| 5 </head> | 5 </head> | 
| 6 <body> | 6 <body> | 
| 7 <div id="description"></div> | 7 <div id="description"></div> | 
| 8 <div id="console"></div> | 8 <div id="console"></div> | 
| 9 <script> | 9 <script> | 
| 10 window.jsTestIsAsync = true; | 10 window.jsTestIsAsync = true; | 
| 11 | 11 | 
| 12 description('Test Promise.'); | 12 description('Test Promise.'); | 
| 13 | 13 | 
| 14 var thisInInit; | 14 var thisInInit; | 
| 15 var resolve, reject; | 15 var resolve, reject; | 
| 16 var promise = new Promise(function(newResolve, newReject) { | 16 var promise = new Promise(function(newResolve, newReject) { | 
| 17   thisInInit = this; | 17   thisInInit = this; | 
| 18   resolve = newResolve; | 18   resolve = newResolve; | 
| 19   reject = newReject; | 19   reject = newReject; | 
| 20 }); | 20 }); | 
| 21 | 21 | 
| 22 shouldBeTrue('promise instanceof Promise'); | 22 shouldBeTrue('promise instanceof Promise'); | 
| 23 shouldBe('promise.constructor', 'Promise'); | 23 shouldBe('promise.constructor', 'Promise'); | 
| 24 shouldBe('thisInInit', 'promise'); | 24 shouldBeFalse('thisInInit === promise'); | 
|  | 25 shouldBeTrue('thisInInit === window'); | 
| 25 shouldBeTrue('resolve instanceof Function'); | 26 shouldBeTrue('resolve instanceof Function'); | 
| 26 shouldBeTrue('reject instanceof Function'); | 27 shouldBeTrue('reject instanceof Function'); | 
| 27 | 28 | 
| 28 shouldThrow('new Promise()', '"TypeError: Promise constructor takes a function a
    rgument"'); | 29 shouldThrow('new Promise()', '"TypeError: Promise constructor takes a function a
    rgument"'); | 
| 29 shouldThrow('new Promise(37)', '"TypeError: Promise constructor takes a function
     argument"'); | 30 shouldThrow('new Promise(37)', '"TypeError: Promise constructor takes a function
     argument"'); | 
| 30 | 31 | 
| 31 shouldNotThrow('promise = new Promise(function() { throw Error("foo"); })'); | 32 shouldNotThrow('promise = new Promise(function() { throw Error("foo"); })'); | 
| 32 promise.then(undefined, function(result) { | 33 promise.then(undefined, function(result) { | 
| 33   window.result = result; | 34   window.result = result; | 
| 34   shouldBeEqualToString('result.message', 'foo'); | 35   shouldBeEqualToString('result.message', 'foo'); | 
| (...skipping 10 matching lines...) Expand all  Loading... | 
| 45 }, function(result) { | 46 }, function(result) { | 
| 46   window.result = result; | 47   window.result = result; | 
| 47   testFailed('rejected'); | 48   testFailed('rejected'); | 
| 48   finishJSTest(); | 49   finishJSTest(); | 
| 49 }); | 50 }); | 
| 50 | 51 | 
| 51 </script> | 52 </script> | 
| 52 <script src="resources/js-test-post.js"></script> | 53 <script src="resources/js-test-post.js"></script> | 
| 53 </body> | 54 </body> | 
| 54 </html> | 55 </html> | 
| OLD | NEW | 
|---|