When non-function parameters are given, PromiseThen should work as if
undefined parameters were given.
BUG=347455
LOG=Y
R=rossberg@chromium.org
Review URL: https://codereview.chromium.org/
180723011
Patch from Yutaka Hirano <yhirano@chromium.org>.
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@21025
ce2b1a6d-e550-0410-aec6-
3dcde31c8c00
function PromiseThen(onResolve, onReject) {
onResolve =
- IS_NULL_OR_UNDEFINED(onResolve) ? PromiseIdResolveHandler : onResolve;
+ IS_SPEC_FUNCTION(onResolve) ? onResolve : PromiseIdResolveHandler;
onReject =
- IS_NULL_OR_UNDEFINED(onReject) ? PromiseIdRejectHandler : onReject;
+ IS_SPEC_FUNCTION(onReject) ? onReject : PromiseIdRejectHandler;
var that = this;
var constructor = this.constructor;
return %_CallFunction(
assertAsyncRan()
})();
+(function() {
+ var deferred = Promise.defer()
+ var p1 = deferred.promise
+ var p2 = p1.then(1, 2)
+ p2.then(
+ function(x) { assertAsync(x === 5, "then/resolve-non-function") },
+ assertUnreachable
+ )
+ deferred.resolve(5)
+ assertAsyncRan()
+})();
+
+(function() {
+ var deferred = Promise.defer()
+ var p1 = deferred.promise
+ var p2 = p1.then(1, 2)
+ p2.then(
+ assertUnreachable,
+ function(x) { assertAsync(x === 5, "then/reject-non-function") }
+ )
+ deferred.reject(5)
+ assertAsyncRan()
+})();
+
(function() {
var deferred = Promise.defer()
var p1 = deferred.promise
[
[ALWAYS, {
- # http://crbug.com/347455
- '2.2.7': FAIL
}], # ALWAYS
]