WKNavigationAction.sourceFrame is marked as nonnull but it is actually nullable

Originator:rito.0305
Number:rdar://FB9877215 Date Originated:Feb 3, 2022 at 7:23 PM
Status:Open Resolved:
Product:WebKit Product Version:
Classification:Incorrect/Unexpected Behavior Reproducible:
 
The API document says `WKNavigationAction.sourceFrame` is nonnull but it is actually nullable.
https://developer.apple.com/documentation/webkit/wknavigationaction/1401926-sourceframe

Step to reproduce:
1. Define a class conforming WKNavigationDelegate
2. Implement WKNavigationDelegate.webView(_:decidePolicyFor:decisionHandler:)
3. Set break point to `webView(_:decidePolicyFor:decisionHandler:)` and run the app
4. Load some URL and reload web page
5. You can see `navigationAction.sourceFrame` becomes nil (debugger says it's <uninitialized>)


According to WebKit's source code, it is expected for`WKNavigationAction.sourceFrame` to become nil when the web view is reloaded.
https://github.com/WebKit/WebKit/blob/3b6d922d3099018b11af9f7477d8ad8372d7cf1a/Tools/TestWebKitAPI/Tests/WebKitCocoa/DecidePolicyForNavigationAction.mm#L119

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!