Bug 973988 - DOM Promise constructor should call the executor with "undefined" as thisArg. r=bz

This commit is contained in:
William Chen 2014-02-19 10:59:23 -08:00
parent b155fee5b9
commit 6062bcb8be
2 changed files with 10 additions and 2 deletions

View File

@ -482,8 +482,7 @@ Promise::Constructor(const GlobalObject& aGlobal,
return nullptr;
}
aInit.Call(promise, resolveFunc, rejectFunc, aRv,
CallbackObject::eRethrowExceptions);
aInit.Call(resolveFunc, rejectFunc, aRv, CallbackObject::eRethrowExceptions);
aRv.WouldReportJSException();
if (aRv.IsJSException()) {

View File

@ -573,6 +573,14 @@ function promiseStrictHandlers() {
});
}
function promiseStrictExecutorThisArg() {
var promise = new Promise(function(resolve, reject) {
"use strict";
ok(this === undefined, "thisArg should be undefined.");
runTest();
});
}
function promiseResolveArray() {
var p = Promise.resolve([1,2,3]);
ok(p instanceof Promise, "Should return a Promise.");
@ -636,6 +644,7 @@ var tests = [ promiseResolve, promiseReject,
promiseThenableRejectThenResolve,
promiseWithThenReplaced,
promiseStrictHandlers,
promiseStrictExecutorThisArg,
promiseResolveArray,
promiseResolveThenable,
promiseResolvePromise,