<!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>[184163] releases/WebKitGTK/webkit-2.8</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/184163">184163</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2015-05-12 00:55:54 -0700 (Tue, 12 May 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/183698">r183698</a> - Back/forward navigation to an error page in Safari breaks the back-forward list
https://bugs.webkit.org/show_bug.cgi?id=144501

Reviewed by Darin Adler.

Test: TestWebKitAPI/Tests/WebKit2Cocoa/LoadAlternateHTMLString.mm

Normally, loading substitute data (such as an error page) creates a new back-forward list
item. FrameLoader has a mechanism that detects when a substitute data load occurs during
handling of a provisional load error and prevents the creation of a new back-forwards list
item in that case if the unreachable URL is the same as the failing provisional URL. This
mechanism was broken in WebKit2, where handling the provisional load error is asynchronous.

The fix is to capture some state (namely, the failing provisional URL) when dispatching the
load error and allow it to be restored when loading the substitute data.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::FrameLoader): Removed initialization of
m_delegateIsHandlingProvisionalLoadError.
(WebCore::FrameLoader::shouldReloadToHandleUnreachableURL): Instead of checking
m_delegateIsHandlingProvisionalLoadError and if true using the provisional document loader’s
URL, check m_provisionalLoadErrorBeingHandledURL.
(WebCore::FrameLoader::checkLoadCompleteForThisFrame): Instead of checking and setting
m_delegateIsHandlingProvisionalLoadError, use m_provisionalLoadErrorBeingHandledURL.
* loader/FrameLoader.h:
(WebCore::FrameLoader::provisionalLoadErrorBeingHandledURL): Added this getter. The client
can call this from its override of dispatchDidFailProvisionalLoad and store the result.
(WebCore::FrameLoader::setProvisionalLoadErrorBeingHandledURL): Added this setter. The
client can call this prior to loading substitute data if it’s done as part of handling a
previously-dispatched didFailProvisionalLoad.

Source/WebKit2:
WebKit2 part of &lt;rdar://problem/8636045&gt; Back/forward navigation to an error page in Safari breaks the back-forward list
https://bugs.webkit.org/show_bug.cgi?id=144501

Reviewed by Darin Adler.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::loadAlternateHTMLString): If this is called during
didFailProvisionalLoadForFrame, send back the provisional URL captured at the time of
failure.
(WebKit::WebPageProxy::didFailProvisionalLoadForFrame): Get the provisioinal URL and keep
it in new member variable m_failingProvisionalLoadURL for the duration of the client’s
handling of this message.
* UIProcess/WebPageProxy.h:

* UIProcess/WebPageProxy.messages.in: Added provisionalURL parameter to
DidFailProvisionalLoadForFrame.

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad): Send the URL for this error
to the UI process.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::loadAlternateHTMLString): Temporarily restore the loader’s state to
reflect the provisional load error being handled.

* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in: Added provisionalLoadErrorURL parameter to
LoadAlternateHTMLString.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit28SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebCoreloaderFrameLoadercpp">releases/WebKitGTK/webkit-2.8/Source/WebCore/loader/FrameLoader.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebCoreloaderFrameLoaderh">releases/WebKitGTK/webkit-2.8/Source/WebCore/loader/FrameLoader.h</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebKit2ChangeLog">releases/WebKitGTK/webkit-2.8/Source/WebKit2/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebKit2UIProcessWebPageProxycpp">releases/WebKitGTK/webkit-2.8/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebKit2UIProcessWebPageProxyh">releases/WebKitGTK/webkit-2.8/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebKit2UIProcessWebPageProxymessagesin">releases/WebKitGTK/webkit-2.8/Source/WebKit2/UIProcess/WebPageProxy.messages.in</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebKit2WebProcessWebCoreSupportWebFrameLoaderClientcpp">releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebKit2WebProcessWebPageWebPagecpp">releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebKit2WebProcessWebPageWebPageh">releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#releasesWebKitGTKwebkit28SourceWebKit2WebProcessWebPageWebPagemessagesin">releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in</a></li>
<li><a href="#releasesWebKitGTKwebkit28ToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">releases/WebKitGTK/webkit-2.8/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit28ToolsTestWebKitAPITestsWebKit2CocoaLoadAlternateHTMLStringmm">releases/WebKitGTK/webkit-2.8/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LoadAlternateHTMLString.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit28SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog (184162 => 184163)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog        2015-05-12 07:40:58 UTC (rev 184162)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog        2015-05-12 07:55:54 UTC (rev 184163)
</span><span class="lines">@@ -1,3 +1,36 @@
</span><ins>+2015-05-01  Dan Bernstein  &lt;mitz@apple.com&gt;
+
+        WebCore part of &lt;rdar://problem/8636045&gt; Back/forward navigation to an error page in Safari breaks the back-forward list
+        https://bugs.webkit.org/show_bug.cgi?id=144501
+
+        Reviewed by Darin Adler.
+
+        Test: TestWebKitAPI/Tests/WebKit2Cocoa/LoadAlternateHTMLString.mm
+
+        Normally, loading substitute data (such as an error page) creates a new back-forward list
+        item. FrameLoader has a mechanism that detects when a substitute data load occurs during
+        handling of a provisional load error and prevents the creation of a new back-forwards list
+        item in that case if the unreachable URL is the same as the failing provisional URL. This
+        mechanism was broken in WebKit2, where handling the provisional load error is asynchronous.
+
+        The fix is to capture some state (namely, the failing provisional URL) when dispatching the
+        load error and allow it to be restored when loading the substitute data.
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::FrameLoader): Removed initialization of
+        m_delegateIsHandlingProvisionalLoadError.
+        (WebCore::FrameLoader::shouldReloadToHandleUnreachableURL): Instead of checking
+        m_delegateIsHandlingProvisionalLoadError and if true using the provisional document loader’s
+        URL, check m_provisionalLoadErrorBeingHandledURL.
+        (WebCore::FrameLoader::checkLoadCompleteForThisFrame): Instead of checking and setting
+        m_delegateIsHandlingProvisionalLoadError, use m_provisionalLoadErrorBeingHandledURL.
+        * loader/FrameLoader.h:
+        (WebCore::FrameLoader::provisionalLoadErrorBeingHandledURL): Added this getter. The client
+        can call this from its override of dispatchDidFailProvisionalLoad and store the result.
+        (WebCore::FrameLoader::setProvisionalLoadErrorBeingHandledURL): Added this setter. The
+        client can call this prior to loading substitute data if it’s done as part of handling a
+        previously-dispatched didFailProvisionalLoad.
+
</ins><span class="cx"> 2015-04-30  Oliver Hunt  &lt;oliver@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         DOM bindings should not be using a reference type to point to a temporary object
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebCoreloaderFrameLoadercpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/loader/FrameLoader.cpp (184162 => 184163)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebCore/loader/FrameLoader.cpp        2015-05-12 07:40:58 UTC (rev 184162)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/loader/FrameLoader.cpp        2015-05-12 07:55:54 UTC (rev 184163)
</span><span class="lines">@@ -220,7 +220,6 @@
</span><span class="cx">     , m_mixedContentChecker(frame)
</span><span class="cx">     , m_state(FrameStateProvisional)
</span><span class="cx">     , m_loadType(FrameLoadType::Standard)
</span><del>-    , m_delegateIsHandlingProvisionalLoadError(false)
</del><span class="cx">     , m_quickRedirectComing(false)
</span><span class="cx">     , m_sentRedirectNotification(false)
</span><span class="cx">     , m_inStopAllLoaders(false)
</span><span class="lines">@@ -1515,13 +1514,10 @@
</span><span class="cx">     // case handles well-formed URLs that can't be loaded, and the latter
</span><span class="cx">     // case handles malformed URLs and unknown schemes. Loading alternate content
</span><span class="cx">     // at other times behaves like a standard load.
</span><del>-    DocumentLoader* compareDocumentLoader = 0;
</del><span class="cx">     if (policyChecker().delegateIsDecidingNavigationPolicy() || policyChecker().delegateIsHandlingUnimplementablePolicy())
</span><del>-        compareDocumentLoader = m_policyDocumentLoader.get();
-    else if (m_delegateIsHandlingProvisionalLoadError)
-        compareDocumentLoader = m_provisionalDocumentLoader.get();
</del><ins>+        return m_policyDocumentLoader &amp;&amp; unreachableURL == m_policyDocumentLoader-&gt;request().url();
</ins><span class="cx"> 
</span><del>-    return compareDocumentLoader &amp;&amp; unreachableURL == compareDocumentLoader-&gt;request().url();
</del><ins>+    return unreachableURL == m_provisionalLoadErrorBeingHandledURL;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FrameLoader::reloadWithOverrideEncoding(const String&amp; encoding)
</span><span class="lines">@@ -2175,7 +2171,7 @@
</span><span class="cx"> 
</span><span class="cx">     switch (m_state) {
</span><span class="cx">         case FrameStateProvisional: {
</span><del>-            if (m_delegateIsHandlingProvisionalLoadError)
</del><ins>+            if (!m_provisionalLoadErrorBeingHandledURL.isEmpty())
</ins><span class="cx">                 return;
</span><span class="cx"> 
</span><span class="cx">             RefPtr&lt;DocumentLoader&gt; pdl = m_provisionalDocumentLoader;
</span><span class="lines">@@ -2197,9 +2193,9 @@
</span><span class="cx">             // Only reset if we aren't already going to a new provisional item.
</span><span class="cx">             bool shouldReset = !history().provisionalItem();
</span><span class="cx">             if (!pdl-&gt;isLoadingInAPISense() || pdl-&gt;isStopping()) {
</span><del>-                m_delegateIsHandlingProvisionalLoadError = true;
</del><ins>+                m_provisionalLoadErrorBeingHandledURL = m_provisionalDocumentLoader-&gt;url();
</ins><span class="cx">                 m_client.dispatchDidFailProvisionalLoad(error);
</span><del>-                m_delegateIsHandlingProvisionalLoadError = false;
</del><ins>+                m_provisionalLoadErrorBeingHandledURL = { };
</ins><span class="cx"> 
</span><span class="cx">                 ASSERT(!pdl-&gt;isLoading());
</span><span class="cx"> 
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebCoreloaderFrameLoaderh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/loader/FrameLoader.h (184162 => 184163)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebCore/loader/FrameLoader.h        2015-05-12 07:40:58 UTC (rev 184162)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/loader/FrameLoader.h        2015-05-12 07:55:54 UTC (rev 184163)
</span><span class="lines">@@ -287,6 +287,9 @@
</span><span class="cx"> 
</span><span class="cx">     void forcePageTransitionIfNeeded();
</span><span class="cx"> 
</span><ins>+    const URL&amp; provisionalLoadErrorBeingHandledURL() const { return m_provisionalLoadErrorBeingHandledURL; }
+    void setProvisionalLoadErrorBeingHandledURL(const URL&amp; url) { m_provisionalLoadErrorBeingHandledURL = url; }
+
</ins><span class="cx"> private:
</span><span class="cx">     enum FormSubmissionCacheLoadPolicy {
</span><span class="cx">         MayAttemptCacheOnlyLoadForFormSubmissionItem,
</span><span class="lines">@@ -398,7 +401,7 @@
</span><span class="cx">     RefPtr&lt;DocumentLoader&gt; m_provisionalDocumentLoader;
</span><span class="cx">     RefPtr&lt;DocumentLoader&gt; m_policyDocumentLoader;
</span><span class="cx"> 
</span><del>-    bool m_delegateIsHandlingProvisionalLoadError;
</del><ins>+    URL m_provisionalLoadErrorBeingHandledURL;
</ins><span class="cx"> 
</span><span class="cx">     bool m_quickRedirectComing;
</span><span class="cx">     bool m_sentRedirectNotification;
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebKit2/ChangeLog (184162 => 184163)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebKit2/ChangeLog        2015-05-12 07:40:58 UTC (rev 184162)
+++ releases/WebKitGTK/webkit-2.8/Source/WebKit2/ChangeLog        2015-05-12 07:55:54 UTC (rev 184163)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2015-05-01  Dan Bernstein  &lt;mitz@apple.com&gt;
+
+        WebKit2 part of &lt;rdar://problem/8636045&gt; Back/forward navigation to an error page in Safari breaks the back-forward list
+        https://bugs.webkit.org/show_bug.cgi?id=144501
+
+        Reviewed by Darin Adler.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::loadAlternateHTMLString): If this is called during
+        didFailProvisionalLoadForFrame, send back the provisional URL captured at the time of
+        failure.
+        (WebKit::WebPageProxy::didFailProvisionalLoadForFrame): Get the provisioinal URL and keep
+        it in new member variable m_failingProvisionalLoadURL for the duration of the client’s
+        handling of this message.
+        * UIProcess/WebPageProxy.h:
+
+        * UIProcess/WebPageProxy.messages.in: Added provisionalURL parameter to
+        DidFailProvisionalLoadForFrame.
+
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad): Send the URL for this error
+        to the UI process.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::loadAlternateHTMLString): Temporarily restore the loader’s state to
+        reflect the provisional load error being handled.
+
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in: Added provisionalLoadErrorURL parameter to
+        LoadAlternateHTMLString.
+
</ins><span class="cx"> 2015-04-24  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [SOUP] Use a webkit subdirectory for the disk cache
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebKit2/UIProcess/WebPageProxy.cpp (184162 => 184163)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebKit2/UIProcess/WebPageProxy.cpp        2015-05-12 07:40:58 UTC (rev 184162)
+++ releases/WebKitGTK/webkit-2.8/Source/WebKit2/UIProcess/WebPageProxy.cpp        2015-05-12 07:55:54 UTC (rev 184163)
</span><span class="lines">@@ -923,7 +923,7 @@
</span><span class="cx"> 
</span><span class="cx">     m_process-&gt;assumeReadAccessToBaseURL(baseURL);
</span><span class="cx">     m_process-&gt;assumeReadAccessToBaseURL(unreachableURL);
</span><del>-    m_process-&gt;send(Messages::WebPage::LoadAlternateHTMLString(htmlString, baseURL, unreachableURL, UserData(process().transformObjectsToHandles(userData).get())), m_pageID);
</del><ins>+    m_process-&gt;send(Messages::WebPage::LoadAlternateHTMLString(htmlString, baseURL, unreachableURL, m_failingProvisionalLoadURL, UserData(process().transformObjectsToHandles(userData).get())), m_pageID);
</ins><span class="cx">     m_process-&gt;responsivenessTimer()-&gt;start();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2742,7 +2742,7 @@
</span><span class="cx">         m_loaderClient-&gt;didReceiveServerRedirectForProvisionalLoadForFrame(*this, *frame, navigation.get(), m_process-&gt;transformHandlesToObjects(userData.object()).get());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPageProxy::didFailProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const ResourceError&amp; error, const UserData&amp; userData)
</del><ins>+void WebPageProxy::didFailProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const String&amp; provisionalURL, const ResourceError&amp; error, const UserData&amp; userData)
</ins><span class="cx"> {
</span><span class="cx">     WebFrameProxy* frame = m_process-&gt;webFrame(frameID);
</span><span class="cx">     MESSAGE_CHECK(frame);
</span><span class="lines">@@ -2760,6 +2760,10 @@
</span><span class="cx">     frame-&gt;didFailProvisionalLoad();
</span><span class="cx"> 
</span><span class="cx">     m_pageLoadState.commitChanges();
</span><ins>+
+    ASSERT(!m_failingProvisionalLoadURL);
+    m_failingProvisionalLoadURL = provisionalURL;
+
</ins><span class="cx">     if (m_navigationClient) {
</span><span class="cx">         if (frame-&gt;isMainFrame())
</span><span class="cx">             m_navigationClient-&gt;didFailProvisionalNavigationWithError(*this, *frame, navigation.get(), error, m_process-&gt;transformHandlesToObjects(userData.object()).get());
</span><span class="lines">@@ -2769,6 +2773,8 @@
</span><span class="cx">         }
</span><span class="cx">     } else
</span><span class="cx">         m_loaderClient-&gt;didFailProvisionalLoadWithErrorForFrame(*this, *frame, navigation.get(), error, m_process-&gt;transformHandlesToObjects(userData.object()).get());
</span><ins>+
+    m_failingProvisionalLoadURL = { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageProxy::clearLoadDependentCallbacks()
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebKit2/UIProcess/WebPageProxy.h (184162 => 184163)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebKit2/UIProcess/WebPageProxy.h        2015-05-12 07:40:58 UTC (rev 184162)
+++ releases/WebKitGTK/webkit-2.8/Source/WebKit2/UIProcess/WebPageProxy.h        2015-05-12 07:55:54 UTC (rev 184163)
</span><span class="lines">@@ -1033,7 +1033,7 @@
</span><span class="cx"> 
</span><span class="cx">     void didStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const String&amp; url, const String&amp; unreachableURL, const UserData&amp;);
</span><span class="cx">     void didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const String&amp;, const UserData&amp;);
</span><del>-    void didFailProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const WebCore::ResourceError&amp;, const UserData&amp;);
</del><ins>+    void didFailProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const String&amp; provisionalURL, const WebCore::ResourceError&amp;, const UserData&amp;);
</ins><span class="cx">     void didCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, const String&amp; mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo&amp;, const UserData&amp;);
</span><span class="cx">     void didFinishDocumentLoadForFrame(uint64_t frameID, uint64_t navigationID, const UserData&amp;);
</span><span class="cx">     void didFinishLoadForFrame(uint64_t frameID, uint64_t navigationID, const UserData&amp;);
</span><span class="lines">@@ -1395,6 +1395,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;WebNavigationState&gt; m_navigationState;
</span><ins>+    String m_failingProvisionalLoadURL;
</ins><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;DrawingAreaProxy&gt; m_drawingArea;
</span><span class="cx"> #if ENABLE(ASYNC_SCROLLING)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebKit2UIProcessWebPageProxymessagesin"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebKit2/UIProcess/WebPageProxy.messages.in (184162 => 184163)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2015-05-12 07:40:58 UTC (rev 184162)
+++ releases/WebKitGTK/webkit-2.8/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2015-05-12 07:55:54 UTC (rev 184163)
</span><span class="lines">@@ -128,7 +128,7 @@
</span><span class="cx">     # Frame load messages
</span><span class="cx">     DidStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, String url, String unreachableURL, WebKit::UserData userData)
</span><span class="cx">     DidReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, String url, WebKit::UserData userData)
</span><del>-    DidFailProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::ResourceError error, WebKit::UserData userData)
</del><ins>+    DidFailProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, String provisionalURL, WebCore::ResourceError error, WebKit::UserData userData)
</ins><span class="cx">     DidCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, String mimeType, bool hasCustomContentProvider, uint32_t loadType, WebCore::CertificateInfo certificateInfo, WebKit::UserData userData)
</span><span class="cx">     DidFailLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::ResourceError error, WebKit::UserData userData)
</span><span class="cx">     DidFinishDocumentLoadForFrame(uint64_t frameID, uint64_t navigationID, WebKit::UserData userData)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebKit2WebProcessWebCoreSupportWebFrameLoaderClientcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (184162 => 184163)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp        2015-05-12 07:40:58 UTC (rev 184162)
+++ releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp        2015-05-12 07:55:54 UTC (rev 184163)
</span><span class="lines">@@ -486,7 +486,7 @@
</span><span class="cx">         navigationID = static_cast&lt;WebDocumentLoader*&gt;(documentLoader)-&gt;navigationID();
</span><span class="cx"> 
</span><span class="cx">     // Notify the UIProcess.
</span><del>-    webPage-&gt;send(Messages::WebPageProxy::DidFailProvisionalLoadForFrame(m_frame-&gt;frameID(), navigationID, error, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
</del><ins>+    webPage-&gt;send(Messages::WebPageProxy::DidFailProvisionalLoadForFrame(m_frame-&gt;frameID(), navigationID, m_frame-&gt;coreFrame()-&gt;loader().provisionalLoadErrorBeingHandledURL(), error, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
</ins><span class="cx"> 
</span><span class="cx">     // If we have a load listener, notify it.
</span><span class="cx">     if (WebFrame::LoadListener* loadListener = m_frame-&gt;loadListener())
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (184162 => 184163)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2015-05-12 07:40:58 UTC (rev 184162)
+++ releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2015-05-12 07:55:54 UTC (rev 184163)
</span><span class="lines">@@ -1133,11 +1133,14 @@
</span><span class="cx">     loadString(navigationID, htmlString, ASCIILiteral(&quot;text/html&quot;), baseURL, URL(), userData);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::loadAlternateHTMLString(const String&amp; htmlString, const String&amp; baseURLString, const String&amp; unreachableURLString, const UserData&amp; userData)
</del><ins>+void WebPage::loadAlternateHTMLString(const String&amp; htmlString, const String&amp; baseURLString, const String&amp; unreachableURLString, const String&amp; provisionalLoadErrorURLString, const UserData&amp; userData)
</ins><span class="cx"> {
</span><span class="cx">     URL baseURL = baseURLString.isEmpty() ? blankURL() : URL(URL(), baseURLString);
</span><span class="cx">     URL unreachableURL = unreachableURLString.isEmpty() ? URL() : URL(URL(), unreachableURLString);
</span><ins>+    URL provisionalLoadErrorURL = provisionalLoadErrorURLString.isEmpty() ? URL() : URL(URL(), provisionalLoadErrorURLString);
+    m_mainFrame-&gt;coreFrame()-&gt;loader().setProvisionalLoadErrorBeingHandledURL(provisionalLoadErrorURL);
</ins><span class="cx">     loadString(0, htmlString, ASCIILiteral(&quot;text/html&quot;), baseURL, unreachableURL, userData);
</span><ins>+    m_mainFrame-&gt;coreFrame()-&gt;loader().setProvisionalLoadErrorBeingHandledURL({ });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPage::loadPlainTextString(const String&amp; string, const UserData&amp; userData)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebPage/WebPage.h (184162 => 184163)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebPage/WebPage.h        2015-05-12 07:40:58 UTC (rev 184162)
+++ releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebPage/WebPage.h        2015-05-12 07:55:54 UTC (rev 184163)
</span><span class="lines">@@ -917,7 +917,7 @@
</span><span class="cx">     void loadRequest(uint64_t navigationID, const WebCore::ResourceRequest&amp;, const SandboxExtension::Handle&amp;, const UserData&amp;);
</span><span class="cx">     void loadData(const IPC::DataReference&amp;, const String&amp; MIMEType, const String&amp; encodingName, const String&amp; baseURL, const UserData&amp;);
</span><span class="cx">     void loadHTMLString(uint64_t navigationID, const String&amp; htmlString, const String&amp; baseURL, const UserData&amp;);
</span><del>-    void loadAlternateHTMLString(const String&amp; htmlString, const String&amp; baseURL, const String&amp; unreachableURL, const UserData&amp;);
</del><ins>+    void loadAlternateHTMLString(const String&amp; htmlString, const String&amp; baseURL, const String&amp; unreachableURL, const String&amp; provisionalLoadErrorURL, const UserData&amp;);
</ins><span class="cx">     void loadPlainTextString(const String&amp;, const UserData&amp;);
</span><span class="cx">     void loadWebArchiveData(const IPC::DataReference&amp;, const UserData&amp;);
</span><span class="cx">     void navigateToURLWithSimulatedClick(const String&amp; url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28SourceWebKit2WebProcessWebPageWebPagemessagesin"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (184162 => 184163)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2015-05-12 07:40:58 UTC (rev 184162)
+++ releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2015-05-12 07:55:54 UTC (rev 184163)
</span><span class="lines">@@ -126,7 +126,7 @@
</span><span class="cx">     LoadRequest(uint64_t navigationID, WebCore::ResourceRequest request, WebKit::SandboxExtension::Handle sandboxExtensionHandle, WebKit::UserData userData)
</span><span class="cx">     LoadData(IPC::DataReference data, String MIMEType, String encoding, String baseURL, WebKit::UserData userData)
</span><span class="cx">     LoadHTMLString(uint64_t navigationID, String htmlString, String baseURL, WebKit::UserData userData)
</span><del>-    LoadAlternateHTMLString(String htmlString, String baseURL, String unreachableURL, WebKit::UserData userData)
</del><ins>+    LoadAlternateHTMLString(String htmlString, String baseURL, String unreachableURL, String provisionalLoadErrorURL, WebKit::UserData userData)
</ins><span class="cx">     LoadPlainTextString(String string, WebKit::UserData userData)
</span><span class="cx">     LoadWebArchiveData(IPC::DataReference webArchiveData, WebKit::UserData userData)
</span><span class="cx">     NavigateToURLWithSimulatedClick(String url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28ToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.8/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (184162 => 184163)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2015-05-12 07:40:58 UTC (rev 184162)
+++ releases/WebKitGTK/webkit-2.8/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2015-05-12 07:55:54 UTC (rev 184163)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx">                 378E64771632655E00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 378E64751632655D00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp */; };
</span><span class="cx">                 378E64791632707400B6C676 /* link-with-title.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 378E647816326FDF00B6C676 /* link-with-title.html */; };
</span><span class="cx">                 379028B914FAC24C007E6B43 /* acceptsFirstMouse.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 379028B814FABE49007E6B43 /* acceptsFirstMouse.html */; };
</span><ins>+                37D36ED71AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37D36ED61AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm */; };
</ins><span class="cx">                 37DC6791140D7D7600ABCCDB /* DOMRangeOfString.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 37DC678F140D7D3A00ABCCDB /* DOMRangeOfString.html */; };
</span><span class="cx">                 37E1064C1697681800B78BD0 /* DOMHTMLTableCellElementCellAbove.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 37E1064B169767F700B78BD0 /* DOMHTMLTableCellElementCellAbove.html */; };
</span><span class="cx">                 4BFDFFA71314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFDFFA61314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp */; };
</span><span class="lines">@@ -464,6 +465,7 @@
</span><span class="cx">                 3799AD3914120A43005EB0C6 /* StringByEvaluatingJavaScriptFromString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringByEvaluatingJavaScriptFromString.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 37A6895D148A9B50005100FA /* SubresourceErrorCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SubresourceErrorCrash.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 37C784DE197C8F2E0010A496 /* RenderedImageFromDOMNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RenderedImageFromDOMNode.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                37D36ED61AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LoadAlternateHTMLString.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 37DC678B140D7C5000ABCCDB /* DOMRangeOfString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMRangeOfString.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 37DC678F140D7D3A00ABCCDB /* DOMRangeOfString.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = DOMRangeOfString.html; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 37E1064A1697676400B78BD0 /* DOMHTMLTableCellCellAbove.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMHTMLTableCellCellAbove.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -793,6 +795,7 @@
</span><span class="cx">                                 C95501BE19AD2FAF0049BE3E /* Preferences.mm */,
</span><span class="cx">                                 7CC3E1FA197E234100BE6252 /* UserContentController.mm */,
</span><span class="cx">                                 0F3B94A51A77266C00DE3272 /* WKWebViewEvaluateJavaScript.mm */,
</span><ins>+                                37D36ED61AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm */,
</ins><span class="cx">                         );
</span><span class="cx">                         name = &quot;WebKit2 Cocoa&quot;;
</span><span class="cx">                         path = WebKit2Cocoa;
</span><span class="lines">@@ -1489,6 +1492,7 @@
</span><span class="cx">                                 7CCE7EDD1A411A9200447C4C /* TimeRanges.cpp in Sources */,
</span><span class="cx">                                 7CCE7ED31A411A7E00447C4C /* TypingStyleCrash.mm in Sources */,
</span><span class="cx">                                 7CCE7EDE1A411A9200447C4C /* URL.cpp in Sources */,
</span><ins>+                                37D36ED71AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm in Sources */,
</ins><span class="cx">                                 7CCE7EB01A411A4400447C4C /* URLExtras.mm in Sources */,
</span><span class="cx">                                 7CCE7F271A411AF600447C4C /* UserContentController.mm in Sources */,
</span><span class="cx">                                 7CCE7F2D1A411B1000447C4C /* UserContentTest.mm in Sources */,
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit28ToolsTestWebKitAPITestsWebKit2CocoaLoadAlternateHTMLStringmm"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.8/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LoadAlternateHTMLString.mm (0 => 184163)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.8/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LoadAlternateHTMLString.mm                                (rev 0)
+++ releases/WebKitGTK/webkit-2.8/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LoadAlternateHTMLString.mm        2015-05-12 07:55:54 UTC (rev 184163)
</span><span class="lines">@@ -0,0 +1,96 @@
</span><ins>+/*
+ * Copyright (C) 2014 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.
+ */
+
+#import &quot;config.h&quot;
+#import &lt;WebKit/WKFoundation.h&gt;
+
+#if WK_API_ENABLED
+
+#import &quot;PlatformUtilities.h&quot;
+#import &quot;Test.h&quot;
+#import &lt;WebKit/WKWebViewPrivate.h&gt;
+#import &lt;wtf/RetainPtr.h&gt;
+
+static bool isDone;
+
+@interface LoadAlternateHTMLStringFromProvisionalLoadErrorController : NSObject &lt;WKNavigationDelegate&gt;
+@end
+
+@implementation LoadAlternateHTMLStringFromProvisionalLoadErrorController
+
+- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error
+{
+    [webView _loadAlternateHTMLString:@&quot;error page&quot; baseURL:nil forUnreachableURL:[NSURL URLWithString:@&quot;data:&quot;]];
+}
+
+- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
+{
+    isDone = true;
+}
+
+@end
+
+static NSString *unloadableURL = @&quot;data:&quot;;
+static NSString *loadableURL = @&quot;data:text/html,no%20error&quot;;
+
+TEST(WKWebView, LoadAlternateHTMLStringFromProvisionalLoadError)
+{
+    auto webView = adoptNS([[WKWebView alloc] init]);
+    auto controller = adoptNS([[LoadAlternateHTMLStringFromProvisionalLoadErrorController alloc] init]);
+    [webView setNavigationDelegate:controller.get()];
+
+    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:unloadableURL]]];
+    TestWebKitAPI::Util::run(&amp;isDone);
+    isDone = false;
+
+    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:loadableURL]]];
+    TestWebKitAPI::Util::run(&amp;isDone);
+    isDone = false;
+
+    [webView goBack];
+    TestWebKitAPI::Util::run(&amp;isDone);
+    isDone = false;
+
+    WKBackForwardList *list = [webView backForwardList];
+    EXPECT_EQ((NSUInteger)0, list.backList.count);
+    EXPECT_EQ((NSUInteger)1, list.forwardList.count);
+    EXPECT_STREQ([[list.forwardList.firstObject URL] absoluteString].UTF8String, loadableURL.UTF8String);
+    EXPECT_STREQ([[list.currentItem URL] absoluteString].UTF8String, unloadableURL.UTF8String);
+
+    EXPECT_TRUE([webView canGoForward]);
+    if (![webView canGoForward])
+        return;
+
+    [webView goForward];
+    TestWebKitAPI::Util::run(&amp;isDone);
+    isDone = false;
+
+    EXPECT_EQ((NSUInteger)1, list.backList.count);
+    EXPECT_EQ((NSUInteger)0, list.forwardList.count);
+    EXPECT_STREQ([[list.backList.firstObject URL] absoluteString].UTF8String, unloadableURL.UTF8String);
+    EXPECT_STREQ([[list.currentItem URL] absoluteString].UTF8String, loadableURL.UTF8String);
+}
+
+#endif
</ins></span></pre>
</div>
</div>

</body>
</html>