<!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>[202724] 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/202724">202724</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-06-30 22:23:02 -0700 (Thu, 30 Jun 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Source/WebKit2:
Add SPI to allow restoring session state without navigation in WKPage
https://bugs.webkit.org/show_bug.cgi?id=159326

Patch by Tina Liu &lt;iting_liu@apple.com&gt; on 2016-06-30
Reviewed by Brady Eidson.

* UIProcess/API/C/WKPage.cpp:
(restoreFromSessionState):
Added a helper function that takes a bool parameter to specify whether
to navigate or not when restoring from the session state.
(WKPageRestoreFromSessionState):
Calling restoreFromSessionState, passing navigate = true.
(WKPageRestoreFromSessionStateWithoutNavigation):
Ditto but passing navigate = false.
* UIProcess/API/C/WKPagePrivate.h:

Tools:
Add an API test for WKPageRestoreFromSessionStateWithoutNavigation.
https://bugs.webkit.org/show_bug.cgi?id=159326

Patch by Tina Liu &lt;iting_liu@apple.com&gt; on 2016-06-30
Reviewed by Brady Eidson.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/RestoreSessionStateWithoutNavigation.cpp: Added.
(TestWebKitAPI::didFinishLoadForFrame):
(TestWebKitAPI::didChangeBackForwardListForPage):
(TestWebKitAPI::setPageLoaderClient):
Set the page loader client and register for didFinishLoadForFrame and
didChangeBackForwardList callbacks.
(TestWebKitAPI::createSessionStateData):
Load a webpage (&quot;simple.html&quot;) and return the session state for this page.
(TestWebKitAPI::TEST):
Restore the page session state with that of &quot;simple.html&quot; without navigation.
Verify that the committed URL is NULL since there's no navigation involved.
Verify that the current item in the back forward list, which should be what
we restored from the session state, has the expected URL.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKPagecpp">trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKPagePrivateh">trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2RestoreSessionStateWithoutNavigationcpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2/RestoreSessionStateWithoutNavigation.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (202723 => 202724)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-07-01 01:29:47 UTC (rev 202723)
+++ trunk/Source/WebKit2/ChangeLog        2016-07-01 05:23:02 UTC (rev 202724)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-06-30  Tina Liu  &lt;iting_liu@apple.com&gt;
+
+        Add SPI to allow restoring session state without navigation in WKPage
+        https://bugs.webkit.org/show_bug.cgi?id=159326
+
+        Reviewed by Brady Eidson.
+
+        * UIProcess/API/C/WKPage.cpp:
+        (restoreFromSessionState):
+        Added a helper function that takes a bool parameter to specify whether
+        to navigate or not when restoring from the session state.
+        (WKPageRestoreFromSessionState):
+        Calling restoreFromSessionState, passing navigate = true.
+        (WKPageRestoreFromSessionStateWithoutNavigation):
+        Ditto but passing navigate = false.
+        * UIProcess/API/C/WKPagePrivate.h:
+
</ins><span class="cx"> 2016-06-30  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] WebContent processes do not exit promptly
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (202723 => 202724)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp        2016-07-01 01:29:47 UTC (rev 202723)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp        2016-07-01 05:23:02 UTC (rev 202724)
</span><span class="lines">@@ -444,7 +444,7 @@
</span><span class="cx">     return toAPI(&amp;API::SessionState::create(WTFMove(sessionState)).leakRef());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WKPageRestoreFromSessionState(WKPageRef pageRef, WKTypeRef sessionStateRef)
</del><ins>+static void restoreFromSessionState(WKPageRef pageRef, WKTypeRef sessionStateRef, bool navigate)
</ins><span class="cx"> {
</span><span class="cx">     SessionState sessionState;
</span><span class="cx"> 
</span><span class="lines">@@ -458,9 +458,19 @@
</span><span class="cx">         sessionState = toImpl(static_cast&lt;WKSessionStateRef&gt;(sessionStateRef))-&gt;sessionState();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    toImpl(pageRef)-&gt;restoreFromSessionState(WTFMove(sessionState), true);
</del><ins>+    toImpl(pageRef)-&gt;restoreFromSessionState(WTFMove(sessionState), navigate);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WKPageRestoreFromSessionState(WKPageRef pageRef, WKTypeRef sessionStateRef)
+{
+    restoreFromSessionState(pageRef, sessionStateRef, true);
+}
+
+void WKPageRestoreFromSessionStateWithoutNavigation(WKPageRef pageRef, WKTypeRef sessionStateRef)
+{
+    restoreFromSessionState(pageRef, sessionStateRef, false);
+}
+
</ins><span class="cx"> double WKPageGetTextZoomFactor(WKPageRef pageRef)
</span><span class="cx"> {
</span><span class="cx">     return toImpl(pageRef)-&gt;textZoomFactor();
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKPagePrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h (202723 => 202724)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h        2016-07-01 01:29:47 UTC (rev 202723)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h        2016-07-01 05:23:02 UTC (rev 202724)
</span><span class="lines">@@ -145,6 +145,8 @@
</span><span class="cx"> WK_EXPORT bool WKPageGetResourceCachingDisabled(WKPageRef page);
</span><span class="cx"> WK_EXPORT void WKPageSetResourceCachingDisabled(WKPageRef page, bool disabled);
</span><span class="cx"> 
</span><ins>+WK_EXPORT void WKPageRestoreFromSessionStateWithoutNavigation(WKPageRef page, WKTypeRef sessionState);
+
</ins><span class="cx"> #ifdef __cplusplus
</span><span class="cx"> }
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (202723 => 202724)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-07-01 01:29:47 UTC (rev 202723)
+++ trunk/Tools/ChangeLog        2016-07-01 05:23:02 UTC (rev 202724)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2016-06-30  Tina Liu  &lt;iting_liu@apple.com&gt;
+
+        Add an API test for WKPageRestoreFromSessionStateWithoutNavigation.
+        https://bugs.webkit.org/show_bug.cgi?id=159326
+
+        Reviewed by Brady Eidson.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKit2/RestoreSessionStateWithoutNavigation.cpp: Added.
+        (TestWebKitAPI::didFinishLoadForFrame):
+        (TestWebKitAPI::didChangeBackForwardListForPage):
+        (TestWebKitAPI::setPageLoaderClient):
+        Set the page loader client and register for didFinishLoadForFrame and
+        didChangeBackForwardList callbacks.
+        (TestWebKitAPI::createSessionStateData):
+        Load a webpage (&quot;simple.html&quot;) and return the session state for this page.
+        (TestWebKitAPI::TEST):
+        Restore the page session state with that of &quot;simple.html&quot; without navigation.
+        Verify that the committed URL is NULL since there's no navigation involved.
+        Verify that the current item in the back forward list, which should be what
+        we restored from the session state, has the expected URL.
+
</ins><span class="cx"> 2016-06-29  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Generators violate bytecode liveness validation
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (202723 => 202724)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-07-01 01:29:47 UTC (rev 202723)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-07-01 05:23:02 UTC (rev 202724)
</span><span class="lines">@@ -325,6 +325,7 @@
</span><span class="cx">                 7CCE7F2F1A411B1000447C4C /* WKBrowsingContextLoadDelegateTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC3C4C7014575B6A0025FB62 /* WKBrowsingContextLoadDelegateTest.mm */; };
</span><span class="cx">                 7CEFA9661AC0B9E200B910FD /* _WKUserContentExtensionStore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7CEFA9641AC0B9E200B910FD /* _WKUserContentExtensionStore.mm */; };
</span><span class="cx">                 7CFBCAE51743238F00B2BFCF /* WillLoad_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CFBCAE31743238E00B2BFCF /* WillLoad_Bundle.cpp */; };
</span><ins>+                835CF9671D25FCD6001A65D4 /* RestoreSessionStateWithoutNavigation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 835CF9661D25FCD6001A65D4 /* RestoreSessionStateWithoutNavigation.cpp */; };
</ins><span class="cx">                 83CF1C301C4F1B8B00688447 /* StringUtilities.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83CF1C2C1C4F19AE00688447 /* StringUtilities.mm */; };
</span><span class="cx">                 930AD402150698D00067970F /* lots-of-text.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 930AD401150698B30067970F /* lots-of-text.html */; };
</span><span class="cx">                 9361002914DC95A70061379D /* lots-of-iframes.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 9361002814DC957B0061379D /* lots-of-iframes.html */; };
</span><span class="lines">@@ -787,6 +788,7 @@
</span><span class="cx">                 7CFBCADD1743234F00B2BFCF /* WillLoad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WillLoad.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7CFBCAE31743238E00B2BFCF /* WillLoad_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WillLoad_Bundle.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 81B50192140F232300D9EB58 /* StringBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringBuilder.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                835CF9661D25FCD6001A65D4 /* RestoreSessionStateWithoutNavigation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RestoreSessionStateWithoutNavigation.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 83B88A331C80056D00BB2418 /* HTMLParserIdioms.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLParserIdioms.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 83CF1C2C1C4F19AE00688447 /* StringUtilities.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringUtilities.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 86BD19971A2DB05B006DCF0A /* RefCounter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RefCounter.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -1405,6 +1407,7 @@
</span><span class="cx">                                 C0BD669E131D3CFF00E18F2A /* ResponsivenessTimerDoesntFireEarly_Bundle.cpp */,
</span><span class="cx">                                 C0BD669C131D3CF700E18F2A /* ResponsivenessTimerDoesntFireEarly.cpp */,
</span><span class="cx">                                 C0ADBE8212FCA6AA00D2C129 /* RestoreSessionStateContainingFormData.cpp */,
</span><ins>+                                835CF9661D25FCD6001A65D4 /* RestoreSessionStateWithoutNavigation.cpp */,
</ins><span class="cx">                                 2D640B5417875DFF00BFAF99 /* ScrollPinningBehaviors.cpp */,
</span><span class="cx">                                 51FCF7971534AC6D00104491 /* ShouldGoToBackForwardListItem_Bundle.cpp */,
</span><span class="cx">                                 51FCF7981534AC6D00104491 /* ShouldGoToBackForwardListItem.cpp */,
</span><span class="lines">@@ -2109,6 +2112,7 @@
</span><span class="cx">                                 7C417F331D19E14800B8EF53 /* WKWebViewDefaultNavigationDelegate.mm in Sources */,
</span><span class="cx">                                 7CCE7EA61A411A0F00447C4C /* PlatformUtilitiesMac.mm in Sources */,
</span><span class="cx">                                 7CCE7EA71A411A1300447C4C /* PlatformWebViewMac.mm in Sources */,
</span><ins>+                                835CF9671D25FCD6001A65D4 /* RestoreSessionStateWithoutNavigation.cpp in Sources */,
</ins><span class="cx">                                 7CCE7F261A411AF600447C4C /* Preferences.mm in Sources */,
</span><span class="cx">                                 7CCE7F0B1A411AE600447C4C /* PreventEmptyUserAgent.cpp in Sources */,
</span><span class="cx">                                 7C83E0BD1D0A650C00FEBCF3 /* FullscreenTopContentInset.mm in Sources */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2RestoreSessionStateWithoutNavigationcpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/RestoreSessionStateWithoutNavigation.cpp (0 => 202724)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/RestoreSessionStateWithoutNavigation.cpp                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/RestoreSessionStateWithoutNavigation.cpp        2016-07-01 05:23:02 UTC (rev 202724)
</span><span class="lines">@@ -0,0 +1,105 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+
+#if WK_HAVE_C_SPI
+
+#include &quot;JavaScriptTest.h&quot;
+#include &quot;PlatformUtilities.h&quot;
+#include &quot;PlatformWebView.h&quot;
+#include &quot;Test.h&quot;
+#include &lt;WebKit/WKPagePrivate.h&gt;
+#include &lt;WebKit/WKSessionStateRef.h&gt;
+
+namespace TestWebKitAPI {
+
+static bool didFinishLoad;
+static bool didChangeBackForwardList;
+
+static void didFinishLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void*)
+{
+    didFinishLoad = true;
+}
+
+static void didChangeBackForwardListForPage(WKPageRef, WKBackForwardListItemRef addedItem, WKArrayRef, const void*)
+{
+    didChangeBackForwardList = true;
+}
+
+static void setPageLoaderClient(WKPageRef page)
+{
+    WKPageLoaderClientV0 loaderClient;
+    memset(&amp;loaderClient, 0, sizeof(loaderClient));
+
+    loaderClient.base.version = 0;
+    loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
+    loaderClient.didChangeBackForwardList = didChangeBackForwardListForPage;
+
+    WKPageSetPageLoaderClient(page, &amp;loaderClient.base);
+}
+
+static WKRetainPtr&lt;WKDataRef&gt; createSessionStateData(WKContextRef context)
+{
+    PlatformWebView webView(context);
+    setPageLoaderClient(webView.page());
+
+    WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource(&quot;simple&quot;, &quot;html&quot;)).get());
+    Util::run(&amp;didFinishLoad);
+    didFinishLoad = false;
+
+    auto sessionState = adoptWK(static_cast&lt;WKSessionStateRef&gt;(WKPageCopySessionState(webView.page(), reinterpret_cast&lt;void*&gt;(1), nullptr)));
+    return adoptWK(WKSessionStateCopyData(sessionState.get()));
+}
+
+TEST(WebKit2, RestoreSessionStateWithoutNavigation)
+{
+    WKRetainPtr&lt;WKContextRef&gt; context(AdoptWK, WKContextCreate());
+
+    PlatformWebView webView(context.get());
+    setPageLoaderClient(webView.page());
+
+    WKRetainPtr&lt;WKDataRef&gt; data = createSessionStateData(context.get());
+    EXPECT_NOT_NULL(data);
+
+    auto sessionState = adoptWK(WKSessionStateCreateFromData(data.get()));
+    WKPageRestoreFromSessionStateWithoutNavigation(webView.page(), sessionState.get());
+
+    Util::run(&amp;didChangeBackForwardList);
+
+    WKRetainPtr&lt;WKURLRef&gt; committedURL = adoptWK(WKPageCopyCommittedURL(webView.page()));
+    EXPECT_NULL(committedURL.get());
+
+    auto backForwardList = WKPageGetBackForwardList(webView.page());
+    auto currentItem = WKBackForwardListGetCurrentItem(backForwardList);
+    auto currentItemURL = adoptWK(WKBackForwardListItemCopyURL(currentItem));
+    auto expectedURL = adoptWK(Util::createURLForResource(&quot;simple&quot;, &quot;html&quot;));
+    EXPECT_NOT_NULL(expectedURL);
+    EXPECT_TRUE(WKURLIsEqual(currentItemURL.get(), expectedURL.get()));
+}
+
+} // namespace TestWebKitAPI
+
+#endif
</ins></span></pre>
</div>
</div>

</body>
</html>