Modified: trunk/Source/WebKit/ChangeLog (237282 => 237283)
--- trunk/Source/WebKit/ChangeLog 2018-10-19 06:43:47 UTC (rev 237282)
+++ trunk/Source/WebKit/ChangeLog 2018-10-19 13:39:32 UTC (rev 237283)
@@ -1,3 +1,25 @@
+2018-10-19 Chris Dumez <[email protected]>
+
+ [PSON] WebPageProxy::didCompletePageTransition() may interact with a SuspendedPageProxy from a previous navigation
+ https://bugs.webkit.org/show_bug.cgi?id=190717
+
+ Reviewed by Antti Koivisto.
+
+ WebPageProxy::didCompletePageTransition() may interact with a SuspendedPageProxy from a previous navigation. We need
+ to reset m_lastSuspendedPage whenever the page starts a new navigation as m_lastSuspendedPage is only updated when
+ we process-swap otherwise.
+
+ Also rename the data member to m_pageSuspendedDueToCurrentNavigation for clarity.
+
+ In a follow-up, I will see if I can get rid of this data member entirely or maybe move it to the Navigation
+ object.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
+ (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
+ (WebKit::WebPageProxy::didCompletePageTransition):
+ (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
+
2018-10-18 Eric Carlson <[email protected]>
[MediaStream] Allow ports to optionally do screen capture in the UI process
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (237282 => 237283)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-10-19 06:43:47 UTC (rev 237282)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-10-19 13:39:32 UTC (rev 237283)
@@ -723,10 +723,10 @@
}
auto suspendedPage = std::make_unique<SuspendedPageProxy>(*this, m_process.copyRef(), *currentItem, *mainFrameID);
- m_lastSuspendedPage = makeWeakPtr(suspendedPage.get());
+ m_pageSuspendedDueToCurrentNavigation = makeWeakPtr(suspendedPage.get());
m_process->processPool().addSuspendedPageProxy(WTFMove(suspendedPage));
- LOG(ProcessSwapping, "WebPageProxy %" PRIu64 " created suspended page %s for process pid %i, back/forward item %s" PRIu64, pageID(), m_lastSuspendedPage->loggingString(), m_process->processIdentifier(), currentItem->itemID().logString());
+ LOG(ProcessSwapping, "WebPageProxy %" PRIu64 " created suspended page %s for process pid %i, back/forward item %s" PRIu64, pageID(), m_pageSuspendedDueToCurrentNavigation->loggingString(), m_process->processIdentifier(), currentItem->itemID().logString());
}
void WebPageProxy::swapToWebProcess(Ref<WebProcessProxy>&& process, API::Navigation& navigation, std::optional<uint64_t> mainFrameIDInPreviousProcess)
@@ -2487,6 +2487,10 @@
}
if (policyAction == PolicyAction::Use && frame.isMainFrame()) {
+ // We're about to navigate so we need to reset m_pageSuspendedDueToCurrentNavigation. If we decide to process swap,
+ // continueNavigationInNewProcess() will take care of updating m_pageSuspendedDueToCurrentNavigation as needed.
+ m_pageSuspendedDueToCurrentNavigation = nullptr;
+
String reason;
auto proposedProcess = process().processPool().processForNavigation(*this, *navigation, processSwapRequestedByClient, policyAction, reason);
ASSERT(!reason.isNull());
@@ -3495,7 +3499,7 @@
void WebPageProxy::didCompletePageTransition(bool isInitialEmptyDocument)
{
// Attach drawing area for the initial empty document only if this is not a process swap.
- if (isInitialEmptyDocument && m_lastSuspendedPage)
+ if (isInitialEmptyDocument && m_pageSuspendedDueToCurrentNavigation)
return;
#if PLATFORM(MAC)
@@ -3505,8 +3509,8 @@
// Drawing area for the suspended page will be torn down when the attach completes.
m_drawingArea->attachInWebProcess();
#else
- if (m_lastSuspendedPage)
- m_lastSuspendedPage->tearDownDrawingAreaInWebProcess();
+ if (m_pageSuspendedDueToCurrentNavigation)
+ m_pageSuspendedDueToCurrentNavigation->tearDownDrawingAreaInWebProcess();
#endif
}
@@ -6400,8 +6404,8 @@
pageClient().enterAcceleratedCompositingMode(layerTreeContext);
// We have completed the page transition and can tear down the layers in the suspended process.
- if (m_lastSuspendedPage)
- m_lastSuspendedPage->tearDownDrawingAreaInWebProcess();
+ if (m_pageSuspendedDueToCurrentNavigation)
+ m_pageSuspendedDueToCurrentNavigation->tearDownDrawingAreaInWebProcess();
}
void WebPageProxy::exitAcceleratedCompositingMode()
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (237282 => 237283)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2018-10-19 06:43:47 UTC (rev 237282)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2018-10-19 13:39:32 UTC (rev 237283)
@@ -2260,7 +2260,7 @@
std::optional<MonotonicTime> m_pageLoadStart;
// FIXME: We should try and get rid of this data member.
- WeakPtr<SuspendedPageProxy> m_lastSuspendedPage;
+ WeakPtr<SuspendedPageProxy> m_pageSuspendedDueToCurrentNavigation;
RunLoop::Timer<WebPageProxy> m_resetRecentCrashCountTimer;
unsigned m_recentCrashCount { 0 };