Diff
Modified: trunk/Source/WebKit/ChangeLog (243153 => 243154)
--- trunk/Source/WebKit/ChangeLog 2019-03-19 18:25:21 UTC (rev 243153)
+++ trunk/Source/WebKit/ChangeLog 2019-03-19 18:38:59 UTC (rev 243154)
@@ -1,3 +1,16 @@
+2019-03-19 Chris Dumez <cdu...@apple.com>
+
+ Unreviewed, rolling out r243142.
+
+ Caused assertion hits in WK2 Debug
+
+ Reverted changeset:
+
+ "Spew: Unhandled web process message
+ 'VisitedLinkTableController:VisitedLinkStateChanged'"
+ https://bugs.webkit.org/show_bug.cgi?id=194787
+ https://trac.webkit.org/changeset/243142
+
2019-03-19 Daniel Bates <daba...@apple.com>
[iOS] Focus not preserved when switching between tabs
Modified: trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp (243153 => 243154)
--- trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp 2019-03-19 18:25:21 UTC (rev 243153)
+++ trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp 2019-03-19 18:38:59 UTC (rev 243154)
@@ -99,7 +99,6 @@
m_process->removeMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_page.pageID());
m_process->send(Messages::WebPage::Close(), m_page.pageID());
- m_process->removeVisitedLinkStoreUser(m_page.visitedLinkStore(), m_page.pageID());
RunLoop::main().dispatch([process = m_process.copyRef()] {
process->maybeShutDown();
@@ -137,6 +136,21 @@
didFailProvisionalLoadForFrame(m_mainFrame->frameID(), { }, m_navigationID, m_provisionalLoadURL, error, UserData { }); // Will delete |this|.
}
+void ProvisionalPageProxy::processDidFinishLaunching()
+{
+ RELEASE_LOG_IF_ALLOWED(ProcessSwapping, "processDidFinishLaunching: pageID = %" PRIu64, m_page.pageID());
+ finishInitializingWebPageAfterProcessLaunch();
+}
+
+void ProvisionalPageProxy::finishInitializingWebPageAfterProcessLaunch()
+{
+ ASSERT(m_process->state() == WebProcessProxy::State::Running);
+
+ // FIXME: The WebPageProxy delays adding the visited link store until after the process has launched
+ // so the ProvisionalPageProxy does the same. However, do we really need to?
+ m_process->addVisitedLinkStore(m_page.visitedLinkStore());
+}
+
void ProvisionalPageProxy::initializeWebPage()
{
m_drawingArea = m_page.pageClient().createDrawingAreaProxy(m_process);
@@ -144,7 +158,9 @@
auto parameters = m_page.creationParameters(m_process, *m_drawingArea);
parameters.isProcessSwap = true;
m_process->send(Messages::WebProcess::CreateWebPage(m_page.pageID(), parameters), 0);
- m_process->addVisitedLinkStoreUser(m_page.visitedLinkStore(), m_page.pageID());
+
+ if (m_process->state() == WebProcessProxy::State::Running)
+ finishInitializingWebPageAfterProcessLaunch();
}
void ProvisionalPageProxy::loadData(API::Navigation& navigation, const IPC::DataReference& data, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData, Optional<WebsitePoliciesData>&& websitePolicies)
Modified: trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.h (243153 => 243154)
--- trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.h 2019-03-19 18:25:21 UTC (rev 243153)
+++ trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.h 2019-03-19 18:38:59 UTC (rev 243154)
@@ -79,6 +79,7 @@
void goToBackForwardItem(API::Navigation&, WebBackForwardListItem&, Optional<WebsitePoliciesData>&&);
void cancel();
+ void processDidFinishLaunching();
void processDidTerminate();
void connectionWillOpen(IPC::Connection&);
@@ -114,6 +115,7 @@
#endif
void initializeWebPage();
+ void finishInitializingWebPageAfterProcessLaunch();
WebPageProxy& m_page;
Ref<WebProcessProxy> m_process;
Modified: trunk/Source/WebKit/UIProcess/VisitedLinkStore.cpp (243153 => 243154)
--- trunk/Source/WebKit/UIProcess/VisitedLinkStore.cpp 2019-03-19 18:25:21 UTC (rev 243153)
+++ trunk/Source/WebKit/UIProcess/VisitedLinkStore.cpp 2019-03-19 18:38:59 UTC (rev 243154)
@@ -42,7 +42,10 @@
VisitedLinkStore::~VisitedLinkStore()
{
- RELEASE_ASSERT(m_processes.isEmpty());
+ for (WebProcessProxy* process : m_processes) {
+ process->removeMessageReceiver(Messages::VisitedLinkStore::messageReceiverName(), identifier());
+ process->didDestroyVisitedLinkStore(*this);
+ }
}
VisitedLinkStore::VisitedLinkStore()
@@ -53,7 +56,6 @@
void VisitedLinkStore::addProcess(WebProcessProxy& process)
{
ASSERT(process.state() == WebProcessProxy::State::Running);
- ASSERT(!m_processes.contains(&process));
if (!m_processes.add(&process).isNewEntry)
return;
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (243153 => 243154)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-03-19 18:25:21 UTC (rev 243153)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-03-19 18:38:59 UTC (rev 243154)
@@ -819,6 +819,7 @@
// when the process was provisional.
if (isProcessSwap != IsProcessSwap::Yes)
m_webProcessLifetimeTracker.webPageEnteringWebProcess(m_process);
+ processDidFinishLaunching();
}
updateActivityState();
@@ -957,9 +958,21 @@
process().send(Messages::WebProcess::CreateWebPage(m_pageID, creationParameters(m_process, *m_drawingArea)), 0);
- m_process->addVisitedLinkStoreUser(visitedLinkStore(), m_pageID);
+ m_needsToFinishInitializingWebPageAfterProcessLaunch = true;
+ finishInitializingWebPageAfterProcessLaunch();
}
+void WebPageProxy::finishInitializingWebPageAfterProcessLaunch()
+{
+ if (!m_needsToFinishInitializingWebPageAfterProcessLaunch)
+ return;
+ if (m_process->state() != WebProcessProxy::State::Running)
+ return;
+
+ m_needsToFinishInitializingWebPageAfterProcessLaunch = false;
+ m_process->addVisitedLinkStore(m_visitedLinkStore);
+}
+
void WebPageProxy::close()
{
if (m_isClosed)
@@ -5100,6 +5113,12 @@
m_webProcessLifetimeTracker.webPageLeavingWebProcess(m_process);
}
+void WebPageProxy::processDidFinishLaunching()
+{
+ ASSERT(m_process->state() == WebProcessProxy::State::Running);
+ finishInitializingWebPageAfterProcessLaunch();
+}
+
#if ENABLE(NETSCAPE_PLUGIN_API)
void WebPageProxy::unavailablePluginButtonClicked(uint32_t opaquePluginUnavailabilityReason, const String& mimeType, const String& pluginURLString, const String& pluginspageAttributeURLString, const String& frameURLString, const String& pageURLString)
{
@@ -6905,6 +6924,8 @@
m_hasRunningProcess = false;
m_isPageSuspended = false;
+ m_needsToFinishInitializingWebPageAfterProcessLaunch = false;
+
m_editorState = EditorState();
m_cachedFontAttributesAtSelectionStart.reset();
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (243153 => 243154)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2019-03-19 18:25:21 UTC (rev 243153)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2019-03-19 18:38:59 UTC (rev 243154)
@@ -1233,6 +1233,8 @@
void connectionWillOpen(IPC::Connection&);
void webProcessWillShutDown();
+ void processDidFinishLaunching();
+
void didSaveToPageCache();
void setScrollPinningBehavior(WebCore::ScrollPinningBehavior);
@@ -1972,6 +1974,8 @@
void didResignInputElementStrongPasswordAppearance(const UserData&);
+ void finishInitializingWebPageAfterProcessLaunch();
+
void handleMessage(IPC::Connection&, const String& messageName, const UserData& messageBody);
void handleSynchronousMessage(IPC::Connection&, const String& messageName, const UserData& messageBody, UserData& returnUserData);
@@ -2221,6 +2225,8 @@
// Whether it can run modal child web pages.
bool m_canRunModal { false };
+ bool m_needsToFinishInitializingWebPageAfterProcessLaunch { false };
+
bool m_isInPrintingMode { false };
bool m_isPerformingDOMPrintOperation { false };
Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp (243153 => 243154)
--- trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp 2019-03-19 18:25:21 UTC (rev 243153)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp 2019-03-19 18:38:59 UTC (rev 243154)
@@ -298,9 +298,9 @@
frame->webProcessWillShutDown();
m_frameMap.clear();
- for (auto* visitedLinkStore : m_visitedLinkStoresWithUsers.keys())
+ for (auto* visitedLinkStore : m_visitedLinkStores)
visitedLinkStore->removeProcess(*this);
- m_visitedLinkStoresWithUsers.clear();
+ m_visitedLinkStores.clear();
for (auto* webUserContentControllerProxy : m_webUserContentControllerProxies)
webUserContentControllerProxy->removeProcess(*this);
@@ -392,40 +392,17 @@
if (endsUsingDataStore == EndsUsingDataStore::Yes)
m_processPool->pageEndUsingWebsiteDataStore(webPage.pageID(), webPage.websiteDataStore());
- removeVisitedLinkStoreUser(webPage.visitedLinkStore(), webPage.pageID());
-
updateBackgroundResponsivenessTimer();
maybeShutDown();
}
-void WebProcessProxy::addVisitedLinkStoreUser(VisitedLinkStore& visitedLinkStore, uint64_t pageID)
+void WebProcessProxy::addVisitedLinkStore(VisitedLinkStore& store)
{
- auto users = m_visitedLinkStoresWithUsers.ensure(&visitedLinkStore, [] {
- return HashSet<uint64_t> { };
- }).iterator->value;
-
- ASSERT(!users.contains(pageID));
- users.add(pageID);
-
- if (users.size() == 1 && state() == State::Running)
- visitedLinkStore.addProcess(*this);
+ m_visitedLinkStores.add(&store);
+ store.addProcess(*this);
}
-void WebProcessProxy::removeVisitedLinkStoreUser(VisitedLinkStore& visitedLinkStore, uint64_t pageID)
-{
- auto it = m_visitedLinkStoresWithUsers.find(&visitedLinkStore);
- if (it == m_visitedLinkStoresWithUsers.end())
- return;
-
- auto& users = it->value;
- users.remove(pageID);
- if (users.isEmpty()) {
- m_visitedLinkStoresWithUsers.remove(it);
- visitedLinkStore.removeProcess(*this);
- }
-}
-
void WebProcessProxy::addWebUserContentControllerProxy(WebUserContentControllerProxy& proxy, WebPageCreationParameters& parameters)
{
m_webUserContentControllerProxies.add(&proxy);
@@ -432,6 +409,12 @@
proxy.addProcess(*this, parameters);
}
+void WebProcessProxy::didDestroyVisitedLinkStore(VisitedLinkStore& store)
+{
+ ASSERT(m_visitedLinkStores.contains(&store));
+ m_visitedLinkStores.remove(&store);
+}
+
void WebProcessProxy::didDestroyWebUserContentControllerProxy(WebUserContentControllerProxy& proxy)
{
ASSERT(m_webUserContentControllerProxies.contains(&proxy));
@@ -756,14 +739,22 @@
return;
}
+ for (WebPageProxy* page : m_pageMap.values()) {
+ ASSERT(this == &page->process());
+ page->processDidFinishLaunching();
+ }
+
+ for (auto* provisionalPage : m_provisionalPages) {
+ ASSERT(this == &provisionalPage->process());
+ provisionalPage->processDidFinishLaunching();
+ }
+
+
RELEASE_ASSERT(!m_webConnection);
m_webConnection = WebConnectionToWebProcess::create(this);
m_processPool->processDidFinishLaunching(this);
- for (auto* visitedLinkStore : m_visitedLinkStoresWithUsers.keys())
- visitedLinkStore->addProcess(*this);
-
#if PLATFORM(IOS_FAMILY)
if (connection()) {
if (xpc_connection_t xpcConnection = connection()->xpcConnection())
Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.h (243153 => 243154)
--- trunk/Source/WebKit/UIProcess/WebProcessProxy.h 2019-03-19 18:25:21 UTC (rev 243153)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.h 2019-03-19 18:38:59 UTC (rev 243154)
@@ -146,12 +146,9 @@
virtual bool isServiceWorkerProcess() const { return false; }
- void didCreateWebPageInProcess(uint64_t pageID);
-
- void addVisitedLinkStoreUser(VisitedLinkStore&, uint64_t pageID);
- void removeVisitedLinkStoreUser(VisitedLinkStore&, uint64_t pageID);
-
+ void addVisitedLinkStore(VisitedLinkStore&);
void addWebUserContentControllerProxy(WebUserContentControllerProxy&, WebPageCreationParameters&);
+ void didDestroyVisitedLinkStore(VisitedLinkStore&);
void didDestroyWebUserContentControllerProxy(WebUserContentControllerProxy&);
RefPtr<API::UserInitiatedAction> userInitiatedActivity(uint64_t);
@@ -431,7 +428,7 @@
HashSet<ProvisionalPageProxy*> m_provisionalPages;
UserInitiatedActionMap m_userInitiatedActionMap;
- HashMap<VisitedLinkStore*, HashSet<uint64_t/* pageID */>> m_visitedLinkStoresWithUsers;
+ HashSet<VisitedLinkStore*> m_visitedLinkStores;
HashSet<WebUserContentControllerProxy*> m_webUserContentControllerProxies;
int m_numberOfTimesSuddenTerminationWasDisabled;