WebKit Bugzilla
Attachment 372377 Details for
Bug 198976
: Promise constructor should check argument before [[Construct]]
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-198976-20190618235229.patch (text/plain), 4.21 KB, created by
Alexey Shvayka
on 2019-06-18 13:52:31 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alexey Shvayka
Created:
2019-06-18 13:52:31 PDT
Size:
4.21 KB
patch
obsolete
>Index: JSTests/ChangeLog >=================================================================== >--- JSTests/ChangeLog (revision 246562) >+++ JSTests/ChangeLog (working copy) >@@ -1,3 +1,12 @@ >+2019-06-18 Alexey Shvayka <shvaikalesh@gmail.com> >+ >+ Promise constructor should check argument before [[Construct]] >+ https://bugs.webkit.org/show_bug.cgi?id=198976 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * test262/expectations.yaml: Mark 2 test cases as passing. >+ > 2019-06-18 Tadeu Zagallo <tzagallo@apple.com> > > DFG code should not reify the names of builtin functions with private names >Index: JSTests/test262/expectations.yaml >=================================================================== >--- JSTests/test262/expectations.yaml (revision 246561) >+++ JSTests/test262/expectations.yaml (working copy) >@@ -1122,9 +1122,6 @@ test/built-ins/Promise/allSettled/reject > test/built-ins/Promise/allSettled/resolve-element-function-nonconstructor.js: > default: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all' > strict mode: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all' >-test/built-ins/Promise/get-prototype-abrupt-executor-not-callable.js: >- default: 'Test262Error: Expected a TypeError but got a Test262Error' >- strict mode: 'Test262Error: Expected a TypeError but got a Test262Error' > test/built-ins/Promise/proto-from-ctor-realm.js: > default: 'Test262Error: Expected SameValue(ë[object Promise]û, ë[object Promise]û) to be true' > strict mode: 'Test262Error: Expected SameValue(ë[object Promise]û, ë[object Promise]û) to be true' >Index: Source/JavaScriptCore/ChangeLog >=================================================================== >--- Source/JavaScriptCore/ChangeLog (revision 246561) >+++ Source/JavaScriptCore/ChangeLog (working copy) >@@ -1,3 +1,18 @@ >+2019-06-18 Alexey Shvayka <shvaikalesh@gmail.com> >+ >+ Promise constructor should check argument before [[Construct]] >+ https://bugs.webkit.org/show_bug.cgi?id=198976 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Check if argument is a function before invoking `createSubclassStructure`. >+ (step 2 of https://tc39.es/ecma262/#sec-promise-executor) >+ >+ * builtins/PromiseOperations.js: >+ (globalPrivate.initializePromise): >+ * runtime/JSPromiseConstructor.cpp: >+ (JSC::constructPromise): >+ > 2019-06-18 Tadeu Zagallo <tzagallo@apple.com> > > DFG code should not reify the names of builtin functions with private names >Index: Source/JavaScriptCore/builtins/PromiseOperations.js >=================================================================== >--- Source/JavaScriptCore/builtins/PromiseOperations.js (revision 246561) >+++ Source/JavaScriptCore/builtins/PromiseOperations.js (working copy) >@@ -216,9 +216,6 @@ function initializePromise(executor) > { > "use strict"; > >- if (typeof executor !== 'function') >- @throwTypeError("Promise constructor takes a function argument"); >- > @putByIdDirectPrivate(this, "promiseState", @promiseStatePending); > @putByIdDirectPrivate(this, "promiseReactions", []); > @putByIdDirectPrivate(this, "promiseIsHandled", false); >Index: Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp (revision 246561) >+++ Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp (working copy) >@@ -112,10 +112,14 @@ static EncodedJSValue JSC_HOST_CALL cons > if (newTarget.isUndefined()) > return throwVMTypeError(exec, scope); > >+ JSValue executor = exec->argument(0); >+ if (!executor->isFunction(vm)) >+ return throwVMTypeError(exec, scope, "Promise constructor takes a function argument"_s); >+ > Structure* promiseStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), globalObject->promiseStructure()); > RETURN_IF_EXCEPTION(scope, encodedJSValue()); > JSPromise* promise = JSPromise::create(vm, promiseStructure); >- promise->initialize(exec, globalObject, exec->argument(0)); >+ promise->initialize(exec, globalObject, executor); > RETURN_IF_EXCEPTION(scope, encodedJSValue()); > > return JSValue::encode(promise);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 198976
:
372377
|
372401
|
372443