Promise constructor should check argument before [[Construct]]
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Aug 2019 20:09:39 +0000 (20:09 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Aug 2019 20:09:39 +0000 (20:09 +0000)
commit00291824b5761aac09e61dd4450dfbde74fb7d11
tree10ec1bf3f25c10df686de1e545537a247fa60101
parent6b8e1cc7c6b379cba4693e10e2cc197560554490
Promise constructor should check argument before [[Construct]]
https://bugs.webkit.org/show_bug.cgi?id=198976

Patch by Alexey Shvayka <shvaikalesh@gmail.com> on 2019-08-16
Reviewed by Ross Kirsling.

JSTests:

* stress/create-subclass-structure-may-throw-exception-when-getting-prototype.js: Fix test.
* stress/create-subclass-structure-might-throw.js: Fix test.
* test262/expectations.yaml: Mark 2 test cases as passing.

Source/JavaScriptCore:

Check if argument is a function before invoking `createSubclassStructure`.
(step 2 of https://tc39.es/ecma262/#sec-promise-executor)

* builtins/PromiseOperations.js:
(globalPrivate.initializePromise): Remove typeof check.
* runtime/JSPromiseConstructor.cpp:
(JSC::constructPromise): Add isFunction check.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@248787 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JSTests/ChangeLog
JSTests/stress/create-subclass-structure-may-throw-exception-when-getting-prototype.js
JSTests/stress/create-subclass-structure-might-throw.js
JSTests/test262/expectations.yaml
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/builtins/PromiseOperations.js
Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp