PSON: No process swap on back navigation after URL bar navigation
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Sep 2018 21:23:40 +0000 (21:23 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Sep 2018 21:23:40 +0000 (21:23 +0000)
commit36bad9811b3bacb1baef627aab328edd2f759afc
treed4dfe190659dae1494d32394504bc6ba35bf9c19
parent1b447d61966fce3ebf01dec5b715b482e26ff5c8
PSON: No process swap on back navigation after URL bar navigation
https://bugs.webkit.org/show_bug.cgi?id=189557
<rdar://problem/44353108>

Reviewed by Alex Christensen.

Source/WebKit:

Our logic in WebProcessPool::processForNavigationInternal() was wrongly using
WebBackForwardList::currentItem() as source item of the navigation, instead of
using Navigation::fromItem(). In case of back navigation, by the time
processForNavigation() is called, the WebBackForwardList's currentItem has already
been updated to be the target item, via a Sync IPC from the WebProcess. As a result,
the source and target items would be the same in the following check:
` if (currentItem->itemID().processIdentifier == backForwardListItem->itemID().processIdentifier)`

This would cause us to reuse the same process incorrectly. Our existing API test coverage
did not catch this because our target HistoryItem usually has a SuspendedPage and we decide
to use the SuspendedPage's process a few lines above in WebProcessPool::processForNavigationInternal().

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::processForNavigationInternal):

Tools:

Add API test coverage.

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235952 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/WebProcessPool.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm