Bug 203875

Summary: JSC should not be using WTF::String::createCFString().
Product: WebKit Reporter: Mark Lam <mark.lam>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: fpizlo, keith_miller, msaboff, rmorisset, saam, tzagallo, ysuzuki
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=203873

Description Mark Lam 2019-11-05 18:24:47 PST
After https://bugs.webkit.org/show_bug.cgi?id=203873, there's only one instance of this bad idiom: formatLocaleDate() in DatePrototype.cpp.
Comment 1 Yusuke Suzuki 2019-11-06 00:59:37 PST
There is other WTF functions that are internally using createCFString (like, mac/FileSystemMac.mm). So they should be changed too since these functions can be called from JSC.
Comment 2 Keith Miller 2019-11-06 10:46:54 PST
Why is this a bad idiom? Just because we don't want to allocate CF strings?
Comment 3 Mark Lam 2019-11-06 11:25:46 PST
(In reply to Keith Miller from comment #2)
> Why is this a bad idiom? Just because we don't want to allocate CF strings?

Because String::createCFString() uses StringImpl::createCFString(), which relies on the concept of isMainThread(), which is only meaningful if WebCore is the client of JSC.  For all other clients, this can result in badness.