Bug 242810

Summary: [JSC] String serialization of functions doesn't match Blink / Gecko
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ahmad.saleem792, colin, justin_michaud, mark.lam, saam, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: BrowserCompat, InRadar, WPTImpact
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
URL: http://wpt.live/webstorage/storage_string_conversion.window.html

Description Chris Dumez 2022-07-15 10:42:47 PDT
[JSC] String serialization of functions doesn't match Blink / Gecko:
https://jsbin.com/zomehipuho/edit?html,output

f = function(){ }
"" + f is "function(){ }" in Gecko and Blink
"" + f is "function (){ }" in WebKit

Gecko and Blink uses the format exactly as provided when constructing the function.
WebKit enforces a space between function and (), even if the original input didn't have one.

This is causing the following WPT test to fail:
imported/w3c/web-platform-tests/webstorage/storage_string_conversion.window.html
Comment 1 Radar WebKit Bug Importer 2022-07-22 10:43:15 PDT
<rdar://problem/97445158>
Comment 2 Colin Vidal 2023-06-06 12:20:11 PDT
Pull request: https://github.com/WebKit/WebKit/pull/14704
Comment 3 EWS 2023-06-18 11:01:23 PDT
Committed 265284@main (55ae3a1d4de3): <https://commits.webkit.org/265284@main>

Reviewed commits have been landed. Closing PR #14704 and removing active labels.