We currently take a useless / blank navigation snapshot when navigating after restoring the back / forward list from a sessionState object. This is because we get a current HistoryItem from the sessionState which we have never really navigated to. We then take a navigation snapshot for the current HistoryItem when navigating away as we usually do. However, in this case, the HistoryItem was imported and there is nothing to snapshot.
Taking this snapshot is not only wasteful, it can also potentially overwrite the snapshot that was set by the client using WKWebView._saveBackForwardSnapshotForItem() SPI.
To address the problem, my proposal is to suppress navigation snapshotting after restoring the back / forward list from a session state until the next committed load.
Created attachment 255805 [details]
Comment on attachment 255805 [details]
Clearing flags on attachment: 255805
Committed r186122: <http://trac.webkit.org/changeset/186122>
All reviewed patches have been landed. Closing bug.