Bug 169618 - WKWebView does not allow saving and restoring WKBackForwardList
Summary: WKWebView does not allow saving and restoring WKBackForwardList
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: All iOS 10
: P2 Normal
Assignee: Nobody
Keywords: InRadar
Depends on:
Reported: 2017-03-14 11:37 PDT by Eugene But
Modified: 2019-01-14 06:43 PST (History)
7 users (show)

See Also:

Test app (31.80 KB, application/zip)
2017-03-14 11:37 PDT, Eugene But
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene But 2017-03-14 11:37:17 PDT
Created attachment 304404 [details]
Test app

WKWebView conforms to NSCoding protocol, but despite that encoding and decoding WKWebView object does not preserve WKBackForwardNavigationList

Steps to Reproduce:
1.) Build and run attached test app
2.) Search for puppies
3.) Quit the app (double press on Home button and flick the app)
4.) Launch the app again
5.) Use Side Swipe gesture to go back

Expected Results:
Test app should go back to google.com

Actual Results:
There is no back navigation entry
Comment 1 Eugene But 2017-03-14 11:37:33 PDT
Comment 2 Brady Eidson 2017-03-15 20:08:55 PDT
No such thing as a "WKBackForwardNavigationList"

I'll assume you meant WKBackForwardList and retitle
Comment 3 Brady Eidson 2017-03-15 20:11:45 PDT
Note: WKWebView's NSCoding support is known to be lacking in many, many ways - Not only this way.

The solution for saving/restoring the back forward list would be to expose _WKSessionState (or something like it) as API.
Comment 4 Eugene But 2017-03-16 08:55:10 PDT
Thank you for commenting. Sorry, I indeed meant WKBackForwardList. Any way to restore navigation session would work for us, conforming to NSCoding was just a suggested example.
Comment 5 Stefan Arentz 2017-11-29 16:07:18 PST
I assume Eugene is asking for the same reason that the Firefox for iOS team is also exploring this API today:

iOS 11 has severely regressed WebKit rendering: we are getting lots and lots of reports of users who are only seeing half rendered pages. On both iPad and iPhone. With both 1 tab and multiple tabs.

This is reported / docuemnted at:

 - https://bugs.webkit.org/show_bug.cgi?id=179885
 - rdar://problem/35657388
 - https://bugzilla.mozilla.org/show_bug.cgi?id=1416849
 - https://bugs.chromium.org/p/chromium/issues/detail?id=774452

The workaround for this regression is to completely deallocate the WKWebView and then put a new instance in the view hierarchy.

This of course loses all state, so we too are exploring if NSCoding support is good enough for this workaround.

Both Chrome and FIrefox have super hacky workarounds in place for back forward list saving / restoring.

I hope this background is useful to give some insight in the sudden interest in this functionality.