REGRESSION (r243094): ePub files do not render or open in Books
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Mar 2019 16:27:14 +0000 (16:27 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Mar 2019 16:27:14 +0000 (16:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196119
<rdar://problem/49121686>

Reviewed by Brady Eidson.

Do not delay the WebProcess launch until a load when contructing a web view and the client
may observe when its injected bundle is loaded via WKProcessGroupDelegate's
didCreateConnectionToWebProcessPlugIn.

* UIProcess/API/Cocoa/WKProcessGroup.mm:
(-[WKProcessGroup setDelegate:]):
* UIProcess/WebInspectorUtilities.cpp:
(WebKit::inspectorProcessPool):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::createWebPage):
* UIProcess/WebProcessPool.h:

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

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/WKProcessGroup.mm
Source/WebKit/UIProcess/WebInspectorUtilities.cpp
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/UIProcess/WebProcessPool.h

index 810a8fa..ef69908 100644 (file)
@@ -1,3 +1,23 @@
+2019-03-22  Chris Dumez  <cdumez@apple.com>
+
+        REGRESSION (r243094): ePub files do not render or open in Books
+        https://bugs.webkit.org/show_bug.cgi?id=196119
+        <rdar://problem/49121686>
+
+        Reviewed by Brady Eidson.
+
+        Do not delay the WebProcess launch until a load when contructing a web view and the client
+        may observe when its injected bundle is loaded via WKProcessGroupDelegate's
+        didCreateConnectionToWebProcessPlugIn.
+
+        * UIProcess/API/Cocoa/WKProcessGroup.mm:
+        (-[WKProcessGroup setDelegate:]):
+        * UIProcess/WebInspectorUtilities.cpp:
+        (WebKit::inspectorProcessPool):
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::createWebPage):
+        * UIProcess/WebProcessPool.h:
+
 2019-03-22  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         REGRESSION(r243094): Automation: browser crash in WebAutomationSession::exitFullscreenWindowForPage()
index 8877aa8..8bec061 100644 (file)
@@ -215,6 +215,11 @@ static void setUpHistoryClient(WKProcessGroup *processGroup, WKContextRef contex
 - (void)setDelegate:(id <WKProcessGroupDelegate>)delegate
 {
     _delegate = delegate;
+
+    // If the client can observe when the connection to the WebProcess injected bundle is established, then we cannot
+    // safely delay the launch of the WebProcess until something is loaded in the Web view.
+    if ([delegate respondsToSelector:@selector(processGroup:didCreateConnectionToWebProcessPlugIn:)])
+        _processPool->disableDelayedWebProcessLaunch();
 }
 
 @end
index 3b49ce0..07b9bc6 100644 (file)
@@ -82,6 +82,8 @@ WebProcessPool& inspectorProcessPool(unsigned inspectionLevel)
     if (!pool) {
         auto configuration = API::ProcessPoolConfiguration::createWithLegacyOptions();
         pool = &WebProcessPool::create(configuration.get()).leakRef();
+        // Do not delay process launch for inspector pages as inspector pages do not know how to transition from a terminated process.
+        pool->disableDelayedWebProcessLaunch();
     }
     return *pool;
 }
index 407e873..5214a57 100644 (file)
@@ -1218,10 +1218,7 @@ Ref<WebPageProxy> WebProcessPool::createWebPage(PageClient& pageClient, Ref<API:
         // We do not support several WebsiteDataStores sharing a single process.
         ASSERT(process.get() == m_dummyProcessProxy || &pageConfiguration->websiteDataStore()->websiteDataStore() == &process->websiteDataStore());
         ASSERT(&pageConfiguration->relatedPage()->websiteDataStore() == &pageConfiguration->websiteDataStore()->websiteDataStore());
-    } else if (WebKit::isInspectorProcessPool(*this)) {
-        // Do not delay process launch for inspector pages as inspector pages do not know how to transition from a terminated process.
-        process = &processForRegistrableDomain(pageConfiguration->websiteDataStore()->websiteDataStore(), nullptr, { });
-    } else {
+    } else if (!m_isDelayedWebProcessLaunchDisabled) {
         // In the common case, we delay process launch until something is actually loaded in the page.
         if (!m_dummyProcessProxy) {
             auto dummyProcessProxy = WebProcessProxy::create(*this, WebsiteDataStore::createNonPersistent().get(), WebProcessProxy::IsPrewarmed::No, WebProcessProxy::ShouldLaunchProcess::No);
@@ -1229,7 +1226,9 @@ Ref<WebPageProxy> WebProcessPool::createWebPage(PageClient& pageClient, Ref<API:
             m_processes.append(WTFMove(dummyProcessProxy));
         }
         process = m_dummyProcessProxy;
-    }
+    } else
+        process = &processForRegistrableDomain(pageConfiguration->websiteDataStore()->websiteDataStore(), nullptr, { });
+
     ASSERT(process);
 
     auto page = process->createWebPage(pageClient, WTFMove(pageConfiguration));
index 9774115..217f324 100644 (file)
@@ -505,6 +505,8 @@ public:
     void setWebProcessHasUploads(WebCore::ProcessIdentifier);
     void clearWebProcessHasUploads(WebCore::ProcessIdentifier);
 
+    void disableDelayedWebProcessLaunch() { m_isDelayedWebProcessLaunchDisabled = true; }
+
 private:
     void platformInitialize();
 
@@ -785,6 +787,7 @@ private:
 
     HashMap<WebCore::ProcessIdentifier, std::unique_ptr<ProcessAssertion>> m_processesWithUploads;
     std::unique_ptr<ProcessAssertion> m_uiProcessUploadAssertion;
+    bool m_isDelayedWebProcessLaunchDisabled { false };
 };
 
 template<typename T>