Bug 226204

Summary: AX: Fix build failure for WK API WTF::String usage
Product: WebKit Reporter: chris fleizach <cfleizach>
Component: AccessibilityAssignee: chris fleizach <cfleizach>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
patch
none
patch none

Description chris fleizach 2021-05-24 18:13:26 PDT
Build failure from 

https://bugs.webkit.org/show_bug.cgi?id=225909#c13
Comment 1 Radar WebKit Bug Importer 2021-05-24 18:13:43 PDT
<rdar://problem/78428840>
Comment 2 chris fleizach 2021-05-24 18:15:38 PDT
Created attachment 429605 [details]
patch
Comment 3 Tim Horton 2021-05-24 18:42:03 PDT
Comment on attachment 429605 [details]
patch

I think the caller of WKAccessibilityTestingInjectPreference in WKTR likely needs to change too
Comment 4 chris fleizach 2021-05-24 18:48:37 PDT
Created attachment 429607 [details]
patch
Comment 5 Tim Horton 2021-05-24 18:56:19 PDT
Comment on attachment 429607 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=429607&action=review

> Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm:105
> +    WKAccessibilityTestingInjectPreference(page, toWKString(context, JSValueMakeString(context, domain)).get(), toWKString(context, JSValueMakeString(context, key)).get(), toWK((String)encodedString).get());

Probably could be WKStringCreateWithJSString
Comment 6 Darin Adler 2021-05-24 19:04:37 PDT
Comment on attachment 429607 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=429607&action=review

>> Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm:105
>> +    WKAccessibilityTestingInjectPreference(page, toWKString(context, JSValueMakeString(context, domain)).get(), toWKString(context, JSValueMakeString(context, key)).get(), toWK((String)encodedString).get());
> 
> Probably could be WKStringCreateWithJSString

instead of:

    toWKString(context, JSValueMakeString(context, domain)).get()

write:

    toWK(domain).get()

As long as you include the header StringFunctions.h. Also should come up with a better way to convert an NSString to a WKString that does not involve converting to (String).
Comment 7 Darin Adler 2021-05-24 19:08:41 PDT
Instead of:

    toWK((String)encodedString).get()

Should use:

    toWK(encodedString.createJSStringRef.get())

As long as we include the header AccessibilityCommonMac.h and StringFunctions.h
Comment 8 Darin Adler 2021-05-24 19:10:38 PDT
Or could add createWKStringRef to the NSString category.
Comment 9 Darin Adler 2021-05-24 19:11:01 PDT
Could name that toWK and overload it for NSString.
Comment 10 EWS 2021-05-24 19:33:23 PDT
Committed r277987 (238100@main): <https://commits.webkit.org/238100@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 429607 [details].