<!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>[169006] 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/169006">169006</a></dd>
<dt>Author</dt> <dd>ap@apple.com</dd>
<dt>Date</dt> <dd>2014-05-17 22:29:36 -0700 (Sat, 17 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>REGRESSION (NetworkProcess): Trying to use appcache fallback crashes in ApplicationCacheHost::scheduleLoadFallbackResourceFromApplicationCache
https://bugs.webkit.org/show_bug.cgi?id=133007
&lt;rdar://problem/13702706&gt;

appcache tests often fail on the Mac WebKit2 bot
https://bugs.webkit.org/show_bug.cgi?id=82061

Reviewed by Maciej Stachowiak.

Source/WebCore:
Covered by existing tests, which this patch enables.

* WebCore.exp.in: Export ResourceLoader::cancel(const ResourceError&amp;). It used
to be virtual, but marking subclasses final has resulted in the compiler calling
it directly from WebKitLegacy framework. Seeing that no subclass overrides it,
I then made it non-virtual.
Also export ApplicationCacheHost functions that are now used from WebKit2.

* loader/ResourceLoader.h: Made the class abstract (as I didn't realize at first
that it's always either a SubresourceLoader or a NetscapePlugInStreamLoader).
Made ResourceHandleClient functions private, as they should never be called other
than via a ResourceHandleClient pointer.

* loader/NetscapePlugInStreamLoader.h:
* loader/SubresourceLoader.h:
Marked these final.

* loader/ResourceLoader.cpp: (WebCore::ResourceLoader::willSwitchToSubstituteResource):
Added a function to be called when switching to a substitute resource. We still
need a ResourceLoader at this point, as substitute resource will be delivered through
it, but we don't want it to continue its current load.

* loader/appcache/ApplicationCacheHost.cpp:
(WebCore::ApplicationCacheHost::scheduleLoadFallbackResourceFromApplicationCache):
Call the ResourceLoader function instead of using handle, which is null when
using out of process networking.

Source/WebKit2:
* WebProcess/Network/WebResourceLoader.cpp:
(WebKit::WebResourceLoader::willSendRequest):
(WebKit::WebResourceLoader::didReceiveResponseWithCertificateInfo):
(WebKit::WebResourceLoader::didFailResourceLoad):
Perform the same appcache checks that ResourceHandleClient implementation in ResourceLoader
does. We should eventually come up with a way to share the code. Perhaps add a class that
isolates ResourceLoader from networking details? But ResourceLoader was itself supposed
to be the class that isolates DocumentLoader from networking details. So, unsure.

LayoutTests:
* platform/mac-wk2/TestExpectations: Let's enable all the appcache tests (except
for a couple that fail), and see what happens on bots. I don't see any reason
why WebKit2 would be any more flaky than WebKit1 here.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2TestExpectations">trunk/LayoutTests/platform/mac-wk2/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreloaderNetscapePlugInStreamLoaderh">trunk/Source/WebCore/loader/NetscapePlugInStreamLoader.h</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoadercpp">trunk/Source/WebCore/loader/ResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoaderh">trunk/Source/WebCore/loader/ResourceLoader.h</a></li>
<li><a href="#trunkSourceWebCoreloaderSubresourceLoaderh">trunk/Source/WebCore/loader/SubresourceLoader.h</a></li>
<li><a href="#trunkSourceWebCoreloaderappcacheApplicationCacheHostcpp">trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessNetworkWebResourceLoadercpp">trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (169005 => 169006)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-05-18 03:44:23 UTC (rev 169005)
+++ trunk/LayoutTests/ChangeLog        2014-05-18 05:29:36 UTC (rev 169006)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-05-17  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        REGRESSION (NetworkProcess): Trying to use appcache fallback crashes in ApplicationCacheHost::scheduleLoadFallbackResourceFromApplicationCache
+        https://bugs.webkit.org/show_bug.cgi?id=133007
+        &lt;rdar://problem/13702706&gt;
+
+        appcache tests often fail on the Mac WebKit2 bot
+        https://bugs.webkit.org/show_bug.cgi?id=82061
+
+        Reviewed by Maciej Stachowiak.
+
+        * platform/mac-wk2/TestExpectations: Let's enable all the appcache tests (except
+        for a couple that fail), and see what happens on bots. I don't see any reason
+        why WebKit2 would be any more flaky than WebKit1 here.
+
</ins><span class="cx"> 2014-05-17  Piotr Grad  &lt;p.grad@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Setting playback rate on video with media controller is not ignored.
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (169005 => 169006)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/TestExpectations        2014-05-18 03:44:23 UTC (rev 169005)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations        2014-05-18 05:29:36 UTC (rev 169006)
</span><span class="lines">@@ -177,10 +177,6 @@
</span><span class="cx"> # https://bugs.webkit.org/show_bug.cgi?id=81833
</span><span class="cx"> fast/events/drag-link.html
</span><span class="cx"> 
</span><del>-# appcache tests often fail on the Mac WebKit2 bot
-# https://bugs.webkit.org/show_bug.cgi?id=82061 rdar://problem/11108649
-http/tests/appcache
-
</del><span class="cx"> # flaky storage tests
</span><span class="cx"> # https://bugs.webkit.org/show_bug.cgi?id=82679
</span><span class="cx"> storage/websql/statement-success-callback-isolated-world.html
</span><span class="lines">@@ -355,6 +351,8 @@
</span><span class="cx"> # Subpixel wrong cliprect on WK2
</span><span class="cx"> webkit.org/b/132100 fast/forms/hidpi-textarea-on-subpixel-position.html [ ImageOnlyFailure ]
</span><span class="cx"> 
</span><ins>+webkit.org/b/93980 http/tests/appcache/load-from-appcache-defer-resume-crash.html [ Skip ]
+
</ins><span class="cx"> ### END OF (1) Classified failures with bug reports
</span><span class="cx"> ########################################
</span><span class="cx"> 
</span><span class="lines">@@ -376,6 +374,9 @@
</span><span class="cx"> editing/spelling/spelling-insert-html.html
</span><span class="cx"> editing/spelling/spelling-marker-description.html
</span><span class="cx"> 
</span><ins>+# This test times out, likely because appcache still loads in WebProcess, not NetworkProcess
+http/tests/appcache/auth.html [ Skip ]
+
</ins><span class="cx"> ### END OF (2) Classified failures without bug reports (yet)
</span><span class="cx"> ########################################
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (169005 => 169006)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-05-18 03:44:23 UTC (rev 169005)
+++ trunk/Source/WebCore/ChangeLog        2014-05-18 05:29:36 UTC (rev 169006)
</span><span class="lines">@@ -1,3 +1,41 @@
</span><ins>+2014-05-17  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        REGRESSION (NetworkProcess): Trying to use appcache fallback crashes in ApplicationCacheHost::scheduleLoadFallbackResourceFromApplicationCache
+        https://bugs.webkit.org/show_bug.cgi?id=133007
+        &lt;rdar://problem/13702706&gt;
+
+        appcache tests often fail on the Mac WebKit2 bot
+        https://bugs.webkit.org/show_bug.cgi?id=82061
+
+        Reviewed by Maciej Stachowiak.
+
+        Covered by existing tests, which this patch enables.
+
+        * WebCore.exp.in: Export ResourceLoader::cancel(const ResourceError&amp;). It used
+        to be virtual, but marking subclasses final has resulted in the compiler calling
+        it directly from WebKitLegacy framework. Seeing that no subclass overrides it,
+        I then made it non-virtual.
+        Also export ApplicationCacheHost functions that are now used from WebKit2.
+
+        * loader/ResourceLoader.h: Made the class abstract (as I didn't realize at first
+        that it's always either a SubresourceLoader or a NetscapePlugInStreamLoader).
+        Made ResourceHandleClient functions private, as they should never be called other
+        than via a ResourceHandleClient pointer.
+
+        * loader/NetscapePlugInStreamLoader.h:
+        * loader/SubresourceLoader.h:
+        Marked these final.
+
+        * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::willSwitchToSubstituteResource):
+        Added a function to be called when switching to a substitute resource. We still
+        need a ResourceLoader at this point, as substitute resource will be delivered through
+        it, but we don't want it to continue its current load.
+
+        * loader/appcache/ApplicationCacheHost.cpp:
+        (WebCore::ApplicationCacheHost::scheduleLoadFallbackResourceFromApplicationCache):
+        Call the ResourceLoader function instead of using handle, which is null when
+        using out of process networking.
+
</ins><span class="cx"> 2014-05-17  Andreas Kling  &lt;akling@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         We shouldn't make a ScrollingThread on iOS.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (169005 => 169006)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-05-18 03:44:23 UTC (rev 169005)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-05-18 05:29:36 UTC (rev 169006)
</span><span class="lines">@@ -377,6 +377,7 @@
</span><span class="cx"> __ZN7WebCore14ResourceHandle6createEPNS_17NetworkingContextERKNS_15ResourceRequestEPNS_20ResourceHandleClientEbb
</span><span class="cx"> __ZN7WebCore14ResourceLoader14cancelledErrorEv
</span><span class="cx"> __ZN7WebCore14ResourceLoader32didCancelAuthenticationChallengeERKNS_23AuthenticationChallengeE
</span><ins>+__ZN7WebCore14ResourceLoader6cancelERKNS_13ResourceErrorE
</ins><span class="cx"> __ZN7WebCore14ResourceLoader6cancelEv
</span><span class="cx"> __ZN7WebCore14SQLiteDatabase11tableExistsERKN3WTF6StringE
</span><span class="cx"> __ZN7WebCore14SQLiteDatabase12lastErrorMsgEv
</span><span class="lines">@@ -824,6 +825,9 @@
</span><span class="cx"> __ZN7WebCore19getFileCreationTimeERKN3WTF6StringERl
</span><span class="cx"> __ZN7WebCore19toInt32EnforceRangeEPN3JSC9ExecStateENS0_7JSValueE
</span><span class="cx"> __ZN7WebCore20ApplicationCacheHost17maybeLoadResourceEPNS_14ResourceLoaderERKNS_15ResourceRequestERKNS_3URLE
</span><ins>+__ZN7WebCore20ApplicationCacheHost25maybeLoadFallbackForErrorEPNS_14ResourceLoaderERKNS_13ResourceErrorE
+__ZN7WebCore20ApplicationCacheHost28maybeLoadFallbackForResponseEPNS_14ResourceLoaderERKNS_16ResourceResponseE
+__ZN7WebCore20ApplicationCacheHost28maybeLoadFallbackForRedirectEPNS_14ResourceLoaderERNS_15ResourceRequestERKNS_16ResourceResponseE
</ins><span class="cx"> __ZN7WebCore20CachedResourceLoader31garbageCollectDocumentResourcesEv
</span><span class="cx"> __ZN7WebCore20DictationAlternativeC1Ejjy
</span><span class="cx"> __ZN7WebCore20DictationAlternativeC1Ev
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderNetscapePlugInStreamLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/NetscapePlugInStreamLoader.h (169005 => 169006)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/NetscapePlugInStreamLoader.h        2014-05-18 03:44:23 UTC (rev 169005)
+++ trunk/Source/WebCore/loader/NetscapePlugInStreamLoader.h        2014-05-18 05:29:36 UTC (rev 169006)
</span><span class="lines">@@ -48,7 +48,7 @@
</span><span class="cx">     virtual ~NetscapePlugInStreamLoaderClient() { }
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-class NetscapePlugInStreamLoader : public ResourceLoader {
</del><ins>+class NetscapePlugInStreamLoader final : public ResourceLoader {
</ins><span class="cx"> public:
</span><span class="cx">     static PassRefPtr&lt;NetscapePlugInStreamLoader&gt; create(Frame*, NetscapePlugInStreamLoaderClient*, const ResourceRequest&amp;);
</span><span class="cx">     virtual ~NetscapePlugInStreamLoader();
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoader.cpp (169005 => 169006)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceLoader.cpp        2014-05-18 03:44:23 UTC (rev 169005)
+++ trunk/Source/WebCore/loader/ResourceLoader.cpp        2014-05-18 05:29:36 UTC (rev 169006)
</span><span class="lines">@@ -207,6 +207,13 @@
</span><span class="cx">         m_resourceData = 0;
</span><span class="cx"> }
</span><span class="cx">     
</span><ins>+void ResourceLoader::willSwitchToSubstituteResource()
+{
+    ASSERT(!m_documentLoader-&gt;isSubstituteLoadPending(this));
+    platformStrategies()-&gt;loaderStrategy()-&gt;resourceLoadScheduler()-&gt;remove(this);
+    if (m_handle)
+        m_handle-&gt;cancel();
+}
</ins><span class="cx"> 
</span><span class="cx"> void ResourceLoader::addDataOrBuffer(const char* data, unsigned length, SharedBuffer* buffer, DataPayloadType dataPayloadType)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoader.h (169005 => 169006)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceLoader.h        2014-05-18 03:44:23 UTC (rev 169005)
+++ trunk/Source/WebCore/loader/ResourceLoader.h        2014-05-18 05:29:36 UTC (rev 169006)
</span><span class="lines">@@ -55,7 +55,7 @@
</span><span class="cx"> 
</span><span class="cx"> class ResourceLoader : public RefCounted&lt;ResourceLoader&gt;, protected ResourceHandleClient {
</span><span class="cx"> public:
</span><del>-    virtual ~ResourceLoader();
</del><ins>+    virtual ~ResourceLoader() = 0;
</ins><span class="cx"> 
</span><span class="cx">     void cancel();
</span><span class="cx"> 
</span><span class="lines">@@ -69,14 +69,13 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     virtual const ResourceRequest&amp; iOSOriginalRequest() const { return request(); }
</span><del>-    virtual RetainPtr&lt;CFDictionaryRef&gt; connectionProperties(ResourceHandle*) override;
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     FrameLoader* frameLoader() const;
</span><span class="cx">     DocumentLoader* documentLoader() const { return m_documentLoader.get(); }
</span><span class="cx">     const ResourceRequest&amp; originalRequest() const { return m_originalRequest; }
</span><span class="cx">     
</span><del>-    virtual void cancel(const ResourceError&amp;);
</del><ins>+    void cancel(const ResourceError&amp;);
</ins><span class="cx">     ResourceError cancelledError();
</span><span class="cx">     ResourceError blockedError();
</span><span class="cx">     ResourceError cannotShowURLError();
</span><span class="lines">@@ -114,46 +113,6 @@
</span><span class="cx"> #endif
</span><span class="cx">     virtual void receivedCancellation(const AuthenticationChallenge&amp;);
</span><span class="cx"> 
</span><del>-    // ResourceHandleClient
-    virtual void willSendRequest(ResourceHandle*, ResourceRequest&amp;, const ResourceResponse&amp; redirectResponse) override;
-    virtual void didSendData(ResourceHandle*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override;
-    virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&amp;) override;
-    virtual void didReceiveData(ResourceHandle*, const char*, unsigned, int encodedDataLength) override;
-    virtual void didReceiveBuffer(ResourceHandle*, PassRefPtr&lt;SharedBuffer&gt;, int encodedDataLength) override;
-    virtual void didFinishLoading(ResourceHandle*, double finishTime) override;
-    virtual void didFail(ResourceHandle*, const ResourceError&amp;) override;
-    virtual void wasBlocked(ResourceHandle*) override;
-    virtual void cannotShowURL(ResourceHandle*) override;
-    virtual bool shouldUseCredentialStorage(ResourceHandle*) override { return shouldUseCredentialStorage(); }
-    virtual void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&amp; challenge) override { didReceiveAuthenticationChallenge(challenge); } 
-    virtual void didCancelAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&amp; challenge) override { didCancelAuthenticationChallenge(challenge); } 
-    virtual void receivedCancellation(ResourceHandle*, const AuthenticationChallenge&amp; challenge) override { receivedCancellation(challenge); }
-
-#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
-    virtual void didReceiveDataArray(ResourceHandle*, CFArrayRef dataArray) override;
-#endif
-
-#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
-    virtual bool canAuthenticateAgainstProtectionSpace(ResourceHandle*, const ProtectionSpace&amp; protectionSpace) override { return canAuthenticateAgainstProtectionSpace(protectionSpace); }
-#endif
-
-#if PLATFORM(COCOA) &amp;&amp; USE(CFNETWORK)
-    virtual CFCachedURLResponseRef willCacheResponse(ResourceHandle*, CFCachedURLResponseRef) override;
-#endif
-
-#if PLATFORM(WIN) &amp;&amp; USE(CFNETWORK)
-    // FIXME: Windows should use willCacheResponse - &lt;https://bugs.webkit.org/show_bug.cgi?id=57257&gt;.
-    virtual bool shouldCacheResponse(ResourceHandle*, CFCachedURLResponseRef) override;
-#endif
-
-#if PLATFORM(COCOA) &amp;&amp; !USE(CFNETWORK)
-    virtual NSCachedURLResponse* willCacheResponse(ResourceHandle*, NSCachedURLResponse*) override;
-#endif
-
-#if USE(QUICK_LOOK)
-    virtual void didCreateQuickLookHandle(QuickLookHandle&amp;) override;
-#endif
-
</del><span class="cx">     const URL&amp; url() const { return m_request.url(); }
</span><span class="cx">     ResourceHandle* handle() const { return m_handle.get(); }
</span><span class="cx">     bool shouldSendResourceLoadCallbacks() const { return m_options.sendLoadCallbacks == SendCallbacks; }
</span><span class="lines">@@ -167,6 +126,8 @@
</span><span class="cx"> 
</span><span class="cx">     void setDataBufferingPolicy(DataBufferingPolicy);
</span><span class="cx"> 
</span><ins>+    void willSwitchToSubstituteResource();
+
</ins><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">     void schedule(WTF::SchedulePair&amp;);
</span><span class="cx">     void unschedule(WTF::SchedulePair&amp;);
</span><span class="lines">@@ -200,6 +161,43 @@
</span><span class="cx"> 
</span><span class="cx">     void addDataOrBuffer(const char*, unsigned, SharedBuffer*, DataPayloadType);
</span><span class="cx"> 
</span><ins>+    // ResourceHandleClient
+    virtual void willSendRequest(ResourceHandle*, ResourceRequest&amp;, const ResourceResponse&amp; redirectResponse) override;
+    virtual void didSendData(ResourceHandle*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override;
+    virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&amp;) override;
+    virtual void didReceiveData(ResourceHandle*, const char*, unsigned, int encodedDataLength) override;
+    virtual void didReceiveBuffer(ResourceHandle*, PassRefPtr&lt;SharedBuffer&gt;, int encodedDataLength) override;
+    virtual void didFinishLoading(ResourceHandle*, double finishTime) override;
+    virtual void didFail(ResourceHandle*, const ResourceError&amp;) override;
+    virtual void wasBlocked(ResourceHandle*) override;
+    virtual void cannotShowURL(ResourceHandle*) override;
+#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
+    virtual void didReceiveDataArray(ResourceHandle*, CFArrayRef dataArray) override;
+#endif
+    virtual bool shouldUseCredentialStorage(ResourceHandle*) override { return shouldUseCredentialStorage(); }
+    virtual void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&amp; challenge) override { didReceiveAuthenticationChallenge(challenge); } 
+    virtual void didCancelAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&amp; challenge) override { didCancelAuthenticationChallenge(challenge); } 
+#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
+    virtual bool canAuthenticateAgainstProtectionSpace(ResourceHandle*, const ProtectionSpace&amp; protectionSpace) override { return canAuthenticateAgainstProtectionSpace(protectionSpace); }
+#endif
+    virtual void receivedCancellation(ResourceHandle*, const AuthenticationChallenge&amp; challenge) override { receivedCancellation(challenge); }
+#if PLATFORM(COCOA) &amp;&amp; !USE(CFNETWORK)
+    virtual NSCachedURLResponse* willCacheResponse(ResourceHandle*, NSCachedURLResponse*) override;
+#endif
+#if PLATFORM(COCOA) &amp;&amp; USE(CFNETWORK)
+    virtual CFCachedURLResponseRef willCacheResponse(ResourceHandle*, CFCachedURLResponseRef) override;
+#endif
+#if PLATFORM(IOS)
+    virtual RetainPtr&lt;CFDictionaryRef&gt; connectionProperties(ResourceHandle*) override;
+#endif
+#if PLATFORM(WIN) &amp;&amp; USE(CFNETWORK)
+    // FIXME: Windows should use willCacheResponse - &lt;https://bugs.webkit.org/show_bug.cgi?id=57257&gt;.
+    virtual bool shouldCacheResponse(ResourceHandle*, CFCachedURLResponseRef) override;
+#endif
+#if USE(QUICK_LOOK)
+    virtual void didCreateQuickLookHandle(QuickLookHandle&amp;) override;
+#endif
+
</ins><span class="cx">     ResourceRequest m_request;
</span><span class="cx">     ResourceRequest m_originalRequest; // Before redirects.
</span><span class="cx">     RefPtr&lt;ResourceBuffer&gt; m_resourceData;
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderSubresourceLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/SubresourceLoader.h (169005 => 169006)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/SubresourceLoader.h        2014-05-18 03:44:23 UTC (rev 169005)
+++ trunk/Source/WebCore/loader/SubresourceLoader.h        2014-05-18 05:29:36 UTC (rev 169006)
</span><span class="lines">@@ -42,7 +42,7 @@
</span><span class="cx"> class PageActivityAssertionToken;
</span><span class="cx"> class ResourceRequest;
</span><span class="cx"> 
</span><del>-class SubresourceLoader : public ResourceLoader {
</del><ins>+class SubresourceLoader final : public ResourceLoader {
</ins><span class="cx"> public:
</span><span class="cx">     static PassRefPtr&lt;SubresourceLoader&gt; create(Frame*, CachedResource*, const ResourceRequest&amp;, const ResourceLoaderOptions&amp;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderappcacheApplicationCacheHostcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp (169005 => 169006)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp        2014-05-18 03:44:23 UTC (rev 169005)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp        2014-05-18 05:29:36 UTC (rev 169006)
</span><span class="lines">@@ -399,10 +399,10 @@
</span><span class="cx">     if (!getApplicationCacheFallbackResource(loader-&gt;request(), resource, cache))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><ins>+    loader-&gt;willSwitchToSubstituteResource();
+
</ins><span class="cx">     m_documentLoader-&gt;m_pendingSubstituteResources.set(loader, resource);
</span><span class="cx">     m_documentLoader-&gt;deliverSubstituteResourcesAfterDelay();
</span><del>-    
-    loader-&gt;handle()-&gt;cancel();
</del><span class="cx"> 
</span><span class="cx">     return true;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (169005 => 169006)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-05-18 03:44:23 UTC (rev 169005)
+++ trunk/Source/WebKit2/ChangeLog        2014-05-18 05:29:36 UTC (rev 169006)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2014-05-17  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        REGRESSION (NetworkProcess): Trying to use appcache fallback crashes in ApplicationCacheHost::scheduleLoadFallbackResourceFromApplicationCache
+        https://bugs.webkit.org/show_bug.cgi?id=133007
+        &lt;rdar://problem/13702706&gt;
+
+        appcache tests often fail on the Mac WebKit2 bot
+        https://bugs.webkit.org/show_bug.cgi?id=82061
+
+        Reviewed by Maciej Stachowiak.
+
+        * WebProcess/Network/WebResourceLoader.cpp:
+        (WebKit::WebResourceLoader::willSendRequest):
+        (WebKit::WebResourceLoader::didReceiveResponseWithCertificateInfo):
+        (WebKit::WebResourceLoader::didFailResourceLoad):
+        Perform the same appcache checks that ResourceHandleClient implementation in ResourceLoader
+        does. We should eventually come up with a way to share the code. Perhaps add a class that
+        isolates ResourceLoader from networking details? But ResourceLoader was itself supposed
+        to be the class that isolates DocumentLoader from networking details. So, unsure.
+
</ins><span class="cx"> 2014-05-17  Jae Hyun Park  &lt;jaepark@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         [EFL] Remove m_contentPosition from PageViewportControllerClientEfl
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessNetworkWebResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp (169005 => 169006)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp        2014-05-18 03:44:23 UTC (rev 169005)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp        2014-05-18 05:29:36 UTC (rev 169006)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> #include &quot;WebCoreArgumentCoders.h&quot;
</span><span class="cx"> #include &quot;WebErrors.h&quot;
</span><span class="cx"> #include &quot;WebProcess.h&quot;
</span><ins>+#include &lt;WebCore/ApplicationCacheHost.h&gt;
</ins><span class="cx"> #include &lt;WebCore/CertificateInfo.h&gt;
</span><span class="cx"> #include &lt;WebCore/DocumentLoader.h&gt;
</span><span class="cx"> #include &lt;WebCore/ResourceBuffer.h&gt;
</span><span class="lines">@@ -84,8 +85,10 @@
</span><span class="cx">     LOG(Network, &quot;(WebProcess) WebResourceLoader::willSendRequest to '%s'&quot;, proposedRequest.url().string().utf8().data());
</span><span class="cx"> 
</span><span class="cx">     Ref&lt;WebResourceLoader&gt; protect(*this);
</span><del>-    
</del><ins>+
</ins><span class="cx">     ResourceRequest newRequest = proposedRequest;
</span><ins>+    if (m_coreLoader-&gt;documentLoader()-&gt;applicationCacheHost()-&gt;maybeLoadFallbackForRedirect(m_coreLoader.get(), newRequest, redirectResponse))
+        return;
</ins><span class="cx">     m_coreLoader-&gt;willSendRequest(newRequest, redirectResponse);
</span><span class="cx">     
</span><span class="cx">     if (!m_coreLoader)
</span><span class="lines">@@ -120,6 +123,8 @@
</span><span class="cx">     responseCopy.setSoupMessageCertificate(certificateInfo.certificate());
</span><span class="cx">     responseCopy.setSoupMessageTLSErrors(certificateInfo.tlsErrors());
</span><span class="cx"> #endif
</span><ins>+    if (m_coreLoader-&gt;documentLoader()-&gt;applicationCacheHost()-&gt;maybeLoadFallbackForResponse(m_coreLoader.get(), responseCopy))
+        return;
</ins><span class="cx">     m_coreLoader-&gt;didReceiveResponse(responseCopy);
</span><span class="cx"> 
</span><span class="cx">     // If m_coreLoader becomes null as a result of the didReceiveResponse callback, we can't use the send function(). 
</span><span class="lines">@@ -163,6 +168,8 @@
</span><span class="cx">     if (m_quickLookHandle)
</span><span class="cx">         m_quickLookHandle-&gt;didFail();
</span><span class="cx"> #endif
</span><ins>+    if (m_coreLoader-&gt;documentLoader()-&gt;applicationCacheHost()-&gt;maybeLoadFallbackForError(m_coreLoader.get(), error))
+        return;
</ins><span class="cx">     m_coreLoader-&gt;didFail(error);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>