<!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>[169429] trunk/Tools</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/169429">169429</a></dd>
<dt>Author</dt> <dd>jhoneycutt@apple.com</dd>
<dt>Date</dt> <dd>2014-05-28 12:21:11 -0700 (Wed, 28 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Need an API test for bug #133193 (<a href="http://trac.webkit.org/projects/webkit/changeset/169315">r169315</a>)
&lt;https://bugs.webkit.org/show_bug.cgi?id=133324&gt;

This adds an API test that ensures that calling &quot;stop loading&quot; during a
&quot;did fail provisional load&quot; callback doesn't crash.

Reviewed by Andy Estes.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
Add new files to project.

* TestWebKitAPI/Tests/WebKit2/StopLoadingDuringDidFailProvisionalLoad.cpp: Added.
(TestWebKitAPI::didReceiveMessageFromInjectedBundle):
If the message is the &quot;test done&quot; message, record that.
(TestWebKitAPI::setInjectedBundleClient):
Register a function for the &quot;did receive message from injected bundle&quot;
callback.
(TestWebKitAPI::didFailProvisionalLoadWithErrorForFrame):
Assert that we received the message from the injected bundle, and set
'done' to finish the test.
(TestWebKitAPI::TEST):
Create a WebView, register a page loader client for the &quot;did fail
provisional load&quot; callback, and load a non-existent resource.

* TestWebKitAPI/Tests/WebKit2/StopLoadingDuringDidFailProvisionalLoad_bundle.cpp: Added.
(TestWebKitAPI::StopLoadingDuringDidFailProvisionalLoadTest::StopLoadingDuringDidFailProvisionalLoadTest):
(TestWebKitAPI::didFailProvisionalLoadWithErrorForFrameCallback):
Tell the StopLoadingDuringDidFailProvisionalLoadTest object that the
provisional load failed.
(TestWebKitAPI::StopLoadingDuringDidFailProvisionalLoadTest::didCreatePage):
Register a page loader client for the &quot;did fail provisional load&quot;
callback.
(TestWebKitAPI::StopLoadingDuringDidFailProvisionalLoadTest::didFailProvisionalLoad):
Call WKBundlePageStopLoading() during the callback. This not crashing
is what we're ensuring with this test.</pre>

<h3>Modified Paths</h3>
<ul>
<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="#trunkToolsTestWebKitAPITestsWebKit2StopLoadingDuringDidFailProvisionalLoadcpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2/StopLoadingDuringDidFailProvisionalLoad.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2StopLoadingDuringDidFailProvisionalLoad_bundlecpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2/StopLoadingDuringDidFailProvisionalLoad_bundle.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (169428 => 169429)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-05-28 18:59:38 UTC (rev 169428)
+++ trunk/Tools/ChangeLog        2014-05-28 19:21:11 UTC (rev 169429)
</span><span class="lines">@@ -1,3 +1,41 @@
</span><ins>+2014-05-27  Jon Honeycutt  &lt;jhoneycutt@apple.com&gt;
+
+        Need an API test for bug #133193 (r169315)
+        &lt;https://bugs.webkit.org/show_bug.cgi?id=133324&gt;
+
+        This adds an API test that ensures that calling &quot;stop loading&quot; during a
+        &quot;did fail provisional load&quot; callback doesn't crash.
+
+        Reviewed by Andy Estes.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        Add new files to project.
+
+        * TestWebKitAPI/Tests/WebKit2/StopLoadingDuringDidFailProvisionalLoad.cpp: Added.
+        (TestWebKitAPI::didReceiveMessageFromInjectedBundle):
+        If the message is the &quot;test done&quot; message, record that.
+        (TestWebKitAPI::setInjectedBundleClient):
+        Register a function for the &quot;did receive message from injected bundle&quot;
+        callback.
+        (TestWebKitAPI::didFailProvisionalLoadWithErrorForFrame):
+        Assert that we received the message from the injected bundle, and set
+        'done' to finish the test.
+        (TestWebKitAPI::TEST):
+        Create a WebView, register a page loader client for the &quot;did fail
+        provisional load&quot; callback, and load a non-existent resource.
+
+        * TestWebKitAPI/Tests/WebKit2/StopLoadingDuringDidFailProvisionalLoad_bundle.cpp: Added.
+        (TestWebKitAPI::StopLoadingDuringDidFailProvisionalLoadTest::StopLoadingDuringDidFailProvisionalLoadTest):
+        (TestWebKitAPI::didFailProvisionalLoadWithErrorForFrameCallback):
+        Tell the StopLoadingDuringDidFailProvisionalLoadTest object that the
+        provisional load failed.
+        (TestWebKitAPI::StopLoadingDuringDidFailProvisionalLoadTest::didCreatePage):
+        Register a page loader client for the &quot;did fail provisional load&quot;
+        callback.
+        (TestWebKitAPI::StopLoadingDuringDidFailProvisionalLoadTest::didFailProvisionalLoad):
+        Call WKBundlePageStopLoading() during the callback. This not crashing
+        is what we're ensuring with this test.
+
</ins><span class="cx"> 2014-05-28  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Make it possible to build with FTL enabled
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (169428 => 169429)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2014-05-28 18:59:38 UTC (rev 169428)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2014-05-28 19:21:11 UTC (rev 169429)
</span><span class="lines">@@ -112,6 +112,8 @@
</span><span class="cx">                 52E5CE4914D21EAB003B2BD8 /* ParentFrame_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 52E5CE4814D21EAB003B2BD8 /* ParentFrame_Bundle.cpp */; };
</span><span class="cx">                 7560917819259C59009EF06E /* MemoryCacheAddImageToCacheIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7560917719259C59009EF06E /* MemoryCacheAddImageToCacheIOS.mm */; };
</span><span class="cx">                 75F3134018C171B70041CAEC /* EphemeralSessionPushStateNoHistoryCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 75F3133F18C171B70041CAEC /* EphemeralSessionPushStateNoHistoryCallback.cpp */; };
</span><ins>+                76734999193016DC00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76734997193016DC00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad.cpp */; };
+                7673499D1930C5BB00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad_bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7673499A1930182E00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad_bundle.cpp */; };
</ins><span class="cx">                 76E182DA1547550100F1FADD /* WillSendSubmitEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76E182D91547550100F1FADD /* WillSendSubmitEvent.cpp */; };
</span><span class="cx">                 76E182DD1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76E182DC1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp */; };
</span><span class="cx">                 76E182DF154767E600F1FADD /* auto-submitting-form.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 76E182DE15475A8300F1FADD /* auto-submitting-form.html */; };
</span><span class="lines">@@ -448,6 +450,8 @@
</span><span class="cx">                 52E5CE4814D21EAB003B2BD8 /* ParentFrame_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParentFrame_Bundle.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7560917719259C59009EF06E /* MemoryCacheAddImageToCacheIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MemoryCacheAddImageToCacheIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 75F3133F18C171B70041CAEC /* EphemeralSessionPushStateNoHistoryCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EphemeralSessionPushStateNoHistoryCallback.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                76734997193016DC00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StopLoadingDuringDidFailProvisionalLoad.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7673499A1930182E00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad_bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StopLoadingDuringDidFailProvisionalLoad_bundle.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 76E182D91547550100F1FADD /* WillSendSubmitEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WillSendSubmitEvent.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 76E182DC1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WillSendSubmitEvent_Bundle.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 76E182DE15475A8300F1FADD /* auto-submitting-form.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = &quot;auto-submitting-form.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -804,6 +808,8 @@
</span><span class="cx">                                 75F3133F18C171B70041CAEC /* EphemeralSessionPushStateNoHistoryCallback.cpp */,
</span><span class="cx">                                 1A5FEFDC1270E2A3000E2921 /* EvaluateJavaScript.cpp */,
</span><span class="cx">                                 BCC8B95A12611F4700DE46A4 /* FailedLoad.cpp */,
</span><ins>+                                76734997193016DC00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad.cpp */,
+                                7673499A1930182E00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad_bundle.cpp */,
</ins><span class="cx">                                 1A02C84E125D4A8400E3F4BD /* Find.cpp */,
</span><span class="cx">                                 C51AFB98169F49FF009CCF66 /* FindMatches.mm */,
</span><span class="cx">                                 1ADBEFAD130C689C00D61D19 /* ForceRepaint.cpp */,
</span><span class="lines">@@ -1342,6 +1348,7 @@
</span><span class="cx">                                 BC3C4C7214575B6A0025FB62 /* WKBrowsingContextLoadDelegateTest.mm in Sources */,
</span><span class="cx">                                 93A7EB3D18FA63A4009E7670 /* URLExtras.mm in Sources */,
</span><span class="cx">                                 51E93017156B13E1004C99DF /* WKPageGetScaleFactorNotZero.cpp in Sources */,
</span><ins>+                                76734999193016DC00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad.cpp in Sources */,
</ins><span class="cx">                                 BC7B61AA129A038700D174A4 /* WKPreferences.cpp in Sources */,
</span><span class="cx">                                 BC90995E12567BC100083756 /* WKString.cpp in Sources */,
</span><span class="cx">                                 BC9099941256ACF100083756 /* WKStringJSString.cpp in Sources */,
</span><span class="lines">@@ -1368,6 +1375,7 @@
</span><span class="cx">                                 1AEDE22613E5E7E700E62FE8 /* InjectedBundleControllerMac.mm in Sources */,
</span><span class="cx">                                 378E64771632655E00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp in Sources */,
</span><span class="cx">                                 297234B7173AFAC700983601 /* CustomProtocolsInvalidScheme_Bundle.cpp in Sources */,
</span><ins>+                                7673499D1930C5BB00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad_bundle.cpp in Sources */,
</ins><span class="cx">                                 F660AA1515A61ABF003A1243 /* InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp in Sources */,
</span><span class="cx">                                 BC575A97126E74F1006F0F12 /* InjectedBundleMain.cpp in Sources */,
</span><span class="cx">                                 33DC89141419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp in Sources */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2StopLoadingDuringDidFailProvisionalLoadcpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/StopLoadingDuringDidFailProvisionalLoad.cpp (0 => 169429)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/StopLoadingDuringDidFailProvisionalLoad.cpp                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/StopLoadingDuringDidFailProvisionalLoad.cpp        2014-05-28 19:21:11 UTC (rev 169429)
</span><span class="lines">@@ -0,0 +1,78 @@
</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.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;PlatformUtilities.h&quot;
+#include &quot;PlatformWebView.h&quot;
+#include &quot;Test.h&quot;
+#include &lt;WebKit2/WKRetainPtr.h&gt;
+
+namespace TestWebKitAPI {
+
+static bool done;
+static bool receivedMessageFromBundle;
+
+static void didReceiveMessageFromInjectedBundle(WKContextRef context, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo)
+{
+    if (WKStringIsEqualToUTF8CString(messageName, &quot;StopLoadingDuringDidFailProvisionalLoadTestDone&quot;))
+        receivedMessageFromBundle = true;
+}
+
+static void setInjectedBundleClient(WKContextRef context)
+{
+    WKContextInjectedBundleClientV0 injectedBundleClient;
+    memset(&amp;injectedBundleClient, 0, sizeof(injectedBundleClient));
+
+    injectedBundleClient.didReceiveMessageFromInjectedBundle = didReceiveMessageFromInjectedBundle;
+
+    WKContextSetInjectedBundleClient(context, &amp;injectedBundleClient.base);
+}
+
+static void didFailProvisionalLoadWithErrorForFrame(WKPageRef, WKFrameRef, WKErrorRef, WKTypeRef, const void*)
+{
+    // The injected bundle is notified of the failed load first. If we also receive this callback, the test didn't crash.
+    EXPECT_TRUE(receivedMessageFromBundle);
+    done = true;
+}
+
+TEST(WebKit2, StopLoadingDuringDidFailProvisionalLoadTest)
+{
+    WKRetainPtr&lt;WKContextRef&gt; context(AdoptWK, Util::createContextForInjectedBundleTest(&quot;StopLoadingDuringDidFailProvisionalLoadTest&quot;));
+    setInjectedBundleClient(context.get());
+
+    PlatformWebView webView(context.get());
+
+    WKPageLoaderClientV0 loaderClient;
+    memset(&amp;loaderClient, 0, sizeof(loaderClient));
+    loaderClient.didFailProvisionalLoadWithErrorForFrame = didFailProvisionalLoadWithErrorForFrame;
+    WKPageSetPageLoaderClient(webView.page(), &amp;loaderClient.base);
+
+    WKRetainPtr&lt;WKURLRef&gt; url(AdoptWK, Util::URLForNonExistentResource());
+    WKPageLoadURL(webView.page(), url.get());
+
+    Util::run(&amp;done);
+}
+
+} // namespace TestWebKitAPI
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2StopLoadingDuringDidFailProvisionalLoad_bundlecpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/StopLoadingDuringDidFailProvisionalLoad_bundle.cpp (0 => 169429)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/StopLoadingDuringDidFailProvisionalLoad_bundle.cpp                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/StopLoadingDuringDidFailProvisionalLoad_bundle.cpp        2014-05-28 19:21:11 UTC (rev 169429)
</span><span class="lines">@@ -0,0 +1,76 @@
</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.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;InjectedBundleTest.h&quot;
+#include &quot;PlatformUtilities.h&quot;
+#include &lt;WebKit2/WKBundle.h&gt;
+#include &lt;WebKit2/WKBundleFramePrivate.h&gt;
+#include &lt;WebKit2/WKBundlePage.h&gt;
+#include &lt;WebKit2/WKBundlePagePrivate.h&gt;
+
+namespace TestWebKitAPI {
+
+class StopLoadingDuringDidFailProvisionalLoadTest : public InjectedBundleTest {
+public:
+    StopLoadingDuringDidFailProvisionalLoadTest(const std::string&amp; identifier)
+        : InjectedBundleTest(identifier)
+    {
+    }
+
+    virtual void didCreatePage(WKBundleRef, WKBundlePageRef) override;
+    void didFailProvisionalLoad(WKBundlePageRef, WKBundleFrameRef);
+
+    WKBundleRef m_bundle;
+};
+
+static InjectedBundleTest::Register&lt;StopLoadingDuringDidFailProvisionalLoadTest&gt; registrar(&quot;StopLoadingDuringDidFailProvisionalLoadTest&quot;);
+
+static void didFailProvisionalLoadWithErrorForFrameCallback(WKBundlePageRef page, WKBundleFrameRef frame, WKErrorRef, WKTypeRef*, const void *clientInfo)
+{
+    ((StopLoadingDuringDidFailProvisionalLoadTest*)clientInfo)-&gt;didFailProvisionalLoad(page, frame);
+}
+
+void StopLoadingDuringDidFailProvisionalLoadTest::didCreatePage(WKBundleRef bundle, WKBundlePageRef page)
+{
+    m_bundle = bundle;
+
+    WKBundlePageLoaderClientV2 pageLoaderClient;
+    memset(&amp;pageLoaderClient, 0, sizeof(pageLoaderClient));
+
+    pageLoaderClient.base.version = 2;
+    pageLoaderClient.base.clientInfo = this;
+    pageLoaderClient.didFailProvisionalLoadWithErrorForFrame = didFailProvisionalLoadWithErrorForFrameCallback;
+
+    WKBundlePageSetPageLoaderClient(page, &amp;pageLoaderClient.base);
+}
+
+void StopLoadingDuringDidFailProvisionalLoadTest::didFailProvisionalLoad(WKBundlePageRef page, WKBundleFrameRef)
+{
+    WKBundlePageStopLoading(page);
+    WKBundlePostMessage(m_bundle, Util::toWK(&quot;StopLoadingDuringDidFailProvisionalLoadTestDone&quot;).get(), nullptr);
+}
+
+} // namespace TestWebKitAPI
</ins></span></pre>
</div>
</div>

</body>
</html>