<!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>[163914] 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/163914">163914</a></dd>
<dt>Author</dt> <dd>jpfau@apple.com</dd>
<dt>Date</dt> <dd>2014-02-11 15:07:49 -0800 (Tue, 11 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Bring third-party app cache blocking behavior in line with private browsing app cache blocking behavior
https://bugs.webkit.org/show_bug.cgi?id=128557

Reviewed by Alexey Proskuryakov.

Source/WebCore:

* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::cacheForMainRequest):
(WebCore::ApplicationCacheGroup::selectCache):
(WebCore::ApplicationCacheGroup::selectCacheWithoutManifestURL):
(WebCore::ApplicationCacheGroup::update):
* loader/appcache/ApplicationCacheHost.cpp:
(WebCore::ApplicationCacheHost::maybeLoadMainResource):
(WebCore::ApplicationCacheHost::maybeLoadFallbackForMainResponse):
(WebCore::ApplicationCacheHost::maybeLoadFallbackForMainError):
(WebCore::ApplicationCacheHost::maybeLoadResource):
(WebCore::ApplicationCacheHost::scheduleLoadFallbackResourceFromApplicationCache):
(WebCore::ApplicationCacheHost::isApplicationCacheBlockedForRequest):
* loader/appcache/ApplicationCacheHost.h:

LayoutTests:

* http/tests/security/resources/cross-origin-iframe-for-appcache-allowed.html:
* http/tests/security/resources/cross-origin-iframe-for-appcache.html:
* http/tests/security/resources/same-origin-iframe-for-appcache-blocked.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestshttptestssecurityresourcescrossoriginiframeforappcacheallowedhtml">trunk/LayoutTests/http/tests/security/resources/cross-origin-iframe-for-appcache-allowed.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecurityresourcescrossoriginiframeforappcachehtml">trunk/LayoutTests/http/tests/security/resources/cross-origin-iframe-for-appcache.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecurityresourcessameoriginiframeforappcacheblockedhtml">trunk/LayoutTests/http/tests/security/resources/same-origin-iframe-for-appcache-blocked.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreloaderappcacheApplicationCacheGroupcpp">trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderappcacheApplicationCacheHostcpp">trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderappcacheApplicationCacheHosth">trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (163913 => 163914)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-02-11 23:05:06 UTC (rev 163913)
+++ trunk/LayoutTests/ChangeLog        2014-02-11 23:07:49 UTC (rev 163914)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2014-02-10  Jeffrey Pfau  &lt;jpfau@apple.com&gt;
+
+        Bring third-party app cache blocking behavior in line with private browsing app cache blocking behavior
+        https://bugs.webkit.org/show_bug.cgi?id=128557
+
+        Reviewed by Alexey Proskuryakov.
+
+        * http/tests/security/resources/cross-origin-iframe-for-appcache-allowed.html:
+        * http/tests/security/resources/cross-origin-iframe-for-appcache.html:
+        * http/tests/security/resources/same-origin-iframe-for-appcache-blocked.html:
+
</ins><span class="cx"> 2014-02-11  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         IDB: The test after storage/indexeddb/mozilla/object-identity.html fails in cleanup code
</span></span></pre></div>
<a id="trunkLayoutTestshttptestssecurityresourcescrossoriginiframeforappcacheallowedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/security/resources/cross-origin-iframe-for-appcache-allowed.html (163913 => 163914)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/resources/cross-origin-iframe-for-appcache-allowed.html        2014-02-11 23:05:06 UTC (rev 163913)
+++ trunk/LayoutTests/http/tests/security/resources/cross-origin-iframe-for-appcache-allowed.html        2014-02-11 23:07:49 UTC (rev 163914)
</span><span class="lines">@@ -6,25 +6,19 @@
</span><span class="cx">         cleanup();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function timedOut() {
-        try {
-                applicationCache.update();
-                timer = setTimeout(cleanup, 5000);
-        } catch (e) {
-                document.write('Cache not found');
-                cleanup();
-        }
</del><ins>+function error() {
+        document.write('Cache not found');
+        cleanup();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function cleanup() {
</span><del>-        clearTimeout(timer);
</del><span class="cx">         top.postMessage('done', '*');
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> try {
</span><del>-        timer = setTimeout(timedOut, 5000);
</del><span class="cx">         applicationCache.addEventListener('noupdate', complete, false);
</span><span class="cx">         applicationCache.addEventListener('cached', complete, false);
</span><ins>+        applicationCache.addEventListener('error', error, false);
</ins><span class="cx"> } catch (e) {
</span><span class="cx">         document.write('Cache not found');
</span><span class="cx">         cleanup();
</span></span></pre></div>
<a id="trunkLayoutTestshttptestssecurityresourcescrossoriginiframeforappcachehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/security/resources/cross-origin-iframe-for-appcache.html (163913 => 163914)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/resources/cross-origin-iframe-for-appcache.html        2014-02-11 23:05:06 UTC (rev 163913)
+++ trunk/LayoutTests/http/tests/security/resources/cross-origin-iframe-for-appcache.html        2014-02-11 23:07:49 UTC (rev 163914)
</span><span class="lines">@@ -6,25 +6,19 @@
</span><span class="cx">         cleanup();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function timedOut() {
-        try {
-                applicationCache.update();
-                timer = setTimeout(cleanup, 5000);
-        } catch (e) {
-                document.write('Cache not found');
-                cleanup();
-        }
</del><ins>+function error() {
+        document.write('Cache not found');
+        cleanup();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function cleanup() {
</span><del>-        clearTimeout(timer);
</del><span class="cx">         top.postMessage('done', '*');
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> try {
</span><del>-        timer = setTimeout(timedOut, 5000);
</del><span class="cx">         applicationCache.addEventListener('noupdate', complete, false);
</span><span class="cx">         applicationCache.addEventListener('cached', complete, false);
</span><ins>+        applicationCache.addEventListener('error', error, false);
</ins><span class="cx"> } catch (e) {
</span><span class="cx">         document.write('Cache not found');
</span><span class="cx">         cleanup();
</span></span></pre></div>
<a id="trunkLayoutTestshttptestssecurityresourcessameoriginiframeforappcacheblockedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/security/resources/same-origin-iframe-for-appcache-blocked.html (163913 => 163914)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/resources/same-origin-iframe-for-appcache-blocked.html        2014-02-11 23:05:06 UTC (rev 163913)
+++ trunk/LayoutTests/http/tests/security/resources/same-origin-iframe-for-appcache-blocked.html        2014-02-11 23:07:49 UTC (rev 163914)
</span><span class="lines">@@ -6,25 +6,19 @@
</span><span class="cx">         cleanup();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function timedOut() {
-        try {
-                applicationCache.update();
-                timer = setTimeout(cleanup, 5000);
-        } catch (e) {
-                document.write('Cache not found');
-                cleanup();
-        }
</del><ins>+function error() {
+        document.write('Cache not found');
+        cleanup();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function cleanup() {
</span><del>-        clearTimeout(timer);
</del><span class="cx">         top.postMessage('done', '*');
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> try {
</span><del>-        timer = setTimeout(timedOut, 5000);
</del><span class="cx">         applicationCache.addEventListener('noupdate', complete, false);
</span><span class="cx">         applicationCache.addEventListener('cached', complete, false);
</span><ins>+        applicationCache.addEventListener('error', error, false);
</ins><span class="cx"> } catch (e) {
</span><span class="cx">         document.write('Cache not found');
</span><span class="cx">         cleanup();
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (163913 => 163914)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-11 23:05:06 UTC (rev 163913)
+++ trunk/Source/WebCore/ChangeLog        2014-02-11 23:07:49 UTC (rev 163914)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2014-02-10  Jeffrey Pfau  &lt;jpfau@apple.com&gt;
+
+        Bring third-party app cache blocking behavior in line with private browsing app cache blocking behavior
+        https://bugs.webkit.org/show_bug.cgi?id=128557
+
+        Reviewed by Alexey Proskuryakov.
+
+        * loader/appcache/ApplicationCacheGroup.cpp:
+        (WebCore::ApplicationCacheGroup::cacheForMainRequest):
+        (WebCore::ApplicationCacheGroup::selectCache):
+        (WebCore::ApplicationCacheGroup::selectCacheWithoutManifestURL):
+        (WebCore::ApplicationCacheGroup::update):
+        * loader/appcache/ApplicationCacheHost.cpp:
+        (WebCore::ApplicationCacheHost::maybeLoadMainResource):
+        (WebCore::ApplicationCacheHost::maybeLoadFallbackForMainResponse):
+        (WebCore::ApplicationCacheHost::maybeLoadFallbackForMainError):
+        (WebCore::ApplicationCacheHost::maybeLoadResource):
+        (WebCore::ApplicationCacheHost::scheduleLoadFallbackResourceFromApplicationCache):
+        (WebCore::ApplicationCacheHost::isApplicationCacheBlockedForRequest):
+        * loader/appcache/ApplicationCacheHost.h:
+
</ins><span class="cx"> 2014-02-11  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         IDB: The test after storage/indexeddb/mozilla/object-identity.html fails in cleanup code
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderappcacheApplicationCacheGroupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp (163913 => 163914)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp        2014-02-11 23:05:06 UTC (rev 163913)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp        2014-02-11 23:07:49 UTC (rev 163914)
</span><span class="lines">@@ -105,7 +105,7 @@
</span><span class="cx">     if (url.hasFragmentIdentifier())
</span><span class="cx">         url.removeFragmentIdentifier();
</span><span class="cx"> 
</span><del>-    if (documentLoader-&gt;frame() &amp;&amp; documentLoader-&gt;frame()-&gt;settings().privateBrowsingEnabled())
</del><ins>+    if (documentLoader-&gt;frame() &amp;&amp; (documentLoader-&gt;frame()-&gt;settings().privateBrowsingEnabled() || !documentLoader-&gt;frame()-&gt;document()-&gt;securityOrigin()-&gt;canAccessApplicationCache(documentLoader-&gt;frame()-&gt;tree().top().document()-&gt;securityOrigin())))
</ins><span class="cx">         return 0;
</span><span class="cx"> 
</span><span class="cx">     if (ApplicationCacheGroup* group = cacheStorage().cacheGroupForURL(url)) {
</span><span class="lines">@@ -143,9 +143,6 @@
</span><span class="cx">     
</span><span class="cx">     if (!frame-&gt;settings().offlineWebApplicationCacheEnabled())
</span><span class="cx">         return;
</span><del>-
-    if (!frame-&gt;document()-&gt;securityOrigin()-&gt;canAccessApplicationCache(frame-&gt;tree().top().document()-&gt;securityOrigin()))
-        return;
</del><span class="cx">     
</span><span class="cx">     DocumentLoader* documentLoader = frame-&gt;loader().documentLoader();
</span><span class="cx">     ASSERT(!documentLoader-&gt;applicationCacheHost()-&gt;applicationCache());
</span><span class="lines">@@ -156,7 +153,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Don't access anything on disk if private browsing is enabled.
</span><del>-    if (frame-&gt;settings().privateBrowsingEnabled()) {
</del><ins>+    if (frame-&gt;settings().privateBrowsingEnabled() || !frame-&gt;document()-&gt;securityOrigin()-&gt;canAccessApplicationCache(frame-&gt;tree().top().document()-&gt;securityOrigin())) {
</ins><span class="cx">         postListenerTask(ApplicationCacheHost::CHECKING_EVENT, documentLoader);
</span><span class="cx">         postListenerTask(ApplicationCacheHost::ERROR_EVENT, documentLoader);
</span><span class="cx">         return;
</span><span class="lines">@@ -220,14 +217,11 @@
</span><span class="cx">     if (!frame-&gt;settings().offlineWebApplicationCacheEnabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    if (!frame-&gt;document()-&gt;securityOrigin()-&gt;canAccessApplicationCache(frame-&gt;tree().top().document()-&gt;securityOrigin()))
-        return;
-
</del><span class="cx">     DocumentLoader* documentLoader = frame-&gt;loader().documentLoader();
</span><span class="cx">     ASSERT(!documentLoader-&gt;applicationCacheHost()-&gt;applicationCache());
</span><span class="cx"> 
</span><span class="cx">     // Don't access anything on disk if private browsing is enabled.
</span><del>-    if (frame-&gt;settings().privateBrowsingEnabled()) {
</del><ins>+    if (frame-&gt;settings().privateBrowsingEnabled() || !frame-&gt;document()-&gt;securityOrigin()-&gt;canAccessApplicationCache(frame-&gt;tree().top().document()-&gt;securityOrigin())) {
</ins><span class="cx">         postListenerTask(ApplicationCacheHost::CHECKING_EVENT, documentLoader);
</span><span class="cx">         postListenerTask(ApplicationCacheHost::ERROR_EVENT, documentLoader);
</span><span class="cx">         return;
</span><span class="lines">@@ -442,7 +436,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Don't access anything on disk if private browsing is enabled.
</span><del>-    if (frame-&gt;settings().privateBrowsingEnabled()) {
</del><ins>+    if (frame-&gt;settings().privateBrowsingEnabled() || !frame-&gt;document()-&gt;securityOrigin()-&gt;canAccessApplicationCache(frame-&gt;tree().top().document()-&gt;securityOrigin())) {
</ins><span class="cx">         ASSERT(m_pendingMasterResourceLoaders.isEmpty());
</span><span class="cx">         ASSERT(m_pendingEntries.isEmpty());
</span><span class="cx">         ASSERT(!m_cacheBeingUpdated);
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderappcacheApplicationCacheHostcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp (163913 => 163914)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp        2014-02-11 23:05:06 UTC (rev 163913)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp        2014-02-11 23:07:49 UTC (rev 163914)
</span><span class="lines">@@ -75,7 +75,7 @@
</span><span class="cx"> void ApplicationCacheHost::maybeLoadMainResource(ResourceRequest&amp; request, SubstituteData&amp; substituteData)
</span><span class="cx"> {
</span><span class="cx">     // Check if this request should be loaded from the application cache
</span><del>-    if (!substituteData.isValid() &amp;&amp; isApplicationCacheEnabled()) {
</del><ins>+    if (!substituteData.isValid() &amp;&amp; isApplicationCacheEnabled() &amp;&amp; !isApplicationCacheBlockedForRequest(request)) {
</ins><span class="cx">         ASSERT(!m_mainResourceApplicationCache);
</span><span class="cx"> 
</span><span class="cx">         m_mainResourceApplicationCache = ApplicationCacheGroup::cacheForMainRequest(request, m_documentLoader);
</span><span class="lines">@@ -103,7 +103,7 @@
</span><span class="cx"> {
</span><span class="cx">     if (r.httpStatusCode() / 100 == 4 || r.httpStatusCode() / 100 == 5) {
</span><span class="cx">         ASSERT(!m_mainResourceApplicationCache);
</span><del>-        if (isApplicationCacheEnabled()) {
</del><ins>+        if (isApplicationCacheEnabled() &amp;&amp; !isApplicationCacheBlockedForRequest(request)) {
</ins><span class="cx">             m_mainResourceApplicationCache = ApplicationCacheGroup::fallbackCacheForMainRequest(request, documentLoader());
</span><span class="cx"> 
</span><span class="cx">             if (scheduleLoadFallbackResourceFromApplicationCache(documentLoader()-&gt;mainResourceLoader(), m_mainResourceApplicationCache.get()))
</span><span class="lines">@@ -117,7 +117,7 @@
</span><span class="cx"> {
</span><span class="cx">     if (!error.isCancellation()) {
</span><span class="cx">         ASSERT(!m_mainResourceApplicationCache);
</span><del>-        if (isApplicationCacheEnabled()) {
</del><ins>+        if (isApplicationCacheEnabled() &amp;&amp; !isApplicationCacheBlockedForRequest(request)) {
</ins><span class="cx">             m_mainResourceApplicationCache = ApplicationCacheGroup::fallbackCacheForMainRequest(request, m_documentLoader);
</span><span class="cx"> 
</span><span class="cx">             if (scheduleLoadFallbackResourceFromApplicationCache(documentLoader()-&gt;mainResourceLoader(), m_mainResourceApplicationCache.get()))
</span><span class="lines">@@ -159,7 +159,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool ApplicationCacheHost::maybeLoadResource(ResourceLoader* loader, ResourceRequest&amp; request, const URL&amp; originalURL)
</span><span class="cx"> {
</span><del>-    if (!isApplicationCacheEnabled())
</del><ins>+    if (!isApplicationCacheEnabled() &amp;&amp; !isApplicationCacheBlockedForRequest(request))
</ins><span class="cx">         return false;
</span><span class="cx">     
</span><span class="cx">     if (request.url() != originalURL)
</span><span class="lines">@@ -391,7 +391,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool ApplicationCacheHost::scheduleLoadFallbackResourceFromApplicationCache(ResourceLoader* loader, ApplicationCache* cache)
</span><span class="cx"> {
</span><del>-    if (!isApplicationCacheEnabled())
</del><ins>+    if (!isApplicationCacheEnabled() &amp;&amp; !isApplicationCacheBlockedForRequest(loader-&gt;request()))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     ApplicationCacheResource* resource;
</span><span class="lines">@@ -479,4 +479,10 @@
</span><span class="cx">     return m_documentLoader-&gt;frame() &amp;&amp; m_documentLoader-&gt;frame()-&gt;settings().offlineWebApplicationCacheEnabled() &amp;&amp; !m_documentLoader-&gt;frame()-&gt;settings().privateBrowsingEnabled();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool ApplicationCacheHost::isApplicationCacheBlockedForRequest(const ResourceRequest&amp; request)
+{
+    RefPtr&lt;SecurityOrigin&gt; origin = SecurityOrigin::create(request.url());
+    return m_documentLoader-&gt;frame() &amp;&amp; !origin-&gt;canAccessApplicationCache(m_documentLoader-&gt;frame()-&gt;document()-&gt;topOrigin());
+}
+
</ins><span class="cx"> }  // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderappcacheApplicationCacheHosth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.h (163913 => 163914)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.h        2014-02-11 23:05:06 UTC (rev 163913)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.h        2014-02-11 23:07:49 UTC (rev 163914)
</span><span class="lines">@@ -155,6 +155,7 @@
</span><span class="cx"> 
</span><span class="cx">     private:
</span><span class="cx">         bool isApplicationCacheEnabled();
</span><ins>+        bool isApplicationCacheBlockedForRequest(const ResourceRequest&amp;);
</ins><span class="cx">         DocumentLoader* documentLoader() const { return m_documentLoader; }
</span><span class="cx"> 
</span><span class="cx">         struct DeferredEvent {
</span></span></pre>
</div>
</div>

</body>
</html>