Commit 96c6b338 authored by caitpotter88's avatar caitpotter88 Committed by Commit bot

[promise] make builtin resolve functions and executors non-constructors

Fixes a number of test262 tests, including:

- built-ins/Promise/reject-function-nonconstructor.js
- built-ins/Promise/resolve-function-nonconstructor.js
- built-ins/Promise/all/resolve-element-function-nonconstructor.js
- built-ins/Promise/executor-function-nonconstructor.js

BUG=v8:4633
LOG=N
R=adamk@chromium.org, cbruni@chromium.org, littledan@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#33164}
parent 7459d8ce
......@@ -37,13 +37,13 @@ var lastMicrotaskId = 0;
function CreateResolvingFunctions(promise) {
var alreadyResolved = false;
var resolve = function(value) {
var resolve = value => {
if (alreadyResolved === true) return;
alreadyResolved = true;
PromiseResolve(promise, value);
};
var reject = function(reason) {
var reject = reason => {
if (alreadyResolved === true) return;
alreadyResolved = true;
PromiseReject(promise, reason);
......@@ -230,7 +230,7 @@ function NewPromiseCapability(C) {
}
var result = {promise: UNDEFINED, resolve: UNDEFINED, reject: UNDEFINED };
result.promise = new C(function(resolve, reject) {
result.promise = new C((resolve, reject) => {
if (!IS_UNDEFINED(result.resolve) || !IS_UNDEFINED(result.reject))
throw MakeTypeError(kPromiseExecutorAlreadyInvoked);
result.resolve = resolve;
......@@ -348,7 +348,7 @@ function PromiseAll(iterable) {
function CreateResolveElementFunction(index, values, promiseCapability) {
var alreadyCalled = false;
return function(x) {
return (x) => {
if (alreadyCalled === true) return;
alreadyCalled = true;
values[index] = x;
......@@ -394,8 +394,8 @@ function PromiseRace(iterable) {
var deferred = NewPromiseCapability(this);
try {
for (var value of iterable) {
var reject = function(r) { deferred.reject(r) };
this.resolve(value).then(function(x) { deferred.resolve(x) }, reject);
var reject = reason => { deferred.reject(reason); };
this.resolve(value).then((x) => { deferred.resolve(x) }, reject);
SET_PRIVATE(reject, promiseCombinedDeferredSymbol, deferred);
}
} catch (e) {
......
......@@ -413,13 +413,9 @@
# https://bugs.chromium.org/p/v8/issues/detail?id=4633
'built-ins/Promise/reject-function-name': [FAIL],
'built-ins/Promise/reject-function-nonconstructor': [FAIL],
'built-ins/Promise/resolve-function-name': [FAIL],
'built-ins/Promise/resolve-function-nonconstructor': [FAIL],
'built-ins/Promise/all/resolve-element-function-name': [FAIL],
'built-ins/Promise/all/resolve-element-function-nonconstructor': [FAIL],
'built-ins/Promise/executor-function-name': [FAIL],
'built-ins/Promise/executor-function-nonconstructor': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=4634
'built-ins/DataView/prototype/setFloat64/index-check-before-value-conversion': [FAIL],
......
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