| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="../../resources/js-test.js"></script> | |
| 5 </head> | |
| 6 <body> | |
| 7 <div id="description"></div> | |
| 8 <div id="console"></div> | |
| 9 <script> | |
| 10 window.jsTestIsAsync = true; | |
| 11 | |
| 12 description('Test Promise.'); | |
| 13 | |
| 14 var thisInOnFulfilledSloppy; | |
| 15 var thisInOnRejectedSloppy; | |
| 16 | |
| 17 var thisInOnFulfilledStrict; | |
| 18 var thisInOnRejectedStrict; | |
| 19 | |
| 20 Promise.resolve().then(function () { | |
| 21 return Promise.resolve(42).then(function () { | |
| 22 testPassed('fulfilled'); | |
| 23 window.thisInOnFulfilledSloppy = this; | |
| 24 shouldBe('thisInOnFulfilledSloppy', 'window'); | |
| 25 }, function () { | |
| 26 testFailed('rejected'); | |
| 27 }); | |
| 28 }).then(function () { | |
| 29 return Promise.reject(42).then(function () { | |
| 30 testFailed('fulfilled'); | |
| 31 }, function () { | |
| 32 testPassed('rejected'); | |
| 33 window.thisInOnRejectedSloppy = this; | |
| 34 shouldBe('thisInOnRejectedSloppy', 'window'); | |
| 35 }); | |
| 36 }).then(function () { | |
| 37 return Promise.resolve(42).then(function () { | |
| 38 'use strict'; | |
| 39 testPassed('fulfilled'); | |
| 40 window.thisInOnFulfilledStrict = this; | |
| 41 shouldBe('thisInOnFulfilledStrict', 'undefined'); | |
| 42 }, function () { | |
| 43 'use strict'; | |
| 44 testFailed('rejected'); | |
| 45 }); | |
| 46 }).then(function () { | |
| 47 return Promise.reject(42).then(function () { | |
| 48 'use strict'; | |
| 49 testFailed('fulfilled'); | |
| 50 }, function () { | |
| 51 'use strict'; | |
| 52 testPassed('rejected'); | |
| 53 window.thisInOnRejectedStrict = this; | |
| 54 shouldBe('thisInOnRejectedStrict', 'undefined'); | |
| 55 }); | |
| 56 }).then(finishJSTest, finishJSTest); | |
| 57 | |
| 58 </script> | |
| 59 </body> | |
| 60 </html> | |
| OLD | NEW |