- Revision
- 261394
- Author
- [email protected]
- Date
- 2020-05-08 10:33:58 -0700 (Fri, 08 May 2020)
Log Message
REGRESSION(r259209) Webview's pending URL is null after restoring session state
https://bugs.webkit.org/show_bug.cgi?id=211626
<rdar://problem/62992262>
Reviewed by Alex Christensen.
Source/WebKit:
The issue was that WebPageProxy::goToBackForwardItem() would behave differently whether
the page has a running process or not. In particular, when the page did not have a
running process, goToBackForwardItem() would return early and call launchProcessWithItem()
instead. Unlike goToBackForwardItem(), launchProcessWithItem() would fail to set the
pending API request.
To address the issue, I am getting rid of launchProcessWithItem() and merging its logic
into goToBackForwardItem() instead. Both methods shared a lot of code anyway and having
2 separate code paths that may diverge is error prone.
Change is covered by new API test.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::goToBackForwardItem):
(WebKit::WebPageProxy::launchProcessWithItem): Deleted.
* UIProcess/WebPageProxy.h:
Tools:
Add API test coverage.
* TestWebKitAPI/Tests/WebKit/RestoreSessionState.cpp:
(TestWebKitAPI::TEST):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (261393 => 261394)
--- trunk/Source/WebKit/ChangeLog 2020-05-08 17:31:54 UTC (rev 261393)
+++ trunk/Source/WebKit/ChangeLog 2020-05-08 17:33:58 UTC (rev 261394)
@@ -1,3 +1,28 @@
+2020-05-08 Chris Dumez <[email protected]>
+
+ REGRESSION(r259209) Webview's pending URL is null after restoring session state
+ https://bugs.webkit.org/show_bug.cgi?id=211626
+ <rdar://problem/62992262>
+
+ Reviewed by Alex Christensen.
+
+ The issue was that WebPageProxy::goToBackForwardItem() would behave differently whether
+ the page has a running process or not. In particular, when the page did not have a
+ running process, goToBackForwardItem() would return early and call launchProcessWithItem()
+ instead. Unlike goToBackForwardItem(), launchProcessWithItem() would fail to set the
+ pending API request.
+
+ To address the issue, I am getting rid of launchProcessWithItem() and merging its logic
+ into goToBackForwardItem() instead. Both methods shared a lot of code anyway and having
+ 2 separate code paths that may diverge is error prone.
+
+ Change is covered by new API test.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::goToBackForwardItem):
+ (WebKit::WebPageProxy::launchProcessWithItem): Deleted.
+ * UIProcess/WebPageProxy.h:
+
2020-05-08 Alex Christensen <[email protected]>
WKWebView.title should be safe browsing warning's title during a safe browsing warning
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (261393 => 261394)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-05-08 17:31:54 UTC (rev 261393)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-05-08 17:33:58 UTC (rev 261394)
@@ -1024,29 +1024,6 @@
return navigation;
}
-RefPtr<API::Navigation> WebPageProxy::launchProcessWithItem(WebBackForwardListItem& item)
-{
- RELEASE_LOG_IF_ALLOWED(Loading, "launchProcessWithItem:");
-
- if (m_isClosed) {
- RELEASE_LOG_IF_ALLOWED(Loading, "launchProcessWithItem: page is closed");
- return nullptr;
- }
-
- ASSERT(!hasRunningProcess());
- launchProcess(RegistrableDomain { URL(URL(), item.url()) }, ProcessLaunchReason::InitialProcess);
-
- if (&item != m_backForwardList->currentItem())
- m_backForwardList->goToItem(item);
-
- auto navigation = m_navigationState->createBackForwardNavigation(item, m_backForwardList->currentItem(), FrameLoadType::IndexedBackForward);
-
- send(Messages::WebPage::GoToBackForwardItem(navigation->navigationID(), item.itemID(), FrameLoadType::IndexedBackForward, ShouldTreatAsContinuingLoad::No, WTF::nullopt));
- m_process->startResponsivenessTimer();
-
- return navigation;
-}
-
void WebPageProxy::setDrawingArea(std::unique_ptr<DrawingAreaProxy>&& drawingArea)
{
m_drawingArea = WTFMove(drawingArea);
@@ -1654,9 +1631,18 @@
RELEASE_LOG_IF_ALLOWED(Loading, "goToBackForwardItem:");
LOG(Loading, "WebPageProxy %p goToBackForwardItem to item URL %s", this, item.url().utf8().data());
- if (!hasRunningProcess())
- return launchProcessWithItem(item);
+ if (m_isClosed) {
+ RELEASE_LOG_IF_ALLOWED(Loading, "goToBackForwardItem: page is closed");
+ return nullptr;
+ }
+ if (!hasRunningProcess()) {
+ launchProcess(RegistrableDomain { URL(URL(), item.url()) }, ProcessLaunchReason::InitialProcess);
+
+ if (&item != m_backForwardList->currentItem())
+ m_backForwardList->goToItem(item);
+ }
+
RefPtr<API::Navigation> navigation;
if (!m_backForwardList->currentItem()->itemIsInSameDocument(item))
navigation = m_navigationState->createBackForwardNavigation(item, m_backForwardList->currentItem(), frameLoadType);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (261393 => 261394)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2020-05-08 17:31:54 UTC (rev 261393)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2020-05-08 17:33:58 UTC (rev 261394)
@@ -1947,7 +1947,6 @@
void finishAttachingToWebProcess(ProcessLaunchReason);
RefPtr<API::Navigation> launchProcessForReload();
- RefPtr<API::Navigation> launchProcessWithItem(WebBackForwardListItem&);
void requestNotificationPermission(uint64_t notificationID, const String& originString);
void showNotification(const String& title, const String& body, const String& iconURL, const String& tag, const String& lang, WebCore::NotificationDirection, const String& originString, uint64_t notificationID);
Modified: trunk/Tools/ChangeLog (261393 => 261394)
--- trunk/Tools/ChangeLog 2020-05-08 17:31:54 UTC (rev 261393)
+++ trunk/Tools/ChangeLog 2020-05-08 17:33:58 UTC (rev 261394)
@@ -1,3 +1,16 @@
+2020-05-08 Chris Dumez <[email protected]>
+
+ REGRESSION(r259209) Webview's pending URL is null after restoring session state
+ https://bugs.webkit.org/show_bug.cgi?id=211626
+ <rdar://problem/62992262>
+
+ Reviewed by Alex Christensen.
+
+ Add API test coverage.
+
+ * TestWebKitAPI/Tests/WebKit/RestoreSessionState.cpp:
+ (TestWebKitAPI::TEST):
+
2020-05-08 Alex Christensen <[email protected]>
WKWebView.title should be safe browsing warning's title during a safe browsing warning
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit/RestoreSessionState.cpp (261393 => 261394)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit/RestoreSessionState.cpp 2020-05-08 17:31:54 UTC (rev 261393)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit/RestoreSessionState.cpp 2020-05-08 17:33:58 UTC (rev 261394)
@@ -137,6 +137,24 @@
auto sessionState = adoptWK(WKSessionStateCreateFromData(data.get()));
WKPageRestoreFromSessionState(webView.page(), sessionState.get());
}
+
+TEST(WebKit, PendingURLAfterRestoreSessionState)
+{
+ auto context = adoptWK(WKContextCreateWithConfiguration(nullptr));
+ PlatformWebView webView(context.get());
+ setPageLoaderClient(webView.page());
+ auto data = ""
+ EXPECT_NOT_NULL(data);
+ auto sessionState = adoptWK(WKSessionStateCreateFromData(data.get()));
+ WKPageRestoreFromSessionState(webView.page(), sessionState.get());
+ auto pendingURL = adoptWK(WKPageCopyPendingAPIRequestURL(webView.page()));
+ EXPECT_NOT_NULL(pendingURL);
+ if (!pendingURL)
+ return;
+
+ auto expectedURL = adoptWK(Util::createURLForResource("simple-form", "html"));
+ EXPECT_WK_STREQ(adoptWK(WKURLCopyString(expectedURL.get())).get(), adoptWK(WKURLCopyString(pendingURL.get())).get());
+}
} // namespace TestWebKitAPI