| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 (function() { | 93 (function() { |
| 94 Promise.reject(5).chain(assertUnreachable, undefined).chain( | 94 Promise.reject(5).chain(assertUnreachable, undefined).chain( |
| 95 assertUnreachable, | 95 assertUnreachable, |
| 96 function(r) { assertAsync(r === 5, "rejected/chain-nohandler") } | 96 function(r) { assertAsync(r === 5, "rejected/chain-nohandler") } |
| 97 ) | 97 ) |
| 98 assertAsyncRan() | 98 assertAsyncRan() |
| 99 })(); | 99 })(); |
| 100 | 100 |
| 101 (function() { | 101 (function() { |
| 102 Promise.resolve(5).then(undefined, assertUnreachable).chain( | 102 Promise.resolve(5).then(undefined, assertUnreachable).chain( |
| 103 function(x) { assertAsync(x === 5, "resolved/then-nohandler") }, | 103 function(x) { assertAsync(x === 5, "resolved/then-nohandler-undefined") }, |
| 104 assertUnreachable | 104 assertUnreachable |
| 105 ) | 105 ) |
| 106 assertAsyncRan() | 106 assertAsyncRan() |
| 107 Promise.resolve(6).then(null, assertUnreachable).chain( |
| 108 function(x) { assertAsync(x === 6, "resolved/then-nohandler-null") }, |
| 109 assertUnreachable |
| 110 ) |
| 111 assertAsyncRan() |
| 107 })(); | 112 })(); |
| 108 | 113 |
| 109 (function() { | 114 (function() { |
| 110 Promise.reject(5).then(assertUnreachable, undefined).chain( | 115 Promise.reject(5).then(assertUnreachable, undefined).chain( |
| 111 assertUnreachable, | 116 assertUnreachable, |
| 112 function(r) { assertAsync(r === 5, "rejected/then-nohandler") } | 117 function(r) { assertAsync(r === 5, "rejected/then-nohandler-undefined") } |
| 118 ) |
| 119 assertAsyncRan() |
| 120 Promise.reject(6).then(assertUnreachable, null).chain( |
| 121 assertUnreachable, |
| 122 function(r) { assertAsync(r === 6, "rejected/then-nohandler-null") } |
| 113 ) | 123 ) |
| 114 assertAsyncRan() | 124 assertAsyncRan() |
| 115 })(); | 125 })(); |
| 116 | 126 |
| 117 (function() { | 127 (function() { |
| 118 var p1 = Promise.resolve(5) | 128 var p1 = Promise.resolve(5) |
| 119 var p2 = Promise.resolve(p1) | 129 var p2 = Promise.resolve(p1) |
| 120 var p3 = Promise.resolve(p2) | 130 var p3 = Promise.resolve(p2) |
| 121 p3.chain( | 131 p3.chain( |
| 122 function(x) { assertAsync(x === p2, "resolved/chain") }, | 132 function(x) { assertAsync(x === p2, "resolved/chain") }, |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 Promise.all([11, Promise.resolve(12), 13, MyPromise.resolve(14), 15, 16]) | 792 Promise.all([11, Promise.resolve(12), 13, MyPromise.resolve(14), 15, 16]) |
| 783 assertTrue(log === "nx14cn", "subclass/all/arg") | 793 assertTrue(log === "nx14cn", "subclass/all/arg") |
| 784 | 794 |
| 785 log = "" | 795 log = "" |
| 786 MyPromise.all([21, Promise.resolve(22), 23, MyPromise.resolve(24), 25, 26]) | 796 MyPromise.all([21, Promise.resolve(22), 23, MyPromise.resolve(24), 25, 26]) |
| 787 assertTrue(log === "nx24nnx21cnnx23cncnnx25cnnx26cn", "subclass/all/self") | 797 assertTrue(log === "nx24nnx21cnnx23cncnnx25cnnx26cn", "subclass/all/self") |
| 788 })(); | 798 })(); |
| 789 | 799 |
| 790 | 800 |
| 791 assertAsyncDone() | 801 assertAsyncDone() |
| OLD | NEW |