<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[244510] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/244510">244510</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2019-04-22 14:08:07 -0700 (Mon, 22 Apr 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>Unreviewed, rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/244502">r244502</a>.

Caused crashes on the bots

Reverted changeset:

"Delayed WebProcessLaunch may break the _relatedWebView SPI"
https://bugs.webkit.org/show_bug.cgi?id=197160
https://trac.webkit.org/changeset/244502</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebPageProxycpp">trunk/Source/WebKit/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebPageProxyh">trunk/Source/WebKit/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebProcessPoolcpp">trunk/Source/WebKit/UIProcess/WebProcessPool.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKitCocoaProcessSwapOnNavigationmm">trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (244509 => 244510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2019-04-22 19:57:58 UTC (rev 244509)
+++ trunk/Source/WebKit/ChangeLog       2019-04-22 21:08:07 UTC (rev 244510)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2019-04-22  Chris Dumez  <cdumez@apple.com>
+
+        Unreviewed, rolling out r244502.
+
+        Caused crashes on the bots
+
+        Reverted changeset:
+
+        "Delayed WebProcessLaunch may break the _relatedWebView SPI"
+        https://bugs.webkit.org/show_bug.cgi?id=197160
+        https://trac.webkit.org/changeset/244502
+
</ins><span class="cx"> 2019-04-22  Ryan Haddad  <ryanhaddad@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r244437.
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (244509 => 244510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp   2019-04-22 19:57:58 UTC (rev 244509)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp      2019-04-22 21:08:07 UTC (rev 244510)
</span><span class="lines">@@ -727,11 +727,7 @@
</span><span class="cx">     m_process->removeMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_pageID);
</span><span class="cx"> 
</span><span class="cx">     auto& processPool = m_process->processPool();
</span><del>-
-    if (auto* relatedPage = m_configuration->relatedPage())
-        m_process = relatedPage->ensureRunningProcess();
-    else
-        m_process = processPool.processForRegistrableDomain(m_websiteDataStore.get(), this, registrableDomain);
</del><ins>+    m_process = processPool.processForRegistrableDomain(m_websiteDataStore.get(), this, registrableDomain);
</ins><span class="cx">     m_hasRunningProcess = true;
</span><span class="cx"> 
</span><span class="cx">     m_process->addExistingWebPage(*this, WebProcessProxy::BeginsUsingDataStore::Yes);
</span><span class="lines">@@ -1076,14 +1072,6 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-WebProcessProxy& WebPageProxy::ensureRunningProcess()
-{
-    if (!hasRunningProcess())
-        launchProcess({ });
-
-    return m_process;
-}
-
</del><span class="cx"> RefPtr<API::Navigation> WebPageProxy::loadRequest(ResourceRequest&& request, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, API::Object* userData)
</span><span class="cx"> {
</span><span class="cx">     if (m_isClosed)
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (244509 => 244510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebPageProxy.h     2019-04-22 19:57:58 UTC (rev 244509)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h        2019-04-22 21:08:07 UTC (rev 244510)
</span><span class="lines">@@ -1083,7 +1083,6 @@
</span><span class="cx">     bool isValidKeypressCommandName(const String& name) const { return m_knownKeypressCommandNames.contains(name); }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    WebProcessProxy& ensureRunningProcess();
</del><span class="cx">     WebProcessProxy& process() { return m_process; }
</span><span class="cx">     ProcessID processIdentifier() const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebProcessPoolcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (244509 => 244510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2019-04-22 19:57:58 UTC (rev 244509)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp    2019-04-22 21:08:07 UTC (rev 244510)
</span><span class="lines">@@ -1210,18 +1210,13 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     RefPtr<WebProcessProxy> process;
</span><del>-
-    if (m_isDelayedWebProcessLaunchDisabled) {
-        if (pageConfiguration->relatedPage()) {
-            // Sharing processes, e.g. when creating the page via window.open().
-            // Make sure the related page's process is not the dummy one.
-            process = &pageConfiguration->relatedPage()->ensureRunningProcess();
-            // 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
-            process = &processForRegistrableDomain(pageConfiguration->websiteDataStore()->websiteDataStore(), nullptr, { });
-    } else {
</del><ins>+    if (pageConfiguration->relatedPage()) {
+        // Sharing processes, e.g. when creating the page via window.open().
+        process = &pageConfiguration->relatedPage()->process();
+        // 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 (!m_isDelayedWebProcessLaunchDisabled) {
</ins><span class="cx">         // In the common case, we delay process launch until something is actually loaded in the page.
</span><span class="cx">         if (!m_dummyProcessProxy) {
</span><span class="cx">             auto dummyProcessProxy = WebProcessProxy::create(*this, nullptr, WebProcessProxy::IsPrewarmed::No, WebProcessProxy::ShouldLaunchProcess::No);
</span><span class="lines">@@ -1229,7 +1224,8 @@
</span><span class="cx">             m_processes.append(WTFMove(dummyProcessProxy));
</span><span class="cx">         }
</span><span class="cx">         process = m_dummyProcessProxy;
</span><del>-    }
</del><ins>+    } else
+        process = &processForRegistrableDomain(pageConfiguration->websiteDataStore()->websiteDataStore(), nullptr, { });
</ins><span class="cx"> 
</span><span class="cx">     ASSERT(process);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (244509 => 244510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2019-04-22 19:57:58 UTC (rev 244509)
+++ trunk/Tools/ChangeLog       2019-04-22 21:08:07 UTC (rev 244510)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2019-04-22  Chris Dumez  <cdumez@apple.com>
+
+        Unreviewed, rolling out r244502.
+
+        Caused crashes on the bots
+
+        Reverted changeset:
+
+        "Delayed WebProcessLaunch may break the _relatedWebView SPI"
+        https://bugs.webkit.org/show_bug.cgi?id=197160
+        https://trac.webkit.org/changeset/244502
+
</ins><span class="cx"> 2019-04-22  Ryan Haddad  <ryanhaddad@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r244437.
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKitCocoaProcessSwapOnNavigationmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (244509 => 244510)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm   2019-04-22 19:57:58 UTC (rev 244509)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm      2019-04-22 21:08:07 UTC (rev 244510)
</span><span class="lines">@@ -4598,46 +4598,6 @@
</span><span class="cx">     runProcessSwapDueToRelatedWebViewTest([NSURL URLWithString:@"pson://www.webkit.org/main1.html"], [NSURL URLWithString:@"pson://www.webkit.org/main2.html"], ExpectSwap::No);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-TEST(ProcessSwap, RelatedWebViewBeforeWebProcessLaunch)
-{
-    auto processPoolConfiguration = psonProcessPoolConfiguration();
-    auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]);
-
-    auto webView1Configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
-    [webView1Configuration setProcessPool:processPool.get()];
-    auto handler = adoptNS([[PSONScheme alloc] init]);
-    [webView1Configuration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"];
-
-    auto webView1 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webView1Configuration.get()]);
-    auto delegate = adoptNS([[PSONNavigationDelegate alloc] init]);
-    [webView1 setNavigationDelegate:delegate.get()];
-
-    auto webView2Configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
-    [webView2Configuration setProcessPool:processPool.get()];
-    [webView2Configuration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"];
-    webView2Configuration.get()._relatedWebView = webView1.get(); // webView2 will be related to webView1 and webView1's URL will be used for process swap decision.
-    auto webView2 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webView2Configuration.get()]);
-    [webView2 setNavigationDelegate:delegate.get()];
-
-    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main1.html"]];
-    [webView1 loadRequest:request];
-
-    TestWebKitAPI::Util::run(&done);
-    done = false;
-
-    auto pid1 = [webView1 _webProcessIdentifier];
-
-    request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main2.html"]];
-    [webView2 loadRequest:request];
-
-    TestWebKitAPI::Util::run(&done);
-    done = false;
-
-    auto pid2 = [webView2 _webProcessIdentifier];
-
-    EXPECT_EQ(pid1, pid2); // WebViews are related so they should share the same process.
-}
-
</del><span class="cx"> TEST(ProcessSwap, TerminatedSuspendedPageProcess)
</span><span class="cx"> {
</span><span class="cx">     auto processPoolConfiguration = psonProcessPoolConfiguration();
</span></span></pre>
</div>
</div>

</body>
</html>