| Index: src/promise.js
|
| diff --git a/src/promise.js b/src/promise.js
|
| index f6b7bdff4b29a7af90b3d2ce21bd2712f3752e59..8947670f0669617a4048350848a9a5419bde10e7 100644
|
| --- a/src/promise.js
|
| +++ b/src/promise.js
|
| @@ -261,7 +261,7 @@ function PromiseCoerce(constructor, x) {
|
|
|
| function PromiseCast(x) {
|
| // TODO(rossberg): cannot do better until we support @@create.
|
| - return IsPromise(x) ? x : this.resolve(x);
|
| + return IsPromise(x) ? x : new this(function(resolve) { resolve(x) });
|
| }
|
|
|
| function PromiseAll(values) {
|
| @@ -277,7 +277,7 @@ function PromiseAll(values) {
|
| deferred.resolve(resolutions);
|
| } else {
|
| for (var i = 0; i < values.length; ++i) {
|
| - this.cast(values[i]).then(
|
| + this.resolve(values[i]).then(
|
| function(i, x) {
|
| resolutions[i] = x;
|
| if (--count === 0) deferred.resolve(resolutions);
|
| @@ -300,7 +300,7 @@ function PromiseOne(values) {
|
| }
|
| try {
|
| for (var i = 0; i < values.length; ++i) {
|
| - this.cast(values[i]).then(
|
| + this.resolve(values[i]).then(
|
| function(x) { deferred.resolve(x) },
|
| function(r) { deferred.reject(r) }
|
| );
|
| @@ -319,11 +319,11 @@ function SetUpPromise() {
|
| global_receiver.Promise = $Promise;
|
| InstallFunctions($Promise, DONT_ENUM, [
|
| "defer", PromiseDeferred,
|
| - "resolve", PromiseResolved,
|
| + "accept", PromiseResolved,
|
| "reject", PromiseRejected,
|
| "all", PromiseAll,
|
| "race", PromiseOne,
|
| - "cast", PromiseCast
|
| + "resolve", PromiseCast
|
| ]);
|
| InstallFunctions($Promise.prototype, DONT_ENUM, [
|
| "chain", PromiseChain,
|
|
|