PromiseThen should ignore non-function parameters.
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
This commit is contained in:
parent
6da637dca8
commit
f40feecb4d
@ -215,9 +215,9 @@ function PromiseHandle(value, handler, deferred) {
|
||||
|
||||
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(
|
||||
|
@ -396,6 +396,30 @@ function assertAsyncDone(iteration) {
|
||||
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
|
||||
|
@ -28,7 +28,5 @@
|
||||
|
||||
[
|
||||
[ALWAYS, {
|
||||
# http://crbug.com/347455
|
||||
'2.2.7': FAIL
|
||||
}], # ALWAYS
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user