Promise.all and Promise race should use "then" rather than "chain".
authorrossberg@chromium.org <rossberg@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 10 Mar 2014 11:52:13 +0000 (11:52 +0000)
committerrossberg@chromium.org <rossberg@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 10 Mar 2014 11:52:13 +0000 (11:52 +0000)
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

src/promise.js

index 82aa99027a1305ac8bf6b95672cccd89504173cd..1f6c3514ac42f52dfa291476c99f3b30395872ce 100644 (file)
@@ -254,7 +254,7 @@ function PromiseAll(values) {
       deferred.resolve(resolutions);
     } else {
       for (var i = 0; i < values.length; ++i) {
-        this.cast(values[i]).chain(
+        this.cast(values[i]).then(
           function(i, x) {
             resolutions[i] = x;
             if (--count === 0) deferred.resolve(resolutions);
@@ -273,7 +273,7 @@ function PromiseOne(values) {
   var deferred = %_CallFunction(this, PromiseDeferred);
   try {
     for (var i = 0; i < values.length; ++i) {
-      this.cast(values[i]).chain(
+      this.cast(values[i]).then(
         function(x) { deferred.resolve(x) },
         function(r) { deferred.reject(r) }
       );