Bug 211808

Summary: [WK2] Neuter WKFrameIsFrameSet() / WKPageGetFrameSetLargestFrame() C API
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: WebKit2Assignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, beidson, changseok, darin, esprehn+autocc, ews-watchlist, ggaren, gyuyoung.kim, japhet, kangil.han, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Chris Dumez 2020-05-12 14:42:12 PDT
Neuter WKFrameIsFrameSet() / WKPageGetFrameSetLargestFrame() C API. This is only SPI and is only used for slightly different printing behavior in Safari. Framesets are no longer supported in HTML5 and are now super rare. Support for this C API adds quite a bit of code complexity and crashes such as <rdar://problem/60322282>, it just does not seem worse it anymore.
Comment 1 Chris Dumez 2020-05-12 14:47:55 PDT
Created attachment 399181 [details]
Patch
Comment 2 Darin Adler 2020-05-12 14:53:53 PDT
Comment on attachment 399181 [details]
Patch

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

> Source/WebKit/UIProcess/API/C/WKFrame.cpp:125
>  bool WKFrameIsFrameSet(WKFrameRef frameRef)

Is there an "SPI deprecation" thing to be done?

> Source/WebKit/UIProcess/API/C/WKPage.cpp:393
> -    return toAPI(toImpl(pageRef)->frameSetLargestFrame());
> +    return nullptr;

Would it be safer to return the main frame rather than null?
Comment 3 Alex Christensen 2020-05-12 14:55:05 PDT
Comment on attachment 399181 [details]
Patch

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

>> Source/WebKit/UIProcess/API/C/WKFrame.cpp:125
>>  bool WKFrameIsFrameSet(WKFrameRef frameRef)
> 
> Is there an "SPI deprecation" thing to be done?

WK_C_API_DEPRECATED
Comment 4 Alex Christensen 2020-05-12 14:57:18 PDT
Comment on attachment 399181 [details]
Patch

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

>> Source/WebKit/UIProcess/API/C/WKPage.cpp:393
>> +    return nullptr;
> 
> Would it be safer to return the main frame rather than null?

If we remove the use of this function (and please mention the radar where you do such) then we only need to keep the C functions in the binary so SafariForWebKitDevelopment can start with open source builds of WebKit, which is probably NBD in this case.
Comment 5 Chris Dumez 2020-05-12 15:06:27 PDT
Comment on attachment 399181 [details]
Patch

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

>>> Source/WebKit/UIProcess/API/C/WKFrame.cpp:125
>>>  bool WKFrameIsFrameSet(WKFrameRef frameRef)
>> 
>> Is there an "SPI deprecation" thing to be done?
> 
> WK_C_API_DEPRECATED

Will add.

>>> Source/WebKit/UIProcess/API/C/WKPage.cpp:393
>>> +    return nullptr;
>> 
>> Would it be safer to return the main frame rather than null?
> 
> If we remove the use of this function (and please mention the radar where you do such) then we only need to keep the C functions in the binary so SafariForWebKitDevelopment can start with open source builds of WebKit, which is probably NBD in this case.

Yes, I will follow-up and drop corresponding code from client.

Returning nullptr here is safe. This method could always return null and would only return non-null when there is a frameset. Returning the main frame would be a behavior change and may actually cause a behavior change in client too. I have checked that the only client of this SPI properly null-checks the result.
Comment 6 Chris Dumez 2020-05-12 15:10:22 PDT
Created attachment 399185 [details]
Patch
Comment 7 EWS 2020-05-12 16:38:47 PDT
Committed r261586: <https://trac.webkit.org/changeset/261586>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 399185 [details].
Comment 8 Radar WebKit Bug Importer 2020-05-12 16:39:23 PDT
<rdar://problem/63159822>