Index: src/js/promise.js |
diff --git a/src/js/promise.js b/src/js/promise.js |
index e1f35fd17d0a2cba20c3ef4b69a2baf2ed76cdc4..466912d5eb6eaba98a8e4d9fe41c90ead55c4667 100644 |
--- a/src/js/promise.js |
+++ b/src/js/promise.js |
@@ -449,6 +449,13 @@ function PromiseResolve(x) { |
} |
if (IsPromise(x) && x.constructor === this) return x; |
+ // Avoid creating resolving functions. |
+ if (this === GlobalPromise) { |
+ var promise = PromiseInit(new GlobalPromise(promiseRawSymbol)); |
+ var resolveResult = ResolvePromise(promise, x); |
+ return promise; |
+ } |
+ |
var promiseCapability = NewPromiseCapability(this); |
var resolveResult = %_Call(promiseCapability.resolve, UNDEFINED, x); |
return promiseCapability.promise; |