<!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>[238179] 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/238179">238179</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2018-11-14 08:58:17 -0800 (Wed, 14 Nov 2018)</dd>
</dl>

<h3>Log Message</h3>
<pre>WebKit.ApplicationManifestBasic API test is failing when enabling PSON
https://bugs.webkit.org/show_bug.cgi?id=191602

Reviewed by Alex Christensen.

Source/WebKit:

Add support for process swapping for a [WKWebView loadHTML:] load by storing
the necessary data on the API::Navigation and doing a loadData() instead of
a loadRequest() after process swapping when this data is present on the
navigation.

* UIProcess/API/APINavigation.cpp:
(API::Navigation::Navigation):
* UIProcess/API/APINavigation.h:
(API::Navigation::create):
(API::Navigation::substituteData const):
* UIProcess/WebNavigationState.cpp:
(WebKit::WebNavigationState::createLoadDataNavigation):
* UIProcess/WebNavigationState.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::loadData):
(WebKit::WebPageProxy::continueNavigationInNewProcess):

Tools:

Add API test coverage.

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPIAPINavigationcpp">trunk/Source/WebKit/UIProcess/API/APINavigation.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPIAPINavigationh">trunk/Source/WebKit/UIProcess/API/APINavigation.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebNavigationStatecpp">trunk/Source/WebKit/UIProcess/WebNavigationState.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebNavigationStateh">trunk/Source/WebKit/UIProcess/WebNavigationState.h</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="#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 (238178 => 238179)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2018-11-14 16:53:25 UTC (rev 238178)
+++ trunk/Source/WebKit/ChangeLog       2018-11-14 16:58:17 UTC (rev 238179)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2018-11-14  Chris Dumez  <cdumez@apple.com>
+
+        WebKit.ApplicationManifestBasic API test is failing when enabling PSON
+        https://bugs.webkit.org/show_bug.cgi?id=191602
+
+        Reviewed by Alex Christensen.
+
+        Add support for process swapping for a [WKWebView loadHTML:] load by storing
+        the necessary data on the API::Navigation and doing a loadData() instead of
+        a loadRequest() after process swapping when this data is present on the
+        navigation.
+
+        * UIProcess/API/APINavigation.cpp:
+        (API::Navigation::Navigation):
+        * UIProcess/API/APINavigation.h:
+        (API::Navigation::create):
+        (API::Navigation::substituteData const):
+        * UIProcess/WebNavigationState.cpp:
+        (WebKit::WebNavigationState::createLoadDataNavigation):
+        * UIProcess/WebNavigationState.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::loadData):
+        (WebKit::WebPageProxy::continueNavigationInNewProcess):
+
</ins><span class="cx"> 2018-11-14  Antti Koivisto  <antti@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Align Mac WK2 layer flush throttling with iOS
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPIAPINavigationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/APINavigation.cpp (238178 => 238179)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/APINavigation.cpp      2018-11-14 16:53:25 UTC (rev 238178)
+++ trunk/Source/WebKit/UIProcess/API/APINavigation.cpp 2018-11-14 16:58:17 UTC (rev 238179)
</span><span class="lines">@@ -59,6 +59,13 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+Navigation::Navigation(WebKit::WebNavigationState& state, std::unique_ptr<SubstituteData>&& substituteData)
+    : Navigation(state)
+{
+    ASSERT(substituteData);
+    m_substituteData = WTFMove(substituteData);
+}
+
</ins><span class="cx"> Navigation::~Navigation()
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPIAPINavigationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/APINavigation.h (238178 => 238179)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/APINavigation.h        2018-11-14 16:53:25 UTC (rev 238178)
+++ trunk/Source/WebKit/UIProcess/API/APINavigation.h   2018-11-14 16:58:17 UTC (rev 238179)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><span class="cx"> #include "APIObject.h"
</span><ins>+#include "DataReference.h"
</ins><span class="cx"> #include "WebBackForwardListItem.h"
</span><span class="cx"> #include <WebCore/Process.h>
</span><span class="cx"> #include <WebCore/ResourceRequest.h>
</span><span class="lines">@@ -42,6 +43,24 @@
</span><span class="cx"> 
</span><span class="cx"> namespace API {
</span><span class="cx"> 
</span><ins>+struct SubstituteData {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    SubstituteData(Vector<uint8_t>&& content, const WTF::String& MIMEType, const WTF::String& encoding, const WTF::String& baseURL, API::Object* userData)
+        : content(WTFMove(content))
+        , MIMEType(MIMEType)
+        , encoding(encoding)
+        , baseURL(baseURL)
+        , userData(userData)
+    { }
+
+    Vector<uint8_t> content;
+    WTF::String MIMEType;
+    WTF::String encoding;
+    WTF::String baseURL;
+    RefPtr<API::Object> userData;
+};
+
</ins><span class="cx"> class Navigation : public ObjectImpl<Object::Type::Navigation> {
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(Navigation);
</span><span class="cx"> public:
</span><span class="lines">@@ -60,6 +79,11 @@
</span><span class="cx">         return adoptRef(*new Navigation(state, WTFMove(request), fromItem));
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    static Ref<Navigation> create(WebKit::WebNavigationState& state, std::unique_ptr<SubstituteData>&& substituteData)
+    {
+        return adoptRef(*new Navigation(state, WTFMove(substituteData)));
+    }
+
</ins><span class="cx">     virtual ~Navigation();
</span><span class="cx"> 
</span><span class="cx">     uint64_t navigationID() const { return m_navigationID; }
</span><span class="lines">@@ -114,10 +138,13 @@
</span><span class="cx">     const char* loggingString() const;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    const std::unique_ptr<SubstituteData>& substituteData() const { return m_substituteData; }
+
</ins><span class="cx"> private:
</span><span class="cx">     explicit Navigation(WebKit::WebNavigationState&);
</span><span class="cx">     Navigation(WebKit::WebNavigationState&, WebCore::ResourceRequest&&, WebKit::WebBackForwardListItem* fromItem);
</span><span class="cx">     Navigation(WebKit::WebNavigationState&, WebKit::WebBackForwardListItem& targetItem, WebKit::WebBackForwardListItem* fromItem, WebCore::FrameLoadType);
</span><ins>+    Navigation(WebKit::WebNavigationState&, std::unique_ptr<SubstituteData>&&);
</ins><span class="cx"> 
</span><span class="cx">     uint64_t m_navigationID;
</span><span class="cx">     WebCore::ResourceRequest m_originalRequest;
</span><span class="lines">@@ -139,6 +166,7 @@
</span><span class="cx">     WebCore::LockHistory m_lockHistory;
</span><span class="cx">     WebCore::LockBackForwardList m_lockBackForwardList;
</span><span class="cx">     WTF::String m_clientRedirectSourceForHistory;
</span><ins>+    std::unique_ptr<SubstituteData> m_substituteData;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace API
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebNavigationStatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebNavigationState.cpp (238178 => 238179)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebNavigationState.cpp     2018-11-14 16:53:25 UTC (rev 238178)
+++ trunk/Source/WebKit/UIProcess/WebNavigationState.cpp        2018-11-14 16:58:17 UTC (rev 238179)
</span><span class="lines">@@ -68,9 +68,9 @@
</span><span class="cx">     return navigation;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Ref<API::Navigation> WebNavigationState::createLoadDataNavigation()
</del><ins>+Ref<API::Navigation> WebNavigationState::createLoadDataNavigation(std::unique_ptr<API::SubstituteData>&& substituteData)
</ins><span class="cx"> {
</span><del>-    auto navigation = API::Navigation::create(*this);
</del><ins>+    auto navigation = API::Navigation::create(*this, WTFMove(substituteData));
</ins><span class="cx"> 
</span><span class="cx">     m_navigations.set(navigation->navigationID(), navigation.ptr());
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebNavigationStateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebNavigationState.h (238178 => 238179)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebNavigationState.h       2018-11-14 16:53:25 UTC (rev 238178)
+++ trunk/Source/WebKit/UIProcess/WebNavigationState.h  2018-11-14 16:58:17 UTC (rev 238179)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace API {
</span><span class="cx"> class Navigation;
</span><ins>+struct SubstituteData;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -51,7 +52,7 @@
</span><span class="cx">     Ref<API::Navigation> createBackForwardNavigation(WebBackForwardListItem& targetItem, WebBackForwardListItem* currentItem, WebCore::FrameLoadType);
</span><span class="cx">     Ref<API::Navigation> createLoadRequestNavigation(WebCore::ResourceRequest&&, WebBackForwardListItem* currentItem);
</span><span class="cx">     Ref<API::Navigation> createReloadNavigation();
</span><del>-    Ref<API::Navigation> createLoadDataNavigation();
</del><ins>+    Ref<API::Navigation> createLoadDataNavigation(std::unique_ptr<API::SubstituteData>&&);
</ins><span class="cx"> 
</span><span class="cx">     API::Navigation* navigation(uint64_t navigationID);
</span><span class="cx">     RefPtr<API::Navigation> takeNavigation(uint64_t navigationID);
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (238178 => 238179)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp   2018-11-14 16:53:25 UTC (rev 238178)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp      2018-11-14 16:58:17 UTC (rev 238179)
</span><span class="lines">@@ -1087,8 +1087,15 @@
</span><span class="cx">     if (m_isClosed)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    auto navigation = m_navigationState->createLoadDataNavigation();
</del><ins>+    auto navigation = m_navigationState->createLoadDataNavigation(std::make_unique<API::SubstituteData>(data.vector(), MIMEType, encoding, baseURL, userData));
+    loadDataWithNavigation(navigation, data, MIMEType, encoding, baseURL, userData);
+    return WTFMove(navigation);
+}
</ins><span class="cx"> 
</span><ins>+void WebPageProxy::loadDataWithNavigation(API::Navigation& navigation, const IPC::DataReference& data, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData)
+{
+    ASSERT(!m_isClosed);
+
</ins><span class="cx">     auto transaction = m_pageLoadState.transaction();
</span><span class="cx"> 
</span><span class="cx">     m_pageLoadState.setPendingAPIRequestURL(transaction, !baseURL.isEmpty() ? baseURL : blankURL().string());
</span><span class="lines">@@ -1097,7 +1104,7 @@
</span><span class="cx">         reattachToWebProcess();
</span><span class="cx"> 
</span><span class="cx">     LoadParameters loadParameters;
</span><del>-    loadParameters.navigationID = navigation->navigationID();
</del><ins>+    loadParameters.navigationID = navigation.navigationID();
</ins><span class="cx">     loadParameters.data = data;
</span><span class="cx">     loadParameters.MIMEType = MIMEType;
</span><span class="cx">     loadParameters.encodingName = encoding;
</span><span class="lines">@@ -1108,8 +1115,6 @@
</span><span class="cx">     m_process->assumeReadAccessToBaseURL(baseURL);
</span><span class="cx">     m_process->send(Messages::WebPage::LoadData(loadParameters), m_pageID);
</span><span class="cx">     m_process->responsivenessTimer().start();
</span><del>-
-    return WTFMove(navigation);
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageProxy::loadAlternateHTML(const IPC::DataReference& htmlData, const String& encoding, const WebCore::URL& baseURL, const WebCore::URL& unreachableURL, API::Object* userData, bool forSafeBrowsing)
</span><span class="lines">@@ -2616,7 +2621,10 @@
</span><span class="cx"> 
</span><span class="cx">     // FIXME: Work out timing of responding with the last policy delegate, etc
</span><span class="cx">     ASSERT(!navigation.currentRequest().isEmpty());
</span><del>-    loadRequestWithNavigation(navigation, ResourceRequest { navigation.currentRequest() }, WebCore::ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes, nullptr, ShouldTreatAsContinuingLoad::Yes);
</del><ins>+    if (auto& substituteData = navigation.substituteData())
+        loadDataWithNavigation(navigation, { substituteData->content.data(), substituteData->content.size() }, substituteData->MIMEType, substituteData->encoding, substituteData->baseURL, substituteData->userData.get());
+    else
+        loadRequestWithNavigation(navigation, ResourceRequest { navigation.currentRequest() }, WebCore::ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes, nullptr, ShouldTreatAsContinuingLoad::Yes);
</ins><span class="cx"> 
</span><span class="cx">     ASSERT(!m_mainFrame);
</span><span class="cx">     m_mainFrameCreationHandler = [this, protectedThis = makeRef(*this), navigation = makeRef(navigation), request =  navigation.currentRequest(), mainFrameURL, isServerRedirect = navigation.currentRequestIsRedirect()]() mutable {
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (238178 => 238179)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebPageProxy.h     2018-11-14 16:53:25 UTC (rev 238178)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h        2018-11-14 16:58:17 UTC (rev 238179)
</span><span class="lines">@@ -1539,6 +1539,7 @@
</span><span class="cx">     RefPtr<API::Navigation> reattachToWebProcessForReload();
</span><span class="cx">     RefPtr<API::Navigation> reattachToWebProcessWithItem(WebBackForwardListItem&);
</span><span class="cx"> 
</span><ins>+    void loadDataWithNavigation(API::Navigation&, const IPC::DataReference&, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData = nullptr);
</ins><span class="cx">     void loadRequestWithNavigation(API::Navigation&, WebCore::ResourceRequest&&, WebCore::ShouldOpenExternalURLsPolicy, API::Object* userData, WebCore::ShouldTreatAsContinuingLoad);
</span><span class="cx"> 
</span><span class="cx">     void requestNotificationPermission(uint64_t notificationID, const String& originString);
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (238178 => 238179)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2018-11-14 16:53:25 UTC (rev 238178)
+++ trunk/Tools/ChangeLog       2018-11-14 16:58:17 UTC (rev 238179)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2018-11-14  Chris Dumez  <cdumez@apple.com>
+
+        WebKit.ApplicationManifestBasic API test is failing when enabling PSON
+        https://bugs.webkit.org/show_bug.cgi?id=191602
+
+        Reviewed by Alex Christensen.
+
+        Add API test coverage.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
+
</ins><span class="cx"> 2018-11-14  Jonathan Bedard  <jbedard@apple.com>
</span><span class="cx"> 
</span><span class="cx">         webkitpy: Refactor port code for devices
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKitCocoaProcessSwapOnNavigationmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (238178 => 238179)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm   2018-11-14 16:53:25 UTC (rev 238178)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm      2018-11-14 16:58:17 UTC (rev 238179)
</span><span class="lines">@@ -2647,6 +2647,46 @@
</span><span class="cx">     EXPECT_WK_STREQ(@"pson://www.webkit.org/main.html", [backForwardList.backItem.URL absoluteString]);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+TEST(ProcessSwap, SwapOnLoadHTMLString)
+{
+    auto processPoolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]);
+    processPoolConfiguration.get().processSwapsOnNavigation = YES;
+    auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]);
+
+    auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
+    [webViewConfiguration setProcessPool:processPool.get()];
+    auto handler = adoptNS([[PSONScheme alloc] init]);
+    [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"pson"];
+
+    auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
+    auto delegate = adoptNS([[PSONNavigationDelegate alloc] init]);
+    [webView setNavigationDelegate:delegate.get()];
+
+    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main.html"]];
+    [webView loadRequest:request];
+
+    TestWebKitAPI::Util::run(&done);
+    done = false;
+
+    auto pid1 = [webView _webProcessIdentifier];
+
+    NSString *htmlString = @"<html><body>substituteData</body></html>";
+    [webView loadHTMLString:htmlString baseURL:[NSURL URLWithString:@"http://example.com"]];
+
+    TestWebKitAPI::Util::run(&done);
+    done = false;
+
+    auto pid2 = [webView _webProcessIdentifier];
+    EXPECT_NE(pid1, pid2);
+
+    [webView evaluateJavaScript:@"document.body.innerText" completionHandler:^(id innerText, NSError *error) {
+        EXPECT_WK_STREQ(@"substituteData", (NSString *)innerText);
+        done = true;
+    }];
+    TestWebKitAPI::Util::run(&done);
+    done = false;
+}
+
</ins><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> 
</span><span class="cx"> TEST(ProcessSwap, GoBackToSuspendedPageWithMainFrameIDThatIsNotOne)
</span></span></pre>
</div>
</div>

</body>
</html>