Simplify logic inside WebPageProxy::continueNavigationInNewProcess()
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Dec 2018 22:44:30 +0000 (22:44 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Dec 2018 22:44:30 +0000 (22:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=192404

Reviewed by Alex Christensen.

Simplify get the item state from the current back/forward list item, instead of
relying on WebBackForwardList::filteredItemStates().

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::continueNavigationInNewProcess):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238911 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/WebPageProxy.cpp

index 6db959a..bc6fa2f 100644 (file)
@@ -1,3 +1,16 @@
+2018-12-05  Chris Dumez  <cdumez@apple.com>
+
+        Simplify logic inside WebPageProxy::continueNavigationInNewProcess()
+        https://bugs.webkit.org/show_bug.cgi?id=192404
+
+        Reviewed by Alex Christensen.
+
+        Simplify get the item state from the current back/forward list item, instead of
+        relying on WebBackForwardList::filteredItemStates().
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::continueNavigationInNewProcess):
+
 2018-12-05  Youenn Fablet  <youenn@apple.com>
 
         Enable the possibility to do video capture in UIProcess
index ac80a7b..8e5946f 100644 (file)
@@ -2700,14 +2700,10 @@ void WebPageProxy::continueNavigationInNewProcess(API::Navigation& navigation, R
             return;
         }
 
-        if (navigation->lockBackForwardList() == LockBackForwardList::Yes || navigation->lockHistory() == LockHistory::Yes) {
+        if (m_backForwardList->currentItem() && (navigation->lockBackForwardList() == LockBackForwardList::Yes || navigation->lockHistory() == LockHistory::Yes)) {
             // If WebCore is supposed to lock the history for this load, then the new process needs to know about the current history item so it can update
             // it instead of creating a new one.
-            auto itemStates = m_backForwardList->filteredItemStates([currentItem = m_backForwardList->currentItem()](WebBackForwardListItem& item) {
-                return &item == currentItem;
-            });
-            RELEASE_ASSERT(itemStates.size() == 1);
-            m_process->send(Messages::WebPage::SetCurrentHistoryItemForReattach(itemStates[0]), m_pageID);
+            m_process->send(Messages::WebPage::SetCurrentHistoryItemForReattach(m_backForwardList->currentItem()->itemState()), m_pageID);
         }
 
         // FIXME: Work out timing of responding with the last policy delegate, etc