Commit b2a257f9 authored by littledan's avatar littledan Committed by Commit bot

Remove --promise-extra flag

This flag was shipped on in 52, so it's due for removal. The patch includes
removing the deprecated and unused-in-Blink API Promise::Chain, and many
test updates.

R=adamk@chromium.org
BUG=v8:4633

Review-Url: https://codereview.chromium.org/2267033002
Cr-Commit-Position: refs/heads/master@{#38804}
parent ad82a405
......@@ -431,7 +431,6 @@ action("js2c_experimental") {
"src/js/harmony-atomics.js",
"src/js/harmony-simd.js",
"src/js/harmony-string-padding.js",
"src/js/promise-extra.js",
]
outputs = [
......
......@@ -3408,12 +3408,6 @@ class V8_EXPORT Promise : public Object {
* an argument. If the promise is already resolved/rejected, the handler is
* invoked at the end of turn.
*/
V8_DEPRECATED("Use maybe version of Then",
Local<Promise> Chain(Local<Function> handler));
V8_DEPRECATED("Use Then",
V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Chain(
Local<Context> context, Local<Function> handler));
V8_DEPRECATED("Use maybe version",
Local<Promise> Catch(Local<Function> handler));
V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Catch(Local<Context> context,
......
......@@ -6707,36 +6707,6 @@ void Promise::Resolver::Reject(Local<Value> value) {
}
namespace {
MaybeLocal<Promise> DoChain(Value* value, Local<Context> context,
Local<Function> handler) {
PREPARE_FOR_EXECUTION(context, Promise, Chain, Promise);
auto self = Utils::OpenHandle(value);
i::Handle<i::Object> argv[] = {Utils::OpenHandle(*handler)};
i::Handle<i::Object> result;
has_pending_exception = !i::Execution::Call(isolate, isolate->promise_chain(),
self, arraysize(argv), argv)
.ToHandle(&result);
RETURN_ON_FAILED_EXECUTION(Promise);
RETURN_ESCAPED(Local<Promise>::Cast(Utils::ToLocal(result)));
}
} // namespace
MaybeLocal<Promise> Promise::Chain(Local<Context> context,
Local<Function> handler) {
return DoChain(this, context, handler);
}
Local<Promise> Promise::Chain(Local<Function> handler) {
auto context = ContextFromHeapObject(Utils::OpenHandle(this));
RETURN_TO_LOCAL_UNCHECKED(DoChain(this, context, handler), Promise);
}
MaybeLocal<Promise> Promise::Catch(Local<Context> context,
Local<Function> handler) {
PREPARE_FOR_EXECUTION(context, Promise, Catch, Promise);
......
......@@ -209,7 +209,6 @@ class Genesis BASE_EMBEDDED {
HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION)
HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION)
HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION)
DECLARE_FEATURE_INITIALIZATION(promise_extra, "")
DECLARE_FEATURE_INITIALIZATION(intl_extra, "")
#undef DECLARE_FEATURE_INITIALIZATION
......@@ -2177,7 +2176,6 @@ void Genesis::InitializeExperimentalGlobal() {
HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL)
HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL)
HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL)
FEATURE_INITIALIZE_GLOBAL(promise_extra, "")
FEATURE_INITIALIZE_GLOBAL(intl_extra, "")
#undef FEATURE_INITIALIZE_GLOBAL
}
......@@ -2763,7 +2761,6 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_lookbehind)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_named_captures)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_property)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(promise_extra)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(intl_extra)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_explicit_tailcalls)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tailcalls)
......@@ -3351,8 +3348,6 @@ bool Genesis::InstallExperimentalNatives() {
static const char* harmony_regexp_named_captures_natives[] = {nullptr};
static const char* harmony_regexp_property_natives[] = {nullptr};
static const char* harmony_function_sent_natives[] = {nullptr};
static const char* promise_extra_natives[] = {"native promise-extra.js",
nullptr};
static const char* intl_extra_natives[] = {"native intl-extra.js", nullptr};
static const char* harmony_object_values_entries_natives[] = {nullptr};
static const char* harmony_object_own_property_descriptors_natives[] = {
......@@ -3387,7 +3382,6 @@ bool Genesis::InstallExperimentalNatives() {
HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES);
HARMONY_SHIPPING(INSTALL_EXPERIMENTAL_NATIVES);
INSTALL_EXPERIMENTAL_NATIVES(intl_extra, "");
INSTALL_EXPERIMENTAL_NATIVES(promise_extra, "");
#undef INSTALL_EXPERIMENTAL_NATIVES
}
......
......@@ -81,7 +81,6 @@ enum ContextLookupFlags {
V(OBJECT_VALUE_OF, JSFunction, object_value_of) \
V(OBJECT_TO_STRING, JSFunction, object_to_string) \
V(PROMISE_CATCH_INDEX, JSFunction, promise_catch) \
V(PROMISE_CHAIN_INDEX, JSFunction, promise_chain) \
V(PROMISE_CREATE_INDEX, JSFunction, promise_create) \
V(PROMISE_FUNCTION_INDEX, JSFunction, promise_function) \
V(PROMISE_HAS_USER_DEFINED_REJECT_HANDLER_INDEX, JSFunction, \
......
......@@ -184,10 +184,6 @@ DEFINE_BOOL(harmony, false, "enable all completed harmony features")
DEFINE_BOOL(harmony_shipping, true, "enable all shipped harmony features")
DEFINE_IMPLICATION(es_staging, harmony)
DEFINE_BOOL(promise_extra, false, "additional V8 Promise functions")
// Removing extra Promise functions is shipped
DEFINE_NEG_VALUE_IMPLICATION(harmony_shipping, promise_extra, true)
DEFINE_BOOL(intl_extra, false, "additional V8 Intl functions")
// Removing extra Intl functions is shipped
DEFINE_NEG_VALUE_IMPLICATION(harmony_shipping, intl_extra, true)
......
......@@ -199,9 +199,6 @@ function PostNatives(utils) {
"NewPromiseCapability",
"NumberIsInteger",
"PerformPromiseThen",
"PromiseChain",
"PromiseDefer",
"PromiseAccept",
"PromiseCastResolved",
"PromiseThen",
"RegExpSubclassExecJS",
......
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
(function(global, utils) {
"use strict";
%CheckIsBootstrapping();
var GlobalPromise = global.Promise;
var PromiseChain = utils.ImportNow("PromiseChain");
var PromiseDefer = utils.ImportNow("PromiseDefer");
var PromiseAccept = utils.ImportNow("PromiseAccept");
utils.InstallFunctions(GlobalPromise.prototype, DONT_ENUM, [
"chain", PromiseChain,
]);
utils.InstallFunctions(GlobalPromise, DONT_ENUM, [
"defer", PromiseDefer,
"accept", PromiseAccept,
]);
})
......@@ -346,18 +346,6 @@ function NewPromiseCapability(C) {
return result;
}
// Unspecified V8-specific legacy function
function PromiseDefer() {
%IncrementUseCounter(kPromiseDefer);
return NewPromiseCapability(this);
}
// Unspecified V8-specific legacy function
function PromiseAccept(x) {
%IncrementUseCounter(kPromiseAccept);
return %_Call(PromiseResolve, this, x);
}
// ES#sec-promise.reject
// Promise.reject ( x )
function PromiseReject(r) {
......@@ -443,13 +431,6 @@ function PromiseThen(onResolve, onReject) {
return PerformPromiseThen(this, onResolve, onReject, resultCapability);
}
// Unspecified V8-specific legacy function
// Chain is left around for now as an alias for then
function PromiseChain(onResolve, onReject) {
%IncrementUseCounter(kPromiseChain);
return %_Call(PromiseThen, this, onResolve, onReject);
}
// ES#sec-promise.prototype.catch
// Promise.prototype.catch ( onRejected )
function PromiseCatch(onReject) {
......@@ -615,7 +596,6 @@ utils.InstallFunctions(GlobalPromise.prototype, DONT_ENUM, [
%InstallToContext([
"promise_catch", PromiseCatch,
"promise_chain", PromiseChain,
"promise_create", PromiseCreate,
"promise_has_user_defined_reject_handler", PromiseHasUserDefinedRejectHandler,
"promise_reject", RejectPromise,
......@@ -634,15 +614,7 @@ utils.InstallFunctions(extrasUtils, 0, [
"rejectPromise", RejectPromise
]);
// TODO(v8:4567): Allow experimental natives to remove function prototype
[PromiseChain, PromiseDefer, PromiseAccept].forEach(
fn => %FunctionRemovePrototype(fn));
utils.Export(function(to) {
to.PromiseChain = PromiseChain;
to.PromiseDefer = PromiseDefer;
to.PromiseAccept = PromiseAccept;
to.PromiseCastResolved = PromiseCastResolved;
to.PromiseThen = PromiseThen;
......
......@@ -2195,7 +2195,6 @@
'js/harmony-atomics.js',
'js/harmony-simd.js',
'js/harmony-string-padding.js',
'js/promise-extra.js',
'js/harmony-async-await.js'
],
'libraries_bin_file': '<(SHARED_INTERMEDIATE_DIR)/libraries.bin',
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-debug-as debug --promise-extra
// Flags: --expose-debug-as debug
// Test reentry of special try catch for Promises.
......@@ -12,6 +12,6 @@ Debug.setBreakOnUncaughtException();
Debug.setListener(function(event, exec_state, event_data, data) { });
var p = new Promise(function(resolve, reject) { resolve(); });
var q = p.chain(function() {
var q = p.then(function() {
new Promise(function(resolve, reject) { resolve(); });
});
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra
// Flags: --expose-debug-as debug --allow-natives-syntax
// Test debug events when we listen to uncaught exceptions and
// the Promise is rejected in a chained closure after it has been resolved.
......@@ -17,7 +17,7 @@ var p = new Promise(function(resolve, reject) {
resolve(reject);
});
var q = p.chain(
var q = p.then(
function(value) {
assertEquals(["resolve", "end main"], log);
value(new Error("reject"));
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra
// Flags: --expose-debug-as debug --allow-natives-syntax
// Test debug events when we listen to all exceptions and
// there is a catch handler for the to-be-rejected Promise.
......@@ -18,7 +18,7 @@ var p = new Promise(function(resolve, reject) {
resolve();
});
var q = p.chain(
var q = p.then(
function(value) {
log.push("reject");
return Promise.reject(new Error("reject"));
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra
// Flags: --expose-debug-as debug --allow-natives-syntax
// Test debug events when we only listen to uncaught exceptions, the Promise
// is rejected, and a catch handler is installed right before the rejection.
......@@ -14,7 +14,7 @@ var p = new Promise(function(resolve, reject) {
resolve();
});
var q = p.chain(
var q = p.then(
function() {
q.catch(function(e) {
assertEquals("caught", e.message);
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra
// Flags: --expose-debug-as debug --allow-natives-syntax
// Test debug events when we only listen to uncaught exceptions and
// there is a catch handler for the to-be-rejected Promise.
......@@ -14,7 +14,7 @@ var p = new Promise(function(resolve, reject) {
resolve();
});
var q = p.chain(
var q = p.then(
function() {
return Promise.reject(Error("caught reject"));
});
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra
// Flags: --expose-debug-as debug --allow-natives-syntax
// Test debug events when we listen to all exceptions and
// there is a catch handler for the to-be-rejected Promise.
......@@ -18,7 +18,7 @@ var p = new Promise(function(resolve, reject) {
resolve();
});
var q = p.chain(
var q = p.then(
function() {
log.push("reject");
return Promise.reject(new Error("uncaught reject"));
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra
// Flags: --expose-debug-as debug --allow-natives-syntax
// Test debug events when we only listen to uncaught exceptions and
// there is no catch handler for the to-be-rejected Promise.
......@@ -18,7 +18,7 @@ var p = new Promise(function(resolve, reject) {
resolve();
});
var q = p.chain(
var q = p.then(
function() {
log.push("reject");
return Promise.reject(Error("uncaught reject")); // event
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra
// Flags: --expose-debug-as debug --allow-natives-syntax
// Test debug events when a Promise is rejected, which is caught by a custom
// promise, which has a number for reject closure. We expect an Exception debug
......@@ -28,7 +28,7 @@ function MyPromise(resolver) {
MyPromise.prototype = new Promise(function() {});
p.constructor = MyPromise;
var q = p.chain(
var q = p.then(
function() {
log.push("reject caught");
return Promise.reject(new Error("caught"));
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra
// Flags: --expose-debug-as debug --allow-natives-syntax
// Test debug events when a Promise is rejected, which is caught by a
// custom promise, which throws a new exception in its reject handler.
......@@ -33,7 +33,7 @@ function MyPromise(resolver) {
MyPromise.prototype = new Promise(function() {});
p.constructor = MyPromise;
var q = p.chain(
var q = p.then(
function() {
log.push("reject caught");
return Promise.reject(new Error("caught"));
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra
// Flags: --expose-debug-as debug --allow-natives-syntax
// Test debug events when a Promise is rejected, which is caught by a custom
// promise, which has undefined for reject closure. We expect an Exception
......@@ -28,7 +28,7 @@ function MyPromise(resolver) {
MyPromise.prototype = new Promise(function() {});
p.constructor = MyPromise;
var q = p.chain(
var q = p.then(
function() {
log.push("reject caught");
return Promise.reject(new Error("caught"));
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra
// Flags: --expose-debug-as debug --allow-natives-syntax
// Test debug events when we listen to all exceptions and
// there is a catch handler for the exception thrown in a Promise.
......@@ -18,7 +18,7 @@ var p = new Promise(function(resolve, reject) {
resolve();
});
var q = p.chain(
var q = p.then(
function() {
log.push("throw");
throw new Error("caught");
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra
// Flags: --expose-debug-as debug --allow-natives-syntax
// Test debug events when we only listen to uncaught exceptions, the Promise
// throws, and a catch handler is installed right before throwing.
......@@ -14,7 +14,7 @@ var p = new Promise(function(resolve, reject) {
resolve();
});
var q = p.chain(
var q = p.then(
function() {
q.catch(function(e) {
assertEquals("caught", e.message);
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra
// Flags: --expose-debug-as debug --allow-natives-syntax
// Test debug events when we only listen to uncaught exceptions and
// there is a catch handler for the exception thrown in a Promise.
......@@ -14,7 +14,7 @@ var p = new Promise(function(resolve, reject) {
resolve();
});
var q = p.chain(
var q = p.then(
function() {
throw new Error("caught throw");
});
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra
// Flags: --expose-debug-as debug --allow-natives-syntax
// Test debug events when we listen to all exceptions and
// there is a catch handler for the exception thrown in a Promise, first
......@@ -19,7 +19,7 @@ var p = new Promise(function(resolve, reject) {
resolve();
});
var q = p.chain(
var q = p.then(
function() {
log.push("throw");
try {
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra
// Flags: --expose-debug-as debug --allow-natives-syntax
// Test debug events when we listen to all exceptions and
// there is no catch handler for the exception thrown in a Promise.
......@@ -18,7 +18,7 @@ var p = new Promise(function(resolve, reject) {
resolve();
});
var q = p.chain(
var q = p.then(
function() {
log.push("throw");
throw new Error("uncaught"); // event
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra
// Flags: --expose-debug-as debug --allow-natives-syntax
// Test debug events when we only listen to uncaught exceptions and
// there is a catch handler for the exception thrown in a Promise.
......@@ -18,7 +18,7 @@ var p = new Promise(function(resolve, reject) {
resolve();
});
var q = p.chain(
var q = p.then(
function() {
log.push("throw");
throw new Error("uncaught"); // event
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra
// Flags: --expose-debug-as debug --allow-natives-syntax
// Test debug events when an exception is thrown inside a Promise, which is
// caught by a custom promise, which throws a new exception in its reject
......@@ -34,7 +34,7 @@ MyPromise.prototype = new Promise(function() {});
MyPromise.__proto__ = Promise;
p.constructor = MyPromise;
var q = p.chain(
var q = p.then(
function() {
log.push("throw caught");
throw new Error("caught"); // event
......
......@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --promise-extra
'use strict';
Object.defineProperties(Object.prototype, {
......@@ -16,4 +14,3 @@ class P extends Promise {}
P.all([Promise.resolve('ok')]);
P.race([Promise.resolve('ok')]);
P.defer();
......@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax --promise-extra
// Flags: --allow-natives-syntax
// Make sure we don't rely on functions patchable by monkeys.
var call = Function.prototype.call.call.bind(Function.prototype.call)
......@@ -82,6 +82,12 @@ for (var i in globals) {
}
function defer(constructor) {
var resolve, reject;
var promise = new constructor((res, rej) => { resolve = res; reject = rej });
return { promise, resolve, reject };
}
var asyncAssertsExpected = 0;
function assertAsyncRan() { ++asyncAssertsExpected }
......@@ -141,7 +147,7 @@ function assertAsyncDone(iteration) {
})();
(function() {
(new Promise(function() { throw 5 })).chain(
(new Promise(function() { throw 5 })).then(
assertUnreachable,
function(r) { assertAsync(r === 5, "new-throw") }
)
......@@ -149,29 +155,21 @@ function assertAsyncDone(iteration) {
})();
(function() {
Promise.accept(5);
Promise.accept(5).chain(undefined, assertUnreachable).chain(
function(x) { assertAsync(x === 5, "resolved/chain-nohandler") },
Promise.resolve(5);
Promise.resolve(5).then(undefined, assertUnreachable).then(
function(x) { assertAsync(x === 5, "resolved/then-nohandler") },
assertUnreachable
)
assertAsyncRan()
})();
(function() {
Promise.reject(5).chain(assertUnreachable, undefined).chain(
assertUnreachable,
function(r) { assertAsync(r === 5, "rejected/chain-nohandler") }
)
assertAsyncRan()
})();
(function() {
Promise.accept(5).then(undefined, assertUnreachable).chain(
Promise.resolve(5).then(undefined, assertUnreachable).then(
function(x) { assertAsync(x === 5, "resolved/then-nohandler-undefined") },
assertUnreachable
)
assertAsyncRan()
Promise.accept(6).then(null, assertUnreachable).chain(
Promise.resolve(6).then(null, assertUnreachable).then(
function(x) { assertAsync(x === 6, "resolved/then-nohandler-null") },
assertUnreachable
)
......@@ -179,34 +177,9 @@ function assertAsyncDone(iteration) {
})();
(function() {
Promise.reject(5).then(assertUnreachable, undefined).chain(
assertUnreachable,
function(r) { assertAsync(r === 5, "rejected/then-nohandler-undefined") }
)
assertAsyncRan()
Promise.reject(6).then(assertUnreachable, null).chain(
assertUnreachable,
function(r) { assertAsync(r === 6, "rejected/then-nohandler-null") }
)
assertAsyncRan()
})();
(function() {
var p1 = Promise.accept(5)
var p2 = Promise.accept(p1)
var p3 = Promise.accept(p2)
// Note: Chain now has then-style semantics, here and in future tests.
p3.chain(
function(x) { assertAsync(x === 5, "resolved/chain") },
assertUnreachable
)
assertAsyncRan()
})();
(function() {
var p1 = Promise.accept(5)
var p2 = Promise.accept(p1)
var p3 = Promise.accept(p2)
var p1 = Promise.resolve(5)
var p2 = Promise.resolve(p1)
var p3 = Promise.resolve(p2)
p3.then(
function(x) { assertAsync(x === 5, "resolved/then") },
assertUnreachable
......@@ -216,19 +189,8 @@ function assertAsyncDone(iteration) {
(function() {
var p1 = Promise.reject(5)
var p2 = Promise.accept(p1)
var p3 = Promise.accept(p2)
p3.chain(
assertUnreachable,
function(x) { assertAsync(x === 5, "rejected/chain") }
)
assertAsyncRan()
})();
(function() {
var p1 = Promise.reject(5)
var p2 = Promise.accept(p1)
var p3 = Promise.accept(p2)
var p2 = Promise.resolve(p1)
var p3 = Promise.resolve(p2)
p3.then(
assertUnreachable,
function(x) { assertAsync(x === 5, "rejected/then") }
......@@ -237,87 +199,21 @@ function assertAsyncDone(iteration) {
})();
(function() {
var p1 = Promise.accept(5)
var p2 = Promise.accept(p1)
var p3 = Promise.accept(p2)
p3.chain(function(x) { return x }, assertUnreachable).chain(
function(x) { assertAsync(x === 5, "resolved/chain/chain") },
assertUnreachable
)
assertAsyncRan()
})();
(function() {
var p1 = Promise.accept(5)
var p2 = Promise.accept(p1)
var p3 = Promise.accept(p2)
p3.chain(function(x) { return x }, assertUnreachable).then(
function(x) { assertAsync(x === 5, "resolved/chain/then") },
assertUnreachable
)
assertAsyncRan()
})();
(function() {
var p1 = Promise.accept(5)
var p2 = Promise.accept(p1)
var p3 = Promise.accept(p2)
p3.chain(function(x) { return 6 }, assertUnreachable).chain(
function(x) { assertAsync(x === 6, "resolved/chain/chain2") },
assertUnreachable
)
assertAsyncRan()
})();
(function() {
var p1 = Promise.accept(5)
var p2 = Promise.accept(p1)
var p3 = Promise.accept(p2)
p3.chain(function(x) { return 6 }, assertUnreachable).then(
function(x) { assertAsync(x === 6, "resolved/chain/then2") },
assertUnreachable
)
assertAsyncRan()
})();
(function() {
var p1 = Promise.accept(5)
var p2 = Promise.accept(p1)
var p3 = Promise.accept(p2)
p3.then(function(x) { return x + 1 }, assertUnreachable).chain(
function(x) { assertAsync(x === 6, "resolved/then/chain") },
assertUnreachable
)
assertAsyncRan()
})();
(function() {
var p1 = Promise.accept(5)
var p2 = Promise.accept(p1)
var p3 = Promise.accept(p2)
p3.then(function(x) { return x + 1 }, assertUnreachable).then(
function(x) { assertAsync(x === 6, "resolved/then/then") },
assertUnreachable
)
assertAsyncRan()
})();
(function() {
var p1 = Promise.accept(5)
var p2 = Promise.accept(p1)
var p3 = Promise.accept(p2)
p3.then(function(x){ return Promise.accept(x+1) }, assertUnreachable).chain(
function(x) { assertAsync(x === 6, "resolved/then/chain2") },
var p1 = Promise.resolve(5)
var p2 = Promise.resolve(p1)
var p3 = Promise.resolve(p2)
p3.then(function(x) { return x }, assertUnreachable).then(
function(x) { assertAsync(x === 5, "resolved/then/then") },
assertUnreachable
)
assertAsyncRan()
})();
(function() {
var p1 = Promise.accept(5)
var p2 = Promise.accept(p1)
var p3 = Promise.accept(p2)
p3.then(function(x) { return Promise.accept(x+1) }, assertUnreachable).then(
var p1 = Promise.resolve(5)
var p2 = Promise.resolve(p1)
var p3 = Promise.resolve(p2)
p3.then(function(x){ return Promise.resolve(x+1) }, assertUnreachable).then(
function(x) { assertAsync(x === 6, "resolved/then/then2") },
assertUnreachable
)
......@@ -325,42 +221,42 @@ function assertAsyncDone(iteration) {
})();
(function() {
var p1 = Promise.accept(5)
var p2 = Promise.accept(p1)
var p3 = Promise.accept(p2)
p3.chain(function(x) { throw 6 }, assertUnreachable).chain(
var p1 = Promise.resolve(5)
var p2 = Promise.resolve(p1)
var p3 = Promise.resolve(p2)
p3.then(function(x) { throw 6 }, assertUnreachable).then(
assertUnreachable,
function(x) { assertAsync(x === 6, "resolved/chain-throw/chain") }
function(x) { assertAsync(x === 6, "resolved/then-throw/then") }
)
assertAsyncRan()
})();
(function() {
var p1 = Promise.accept(5)
var p2 = Promise.accept(p1)
var p3 = Promise.accept(p2)
p3.chain(function(x) { throw 6 }, assertUnreachable).then(
var p1 = Promise.resolve(5)
var p2 = Promise.resolve(p1)
var p3 = Promise.resolve(p2)
p3.then(function(x) { throw 6 }, assertUnreachable).then(
assertUnreachable,
function(x) { assertAsync(x === 6, "resolved/chain-throw/then") }
function(x) { assertAsync(x === 6, "resolved/then-throw/then") }
)
assertAsyncRan()
})();
(function() {
var p1 = Promise.accept(5)
var p2 = Promise.accept(p1)
var p3 = Promise.accept(p2)
p3.then(function(x) { throw 6 }, assertUnreachable).chain(
var p1 = Promise.resolve(5)
var p2 = Promise.resolve(p1)
var p3 = Promise.resolve(p2)
p3.then(function(x) { throw 6 }, assertUnreachable).then(
assertUnreachable,
function(x) { assertAsync(x === 6, "resolved/then-throw/chain") }
function(x) { assertAsync(x === 6, "resolved/then-throw/then") }
)
assertAsyncRan()
})();
(function() {
var p1 = Promise.accept(5)
var p2 = Promise.accept(p1)
var p3 = Promise.accept(p2)
var p1 = Promise.resolve(5)
var p2 = Promise.resolve(p1)
var p3 = Promise.resolve(p2)
p3.then(function(x) { throw 6 }, assertUnreachable).then(
assertUnreachable,
function(x) { assertAsync(x === 6, "resolved/then-throw/then") }
......@@ -369,20 +265,20 @@ function assertAsyncDone(iteration) {
})();
(function() {
var p1 = Promise.accept(5)
var p1 = Promise.resolve(5)
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }}
var p3 = Promise.accept(p2)
p3.chain(
function(x) { assertAsync(x === 5, "resolved/thenable/chain") },
var p3 = Promise.resolve(p2)
p3.then(
function(x) { assertAsync(x === 5, "resolved/thenable/then") },
assertUnreachable
)
assertAsyncRan()
})();
(function() {
var p1 = Promise.accept(5)
var p1 = Promise.resolve(5)
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }}
var p3 = Promise.accept(p2)
var p3 = Promise.resolve(p2)
p3.then(
function(x) { assertAsync(x === 5, "resolved/thenable/then") },
assertUnreachable
......@@ -393,10 +289,10 @@ function assertAsyncDone(iteration) {
(function() {
var p1 = Promise.reject(5)
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }}
var p3 = Promise.accept(p2)
p3.chain(
var p3 = Promise.resolve(p2)
p3.then(
assertUnreachable,
function(x) { assertAsync(x === 5, "rejected/thenable/chain") }
function(x) { assertAsync(x === 5, "rejected/thenable/then") }
)
assertAsyncRan()
})();
......@@ -404,7 +300,7 @@ function assertAsyncDone(iteration) {
(function() {
var p1 = Promise.reject(5)
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }}
var p3 = Promise.accept(p2)
var p3 = Promise.resolve(p2)
p3.then(
assertUnreachable,
function(x) { assertAsync(x === 5, "rejected/thenable/then") }
......@@ -413,12 +309,12 @@ function assertAsyncDone(iteration) {
})();
(function() {
var deferred = Promise.defer()
var deferred = defer(Promise)
var p1 = deferred.promise
var p2 = Promise.accept(p1)
var p3 = Promise.accept(p2)
p3.chain(
function(x) { assertAsync(x === 5, "chain/resolve") },
var p2 = Promise.resolve(p1)
var p3 = Promise.resolve(p2)
p3.then(
function(x) { assertAsync(x === 5, "then/resolve") },
assertUnreachable
)
deferred.resolve(5)
......@@ -426,7 +322,7 @@ function assertAsyncDone(iteration) {
})();
(function() {
var deferred = Promise.defer()
var deferred = defer(Promise)
var p1 = deferred.promise
var p2 = Promise.resolve(p1)
var p3 = Promise.resolve(p2)
......@@ -439,23 +335,23 @@ function assertAsyncDone(iteration) {
})();
(function() {
var deferred = Promise.defer()
var deferred = defer(Promise)
var p1 = deferred.promise
var p2 = Promise.accept(p1)
var p3 = Promise.accept(p2)
p3.chain(
var p2 = Promise.resolve(p1)
var p3 = Promise.resolve(p2)
p3.then(
assertUnreachable,
function(x) { assertAsync(x === 5, "chain/reject") }
function(x) { assertAsync(x === 5, "then/reject") }
)
deferred.reject(5)
assertAsyncRan()
})();
(function() {
var deferred = Promise.defer()
var deferred = defer(Promise)
var p1 = deferred.promise
var p2 = Promise.accept(p1)
var p3 = Promise.accept(p2)
var p2 = Promise.resolve(p1)
var p3 = Promise.resolve(p2)
p3.then(
assertUnreachable,
function(x) { assertAsync(x === 5, "then/reject") }
......@@ -465,7 +361,7 @@ function assertAsyncDone(iteration) {
})();
(function() {
var deferred = Promise.defer()
var deferred = defer(Promise)
var p1 = deferred.promise
var p2 = p1.then(1, 2)
p2.then(
......@@ -477,7 +373,7 @@ function assertAsyncDone(iteration) {
})();
(function() {
var deferred = Promise.defer()
var deferred = defer(Promise)
var p1 = deferred.promise
var p2 = p1.then(1, 2)
p2.then(
......@@ -489,12 +385,12 @@ function assertAsyncDone(iteration) {
})();
(function() {
var deferred = Promise.defer()
var deferred = defer(Promise)
var p1 = deferred.promise
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }}
var p3 = Promise.accept(p2)
p3.chain(
function(x) { assertAsync(x === 5, "chain/resolve/thenable") },
var p3 = Promise.resolve(p2)
p3.then(
function(x) { assertAsync(x === 5, "then/resolve/thenable") },
assertUnreachable
)
deferred.resolve(5)
......@@ -502,10 +398,10 @@ function assertAsyncDone(iteration) {
})();
(function() {
var deferred = Promise.defer()
var deferred = defer(Promise)
var p1 = deferred.promise
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }}
var p3 = Promise.accept(p2)
var p3 = Promise.resolve(p2)
p3.then(
function(x) { assertAsync(x === 5, "then/resolve/thenable") },
assertUnreachable
......@@ -515,23 +411,23 @@ function assertAsyncDone(iteration) {
})();
(function() {
var deferred = Promise.defer()
var deferred = defer(Promise)
var p1 = deferred.promise
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }}
var p3 = Promise.accept(p2)
p3.chain(
var p3 = Promise.resolve(p2)
p3.then(
assertUnreachable,
function(x) { assertAsync(x === 5, "chain/reject/thenable") }
function(x) { assertAsync(x === 5, "then/reject/thenable") }
)
deferred.reject(5)
assertAsyncRan()
})();
(function() {
var deferred = Promise.defer()
var deferred = defer(Promise)
var p1 = deferred.promise
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }}
var p3 = Promise.accept(p2)
var p3 = Promise.resolve(p2)
p3.then(
assertUnreachable,
function(x) { assertAsync(x === 5, "then/reject/thenable") }
......@@ -541,12 +437,12 @@ function assertAsyncDone(iteration) {
})();
(function() {
var p1 = Promise.accept(5)
var p2 = Promise.accept(p1)
var deferred = Promise.defer()
var p1 = Promise.resolve(5)
var p2 = Promise.resolve(p1)
var deferred = defer(Promise)
var p3 = deferred.promise
p3.chain(
function(x) { assertAsync(x === 5, "chain/resolve2") },
p3.then(
function(x) { assertAsync(x === 5, "then/resolve2") },
assertUnreachable
)
deferred.resolve(p2)
......@@ -554,9 +450,9 @@ function assertAsyncDone(iteration) {
})();
(function() {
var p1 = Promise.accept(5)
var p2 = Promise.accept(p1)
var deferred = Promise.defer()
var p1 = Promise.resolve(5)
var p2 = Promise.resolve(p1)
var deferred = defer(Promise)
var p3 = deferred.promise
p3.then(
function(x) { assertAsync(x === 5, "then/resolve2") },
......@@ -567,22 +463,22 @@ function assertAsyncDone(iteration) {
})();
(function() {
var p1 = Promise.accept(5)
var p2 = Promise.accept(p1)
var deferred = Promise.defer()
var p1 = Promise.resolve(5)
var p2 = Promise.resolve(p1)
var deferred = defer(Promise)
var p3 = deferred.promise
p3.chain(
p3.then(
assertUnreachable,
function(x) { assertAsync(x === 5, "chain/reject2") }
function(x) { assertAsync(x === 5, "then/reject2") }
)
deferred.reject(5)
assertAsyncRan()
})();
(function() {
var p1 = Promise.accept(5)
var p2 = Promise.accept(p1)
var deferred = Promise.defer()
var p1 = Promise.resolve(5)
var p2 = Promise.resolve(p1)
var deferred = defer(Promise)
var p3 = deferred.promise
p3.then(
assertUnreachable,
......@@ -593,12 +489,12 @@ function assertAsyncDone(iteration) {
})();
(function() {
var p1 = Promise.accept(5)
var p1 = Promise.resolve(5)
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }}
var deferred = Promise.defer()
var deferred = defer(Promise)
var p3 = deferred.promise
p3.chain(
function(x) { assertAsync(x === 5, "chain/resolve/thenable2") },
p3.then(
function(x) { assertAsync(x === 5, "then/resolve/thenable2") },
assertUnreachable
)
deferred.resolve(p2)
......@@ -606,9 +502,9 @@ function assertAsyncDone(iteration) {
})();
(function() {
var p1 = Promise.accept(5)
var p1 = Promise.resolve(5)
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }}
var deferred = Promise.defer()
var deferred = defer(Promise)
var p3 = deferred.promise
p3.then(
function(x) { assertAsync(x === 5, "then/resolve/thenable2") },
......@@ -619,19 +515,19 @@ function assertAsyncDone(iteration) {
})();
(function() {
var p1 = Promise.accept(0)
var p2 = p1.chain(function(x) { return p2 }, assertUnreachable)
p2.chain(
var p1 = Promise.resolve(0)
var p2 = p1.then(function(x) { return p2 }, assertUnreachable)
p2.then(
assertUnreachable,
function(r) { assertAsync(r instanceof TypeError, "cyclic/chain") }
function(r) { assertAsync(r instanceof TypeError, "cyclic/then") }
)
assertAsyncRan()
})();
(function() {
var p1 = Promise.accept(0)
var p1 = Promise.resolve(0)
var p2 = p1.then(function(x) { return p2 }, assertUnreachable)
p2.chain(
p2.then(
assertUnreachable,
function(r) { assertAsync(r instanceof TypeError, "cyclic/then") }
)
......@@ -639,10 +535,10 @@ function assertAsyncDone(iteration) {
})();
(function() {
var deferred = Promise.defer()
var deferred = defer(Promise)
var p = deferred.promise
deferred.resolve(p)
p.chain(
p.then(
assertUnreachable,
function(r) { assertAsync(r instanceof TypeError, "cyclic/deferred/then") }
)
......@@ -650,7 +546,7 @@ function assertAsyncDone(iteration) {
})();
(function() {
var deferred = Promise.defer()
var deferred = defer(Promise)
var p = deferred.promise
deferred.resolve(p)
p.then(
......@@ -661,7 +557,7 @@ function assertAsyncDone(iteration) {
})();
(function() {
Promise.all([]).chain(
Promise.all([]).then(
function(x) { assertAsync(x.length === 0, "all/resolve/empty") },
assertUnreachable
)
......@@ -670,7 +566,7 @@ function assertAsyncDone(iteration) {
(function() {
function testPromiseAllNonIterable(value) {
Promise.all(value).chain(
Promise.all(value).then(
assertUnreachable,
function(r) {
assertAsync(r instanceof TypeError, 'all/non iterable');
......@@ -684,14 +580,14 @@ function assertAsyncDone(iteration) {
})();
(function() {
var deferred = Promise.defer();
var deferred = defer(Promise);
var p = deferred.promise;
function* f() {
yield 1;
yield p;
yield 3;
}
Promise.all(f()).chain(
Promise.all(f()).then(
function(x) {
assertAsync(x.length === 3, "all/resolve/iterable");
assertAsync(x[0] === 1, "all/resolve/iterable/0");
......@@ -708,13 +604,13 @@ function assertAsyncDone(iteration) {
(function() {
var deferred1 = Promise.defer()
var deferred1 = defer(Promise)
var p1 = deferred1.promise
var deferred2 = Promise.defer()
var deferred2 = defer(Promise)
var p2 = deferred2.promise
var deferred3 = Promise.defer()
var deferred3 = defer(Promise)
var p3 = deferred3.promise
Promise.all([p1, p2, p3]).chain(
Promise.all([p1, p2, p3]).then(
function(x) {
assertAsync(x.length === 3, "all/resolve")
assertAsync(x[0] === 1, "all/resolve/0")
......@@ -733,11 +629,11 @@ function assertAsyncDone(iteration) {
})();
(function() {
var deferred = Promise.defer()
var deferred = defer(Promise)
var p1 = deferred.promise
var p2 = Promise.accept(2)
var p3 = Promise.defer().promise
Promise.all([p1, p2, p3]).chain(
var p2 = Promise.resolve(2)
var p3 = defer(Promise).promise
Promise.all([p1, p2, p3]).then(
assertUnreachable,
assertUnreachable
)
......@@ -745,13 +641,13 @@ function assertAsyncDone(iteration) {
})();
(function() {
var deferred1 = Promise.defer()
var deferred1 = defer(Promise)
var p1 = deferred1.promise
var deferred2 = Promise.defer()
var deferred2 = defer(Promise)
var p2 = deferred2.promise
var deferred3 = Promise.defer()
var deferred3 = defer(Promise)
var p3 = deferred3.promise
Promise.all([p1, p2, p3]).chain(
Promise.all([p1, p2, p3]).then(
assertUnreachable,
function(x) { assertAsync(x === 2, "all/reject") }
)
......@@ -786,7 +682,7 @@ function assertAsyncDone(iteration) {
configurable: true
});
Promise.all(3).chain(
Promise.all(3).then(
function(x) {
assertAsync(x.length === 3, "all/iterable/number/length");
assertAsync(x[0] === 0, "all/iterable/number/0");
......@@ -807,17 +703,17 @@ function assertAsyncDone(iteration) {
(function() {
Promise.race([]).chain(
Promise.race([]).then(
assertUnreachable,
assertUnreachable
)
})();
(function() {
var p1 = Promise.accept(1)
var p2 = Promise.accept(2)
var p3 = Promise.accept(3)
Promise.race([p1, p2, p3]).chain(
var p1 = Promise.resolve(1)
var p2 = Promise.resolve(2)
var p3 = Promise.resolve(3)
Promise.race([p1, p2, p3]).then(
function(x) { assertAsync(x === 1, "resolved/one") },
assertUnreachable
)
......@@ -825,10 +721,10 @@ function assertAsyncDone(iteration) {
})();
(function() {
var p1 = Promise.accept(1)
var p2 = Promise.accept(2)
var p3 = Promise.accept(3)
Promise.race([0, p1, p2, p3]).chain(
var p1 = Promise.resolve(1)
var p2 = Promise.resolve(2)
var p3 = Promise.resolve(3)
Promise.race([0, p1, p2, p3]).then(
function(x) { assertAsync(x === 0, "resolved-const/one") },
assertUnreachable
)
......@@ -836,13 +732,13 @@ function assertAsyncDone(iteration) {
})();
(function() {
var deferred1 = Promise.defer()
var deferred1 = defer(Promise)
var p1 = deferred1.promise
var deferred2 = Promise.defer()
var deferred2 = defer(Promise)
var p2 = deferred2.promise
var deferred3 = Promise.defer()
var deferred3 = defer(Promise)
var p3 = deferred3.promise
Promise.race([p1, p2, p3]).chain(
Promise.race([p1, p2, p3]).then(
function(x) { assertAsync(x === 3, "one/resolve") },
assertUnreachable
)
......@@ -852,11 +748,11 @@ function assertAsyncDone(iteration) {
})();
(function() {
var deferred = Promise.defer()
var deferred = defer(Promise)
var p1 = deferred.promise
var p2 = Promise.accept(2)
var p3 = Promise.defer().promise
Promise.race([p1, p2, p3]).chain(
var p2 = Promise.resolve(2)
var p3 = defer(Promise).promise
Promise.race([p1, p2, p3]).then(
function(x) { assertAsync(x === 2, "resolved/one") },
assertUnreachable
)
......@@ -865,13 +761,13 @@ function assertAsyncDone(iteration) {
})();
(function() {
var deferred1 = Promise.defer()
var deferred1 = defer(Promise)
var p1 = deferred1.promise
var deferred2 = Promise.defer()
var deferred2 = defer(Promise)
var p2 = deferred2.promise
var deferred3 = Promise.defer()
var deferred3 = defer(Promise)
var p3 = deferred3.promise
Promise.race([p1, p2, p3]).chain(
Promise.race([p1, p2, p3]).then(
function(x) { assertAsync(x === 3, "one/resolve/reject") },
assertUnreachable
)
......@@ -881,13 +777,13 @@ function assertAsyncDone(iteration) {
})();
(function() {
var deferred1 = Promise.defer()
var deferred1 = defer(Promise)
var p1 = deferred1.promise
var deferred2 = Promise.defer()
var deferred2 = defer(Promise)
var p2 = deferred2.promise
var deferred3 = Promise.defer()
var deferred3 = defer(Promise)
var p3 = deferred3.promise
Promise.race([p1, p2, p3]).chain(
Promise.race([p1, p2, p3]).then(
assertUnreachable,
function(x) { assertAsync(x === 3, "one/reject/resolve") }
)
......@@ -899,7 +795,7 @@ function assertAsyncDone(iteration) {
(function() {
function testPromiseRaceNonIterable(value) {
Promise.race(value).chain(
Promise.race(value).then(
assertUnreachable,
function(r) {
assertAsync(r instanceof TypeError, 'race/non iterable');
......@@ -914,18 +810,18 @@ function assertAsyncDone(iteration) {
(function() {
var deferred1 = Promise.defer()
var deferred1 = defer(Promise)
var p1 = deferred1.promise
var deferred2 = Promise.defer()
var deferred2 = defer(Promise)
var p2 = deferred2.promise
var deferred3 = Promise.defer()
var deferred3 = defer(Promise)
var p3 = deferred3.promise
function* f() {
yield p1;
yield p2;
yield p3;
}
Promise.race(f()).chain(
Promise.race(f()).then(
function(x) { assertAsync(x === 3, "race/iterable/resolve/reject") },
assertUnreachable
)
......@@ -935,18 +831,18 @@ function assertAsyncDone(iteration) {
})();
(function() {
var deferred1 = Promise.defer()
var deferred1 = defer(Promise)
var p1 = deferred1.promise
var deferred2 = Promise.defer()
var deferred2 = defer(Promise)
var p2 = deferred2.promise
var deferred3 = Promise.defer()
var deferred3 = defer(Promise)
var p3 = deferred3.promise
function* f() {
yield p1;
yield p2;
yield p3;
}
Promise.race(f()).chain(
Promise.race(f()).then(
assertUnreachable,
function(x) { assertAsync(x === 3, "race/iterable/reject/resolve") }
)
......@@ -980,7 +876,7 @@ function assertAsyncDone(iteration) {
configurable: true
});
Promise.race(3).chain(
Promise.race(3).then(
function(x) {
assertAsync(x === 0, "race/iterable/number");
},
......@@ -1014,18 +910,18 @@ function assertAsyncDone(iteration) {
}
MyPromise.prototype.__proto__ = Promise.prototype
MyPromise.prototype.chain = function(resolve, reject) {
MyPromise.prototype.then = function(resolve, reject) {
log += "c"
return call(this.__proto__.__proto__.chain, this, resolve, reject)
return call(this.__proto__.__proto__.then, this, resolve, reject)
}
log = ""
var p1 = new MyPromise(function(resolve, reject) { resolve(1) })
var p2 = new MyPromise(function(resolve, reject) { reject(2) })
var d3 = MyPromise.defer()
var d3 = defer(MyPromise)
assertTrue(d3.promise instanceof Promise, "subclass/instance")
assertTrue(d3.promise instanceof MyPromise, "subclass/instance-my3")
assertTrue(log === "nx1nr2dn", "subclass/create")
assertTrue(log === "nx1nr2n", "subclass/create")
log = ""
var p4 = MyPromise.resolve(4)
......@@ -1038,21 +934,21 @@ function assertAsyncDone(iteration) {
assertTrue(log === "nx4nr5x3", "subclass/resolve")
log = ""
var d6 = MyPromise.defer()
d6.promise.chain(function(x) {
var d6 = defer(MyPromise)
d6.promise.then(function(x) {
return new Promise(function(resolve) { resolve(x) })
}).chain(function() {})
}).then(function() {})
d6.resolve(6)
assertTrue(log === "dncncnx6", "subclass/chain")
assertTrue(log === "ncncnx6", "subclass/then")
log = ""
Promise.all([11, Promise.accept(12), 13, MyPromise.accept(14), 15, 16])
Promise.all([11, Promise.resolve(12), 13, MyPromise.resolve(14), 15, 16])
assertTrue(log === "nx14", "subclass/all/arg")
log = ""
MyPromise.all([21, Promise.accept(22), 23, MyPromise.accept(24), 25, 26])
assertTrue(log === "nx24nnx21nnx[object Promise]nnx23nnnx25nnx26n",
MyPromise.all([21, Promise.resolve(22), 23, MyPromise.resolve(24), 25, 26])
assertTrue(log === "nx24nnx21cnnx[object Promise]cnnx23cncnnx25cnnx26cn",
"subclass/all/self")
})();
......
......@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax --promise-extra
// Flags: --allow-natives-syntax
var x = 0;
var y = 0;
......@@ -38,7 +38,7 @@ for (var i = 0; i < 3; ++i) {
assertEquals(0, x);
(function check() {
Promise.resolve().chain(function() {
Promise.resolve().then(function() {
// Delay check until all handlers have run.
if (y < 3) check(); else assertEquals(6, x);
}).catch(function(e) { %AbortJS("FAILURE: " + e) });
......
......@@ -518,7 +518,7 @@
##############################################################################
['system == windows', {
# TODO(mstarzinger): Too slow with turbo fan.
'big-object-literal': [PASS, ['mode == debug', SKIP]],
'big-object-literal': [SKIP],
'math-floor-of-div': [PASS, ['mode == debug', SKIP]],
'math-floor-of-div-nosudiv': [PASS, ['mode == debug', SKIP]],
'unicodelctest': [PASS, ['mode == debug', SKIP]],
......
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