WKWebView navigation delegate sometimes receives a nil WKNavigation, despite being declared as implicitly unwrapped (Swift 2.0)

Originator:holygoat
Number:rdar://22820815 Date Originated:2015-09-23
Status:Open Resolved:
Product:iOS Product Version:8.4.1
Classification: Reproducible:Sometimes
 
We noticed crashes in Firefox for iOS on iOS 8.4.1 (not 9, apparently).

We specify allowsBackForwardNavigationGestures = true for our WKWebViews.

When the user swipes forward or back when a page is fully loaded, webView: didFinishNavigation: is called with a nil WKNavigation.

Our workaround is to treat the implicitly unwrapped optional as a real optional, checking for nil.

Steps to Reproduce:
Open Firefox on an 8.4.1 device.
Load a page and wait for it to completely load.
Click a link and wait for it to completely load.
Swipe left to navigate back.

Current Firefox will crash.
Firefox after Bug 1207179: prints a log message about nil navigation.

Expected Results:
No crash: either guarantee that the WKNavigation is never nil, or change the signature of the delegate.

Actual Results:
Crash: WKNavigation is nil.

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!