Commit 680fc1ec authored by rossberg@chromium.org's avatar rossberg@chromium.org

Promise.all and Promise race should use "then" rather than "chain".

As specified, they should unwrap resolution values recursively.

BUG=347427
LOG=Y
R=rossberg@chromium.org

Review URL: https://codereview.chromium.org/181613006

Patch from Yutaka Hirano <yhirano@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19752 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 48fea83d
...@@ -254,7 +254,7 @@ function PromiseAll(values) { ...@@ -254,7 +254,7 @@ function PromiseAll(values) {
deferred.resolve(resolutions); deferred.resolve(resolutions);
} else { } else {
for (var i = 0; i < values.length; ++i) { for (var i = 0; i < values.length; ++i) {
this.cast(values[i]).chain( this.cast(values[i]).then(
function(i, x) { function(i, x) {
resolutions[i] = x; resolutions[i] = x;
if (--count === 0) deferred.resolve(resolutions); if (--count === 0) deferred.resolve(resolutions);
...@@ -273,7 +273,7 @@ function PromiseOne(values) { ...@@ -273,7 +273,7 @@ function PromiseOne(values) {
var deferred = %_CallFunction(this, PromiseDeferred); var deferred = %_CallFunction(this, PromiseDeferred);
try { try {
for (var i = 0; i < values.length; ++i) { for (var i = 0; i < values.length; ++i) {
this.cast(values[i]).chain( this.cast(values[i]).then(
function(x) { deferred.resolve(x) }, function(x) { deferred.resolve(x) },
function(r) { deferred.reject(r) } function(r) { deferred.reject(r) }
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment