| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 Promise.accept(5).then(undefined, assertUnreachable).chain( | 102 Promise.accept(5).then(undefined, assertUnreachable).chain( |
| 103 function(x) { assertAsync(x === 5, "resolved/then-nohandler-undefined") }, | 103 function(x) { assertAsync(x === 5, "resolved/then-nohandler-undefined") }, |
| 104 assertUnreachable | 104 assertUnreachable |
| 105 ) | 105 ) |
| 106 assertAsyncRan() | 106 assertAsyncRan() |
| 107 Promise.accept(6).then(null, assertUnreachable).chain( | 107 Promise.accept(6).then(null, assertUnreachable).chain( |
| 108 function(x) { assertAsync(x === 6, "resolved/then-nohandler-null") }, | 108 function(x) { assertAsync(x === 6, "resolved/then-nohandler-null") }, |
| 109 assertUnreachable | 109 assertUnreachable |
| 110 ) | 110 ) |
| 111 assertAsyncRan() | 111 assertAsyncRan() |
| 112 Promise.accept(7).then(false, assertUnreachable).chain( |
| 113 function(x) { assertAsync(x === 7, "resolved/then-nohandler-false") }, |
| 114 assertUnreachable |
| 115 ) |
| 116 assertAsyncRan() |
| 117 Promise.accept(8).then(42, assertUnreachable).chain( |
| 118 function(x) { assertAsync(x === 8, "resolved/then-nohandler-42") }, |
| 119 assertUnreachable |
| 120 ) |
| 121 assertAsyncRan() |
| 122 Promise.accept(9).then({}, assertUnreachable).chain( |
| 123 function(x) { assertAsync(x === 9, "resolved/then-nohandler-object") }, |
| 124 assertUnreachable |
| 125 ) |
| 126 assertAsyncRan() |
| 112 })(); | 127 })(); |
| 113 | 128 |
| 114 (function() { | 129 (function() { |
| 115 Promise.reject(5).then(assertUnreachable, undefined).chain( | 130 Promise.reject(5).then(assertUnreachable, undefined).chain( |
| 116 assertUnreachable, | 131 assertUnreachable, |
| 117 function(r) { assertAsync(r === 5, "rejected/then-nohandler-undefined") } | 132 function(r) { assertAsync(r === 5, "rejected/then-nohandler-undefined") } |
| 118 ) | 133 ) |
| 119 assertAsyncRan() | 134 assertAsyncRan() |
| 120 Promise.reject(6).then(assertUnreachable, null).chain( | 135 Promise.reject(6).then(assertUnreachable, null).chain( |
| 121 assertUnreachable, | 136 assertUnreachable, |
| 122 function(r) { assertAsync(r === 6, "rejected/then-nohandler-null") } | 137 function(r) { assertAsync(r === 6, "rejected/then-nohandler-null") } |
| 123 ) | 138 ) |
| 124 assertAsyncRan() | 139 assertAsyncRan() |
| 140 Promise.reject(7).then(assertUnreachable, false).chain( |
| 141 assertUnreachable, |
| 142 function(r) { assertAsync(r === 7, "rejected/then-nohandler-false") } |
| 143 ) |
| 144 assertAsyncRan() |
| 145 Promise.reject(8).then(assertUnreachable, 42).chain( |
| 146 assertUnreachable, |
| 147 function(r) { assertAsync(r === 8, "rejected/then-nohandler-42") } |
| 148 ) |
| 149 assertAsyncRan() |
| 150 Promise.reject(9).then(assertUnreachable, {}).chain( |
| 151 assertUnreachable, |
| 152 function(r) { assertAsync(r === 9, "rejected/then-nohandler-object") } |
| 153 ) |
| 154 assertAsyncRan() |
| 125 })(); | 155 })(); |
| 126 | 156 |
| 127 (function() { | 157 (function() { |
| 128 var p1 = Promise.accept(5) | 158 var p1 = Promise.accept(5) |
| 129 var p2 = Promise.accept(p1) | 159 var p2 = Promise.accept(p1) |
| 130 var p3 = Promise.accept(p2) | 160 var p3 = Promise.accept(p2) |
| 131 p3.chain( | 161 p3.chain( |
| 132 function(x) { assertAsync(x === p2, "resolved/chain") }, | 162 function(x) { assertAsync(x === p2, "resolved/chain") }, |
| 133 assertUnreachable | 163 assertUnreachable |
| 134 ) | 164 ) |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 Promise.all([11, Promise.accept(12), 13, MyPromise.accept(14), 15, 16]) | 822 Promise.all([11, Promise.accept(12), 13, MyPromise.accept(14), 15, 16]) |
| 793 assertTrue(log === "nx14n", "subclass/all/arg") | 823 assertTrue(log === "nx14n", "subclass/all/arg") |
| 794 | 824 |
| 795 log = "" | 825 log = "" |
| 796 MyPromise.all([21, Promise.accept(22), 23, MyPromise.accept(24), 25, 26]) | 826 MyPromise.all([21, Promise.accept(22), 23, MyPromise.accept(24), 25, 26]) |
| 797 assertTrue(log === "nx24nnx21nnx23nnnx25nnx26n", "subclass/all/self") | 827 assertTrue(log === "nx24nnx21nnx23nnnx25nnx26n", "subclass/all/self") |
| 798 })(); | 828 })(); |
| 799 | 829 |
| 800 | 830 |
| 801 assertAsyncDone() | 831 assertAsyncDone() |
| OLD | NEW |