Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ff01344c4f58839cfc9b7381f6416307f9e1e1c5
      
https://github.com/WebKit/WebKit/commit/ff01344c4f58839cfc9b7381f6416307f9e1e1c5
  Author: Alexey Shvayka <ashva...@apple.com>
  Date:   2023-09-29 (Fri, 29 Sep 2023)

  Changed paths:
    M JSTests/ChakraCore/test/Lib/noargs_2.baseline-jsc
    M JSTests/stress/function-cache-with-parameters-end-position.js
    M JSTests/stress/function-constructor-name.js
    M JSTests/stress/function-constructor-semantics.js
    M JSTests/test262/expectations.yaml
    M 
LayoutTests/inspector/console/messageAdded-from-named-evaluations-expected.txt
    M LayoutTests/js/dom/function-names-expected.txt
    M LayoutTests/js/dom/script-start-end-locations-expected.txt
    M LayoutTests/js/dom/script-tests/function-names.js
    M Source/JavaScriptCore/API/tests/FunctionOverridesTest.cpp
    M Source/JavaScriptCore/API/tests/testapi.c
    M Source/JavaScriptCore/runtime/FunctionConstructor.cpp
    M Source/JavaScriptCore/runtime/FunctionConstructor.h
    M Source/WebCore/bindings/js/JSLazyEventListener.cpp
    M Source/WebCore/bindings/js/JSLazyEventListener.h

  Log Message:
  -----------
  [JSC] Align stringification algorithm of the Function constructor with the 
spec
https://bugs.webkit.org/show_bug.cgi?id=190501
<rdar://102065151>

Reviewed by Yusuke Suzuki.

This change aligns stringification algorithm of the Function constructor with 
the spec [1].
In particular, fixes prefixes for (async) generator functions (steps 5 & 7), 
joins parameters by ","
instead of ", " (step 10.d.iii), and adds a newline character after the last 
parameter (step 13).

Since constructFunctionSkippingEvalEnabledCheck() is also being used for 
creating HTML attribute
event listeners, which uses different stringification algorithm [2], this patch 
tweaks its signature
to accept the source code instead, making bindings / disabled eval() code a 
little bit nicer.

Aligns JSC with V8 and SpiderMonkey.

[1]: https://tc39.es/ecma262/#sec-createdynamicfunction
[2]: 
https://html.spec.whatwg.org/multipage/webappapis.html#getting-the-current-value-of-the-event-handler
 (step 9)

* JSTests/ChakraCore/test/Lib/noargs_2.baseline-jsc:
* JSTests/stress/function-cache-with-parameters-end-position.js:
* JSTests/stress/function-constructor-name.js:
* JSTests/stress/function-constructor-semantics.js:
* JSTests/test262/expectations.yaml: Mark 12 tests as passing.
* 
LayoutTests/inspector/console/messageAdded-from-named-evaluations-expected.txt:
* LayoutTests/js/dom/function-names-expected.txt:
* LayoutTests/js/dom/script-start-end-locations-expected.txt:
* LayoutTests/js/dom/script-tests/function-names.js:
* Source/JavaScriptCore/API/tests/FunctionOverridesTest.cpp:
* Source/JavaScriptCore/API/tests/testapi.c:
* Source/JavaScriptCore/runtime/FunctionConstructor.cpp:
(JSC::stringifyFunction):
(JSC::constructFunction):
This change is careful to preserve "swallowing" an argument coercion error in 
case of disabled eval(),
which is intentional since HostEnsureCanCompileStrings happens as early as on 
step 2 [1].

(JSC::constructFunctionSkippingEvalEnabledCheck):
* Source/JavaScriptCore/runtime/FunctionConstructor.h:
* Source/WebCore/bindings/js/JSLazyEventListener.cpp:
(WebCore::functionParameters):
(WebCore::JSLazyEventListener::JSLazyEventListener):
(WebCore::JSLazyEventListener::initializeJSFunction const):
(WebCore::eventParameterName): Deleted.
* Source/WebCore/bindings/js/JSLazyEventListener.h:

Co-authored-by: Keith Miller <keith_mil...@apple.com>
Canonical link: https://commits.webkit.org/268633@main


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to