Bug 248184 - JSValue API converts String objects to NSDictionary instead of NSString
Summary: JSValue API converts String objects to NSDictionary instead of NSString
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-11-21 11:51 PST by Timothy Hatcher
Modified: 2022-11-28 11:52 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Timothy Hatcher 2022-11-21 11:51:44 PST
If a script returns a result or passes a function a String object (not a value) -- like "new String('Test')". And that ObjC -[JSValue toObject] method is called, it will return a NSDictionary with keys for each character instead of an NSString.

This was surprising to me, but it does make sense at a fundamental level. I would just expect an NSString since it is not that useful as an NSDictionary.
Comment 1 Radar WebKit Bug Importer 2022-11-28 11:52:16 PST
<rdar://problem/102727308>