[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

ap at apple.com ap at apple.com
Wed Dec 22 14:19:48 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 31b0f6a595cb706f4b6e40d34ba1fb6c9d9c6997
Author: ap at apple.com <ap at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 6 20:14:40 2010 +0000

            Reviewed by Brady Eidson.
    
            https://bugs.webkit.org/show_bug.cgi?id=47294
            <rdar://problem/8425647>Application cache isn't consulted on redirect
    
            Test: http/tests/appcache/main-resource-redirect.html
    
            * loader/MainResourceLoader.cpp:
            (WebCore::MainResourceLoader::continueAfterNavigationPolicy): If we have substitute data now
            (presumably after a redirect is served by appcache), switch to it.
            (WebCore::MainResourceLoader::willSendRequest): Check appcache for the new URL.
    
            * loader/MainResourceLoader.h: Made handleDataLoadSoon() take a const ResourceRequest
            reference - it doesn't ever modify it, and we can call it from continueAfterNavigationPolicy() now.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69226 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 9666e4c..65b85d7 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,18 @@
+2010-10-06  Alexey Proskuryakov  <ap at apple.com>
+
+        Reviewed by Brady Eidson.
+
+        https://bugs.webkit.org/show_bug.cgi?id=47294
+        <rdar://problem/8425647>Application cache isn't consulted on redirect
+
+        Redirect to a main page that's not accessible at the moment (with the help of network-simulator.php).
+
+        * http/tests/appcache/main-resource-redirect-expected.txt: Added.
+        * http/tests/appcache/main-resource-redirect.html: Added.
+        * http/tests/appcache/resources/main-resource-redirect-frame-2.html: Added.
+        * http/tests/appcache/resources/main-resource-redirect-frame.php: Added.
+        * http/tests/appcache/resources/main-resource-redirect.manifest: Added.
+
 2010-10-06  Nikolas Zimmermann  <nzimmermann at rim.com>
 
         Rubber stamped by Dirk Schulze.
diff --git a/LayoutTests/http/tests/appcache/main-resource-redirect-expected.txt b/LayoutTests/http/tests/appcache/main-resource-redirect-expected.txt
new file mode 100644
index 0000000..0a727f5
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/main-resource-redirect-expected.txt
@@ -0,0 +1,4 @@
+Test that application cache is consulted again after a redirect response.
+
+PASS
+
diff --git a/LayoutTests/http/tests/appcache/main-resource-redirect.html b/LayoutTests/http/tests/appcache/main-resource-redirect.html
new file mode 100644
index 0000000..3ede636
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/main-resource-redirect.html
@@ -0,0 +1,39 @@
+<html manifest="resources/main-resource-redirect.manifest">
+<body>
+<p>Test that application cache is consulted again after a redirect response.</p>
+<div id="result">Testing...</div>
+<script>
+if (window.layoutTestController) {
+    layoutTestController.waitUntilDone();
+    layoutTestController.dumpAsText();
+}
+
+function setNetworkEnabled(state)
+{
+    var req = new XMLHttpRequest;
+    req.open("GET", "/resources/network-simulator.php?command=" + (state ? "connect" : "disconnect"), false);
+    req.send("");
+}
+
+function test()
+{
+    applicationCache.oncached = null;
+    applicationCache.onnoupdate = null;
+    setNetworkEnabled(false);
+    var ifr = document.createElement("iframe");
+    ifr.setAttribute("src", "resources/main-resource-redirect-frame.php");
+    document.body.appendChild(ifr);
+}
+
+function done()
+{
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+    setNetworkEnabled(true);
+}
+
+applicationCache.oncached=test;
+applicationCache.onnoupdate=test;
+applicationCache.onerror = function() { setNetworkEnabled(true); window.location.reload(); }
+</script>
+</body>
diff --git a/LayoutTests/http/tests/appcache/resources/main-resource-redirect-frame-2.html b/LayoutTests/http/tests/appcache/resources/main-resource-redirect-frame-2.html
new file mode 100644
index 0000000..0acc1e2
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/main-resource-redirect-frame-2.html
@@ -0,0 +1,6 @@
+<html manifest="http://127.0.0.1:8000/appcache/resources/main-resource-redirect.manifest">
+<script>
+parent.document.getElementById("result").innerHTML = (applicationCache.status) > 0 ? "PASS" : "FAIL: child frame status is UNCACHED";
+parent.done();
+
+</script>
diff --git a/LayoutTests/http/tests/appcache/resources/main-resource-redirect-frame.php b/LayoutTests/http/tests/appcache/resources/main-resource-redirect-frame.php
new file mode 100644
index 0000000..638057b
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/main-resource-redirect-frame.php
@@ -0,0 +1,4 @@
+<?php
+  header('HTTP/1.0 302 Found');
+  header('Location: http://127.0.0.1:8000/resources/network-simulator.php?path=/appcache/resources/main-resource-redirect-frame-2.html');
+?>
diff --git a/LayoutTests/http/tests/appcache/resources/main-resource-redirect.manifest b/LayoutTests/http/tests/appcache/resources/main-resource-redirect.manifest
new file mode 100644
index 0000000..beffe84
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/main-resource-redirect.manifest
@@ -0,0 +1,4 @@
+CACHE MANIFEST
+http://127.0.0.1:8000/resources/network-simulator.php?path=/appcache/resources/main-resource-redirect-frame-2.html
+NETWORK:
+http://127.0.0.1:8000/resources/network-simulator.php?command
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index db4bd76..e184070 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-10-06  Alexey Proskuryakov  <ap at apple.com>
+
+        Reviewed by Brady Eidson.
+
+        https://bugs.webkit.org/show_bug.cgi?id=47294
+        <rdar://problem/8425647>Application cache isn't consulted on redirect
+
+        Test: http/tests/appcache/main-resource-redirect.html
+
+        * loader/MainResourceLoader.cpp:
+        (WebCore::MainResourceLoader::continueAfterNavigationPolicy): If we have substitute data now
+        (presumably after a redirect is served by appcache), switch to it.
+        (WebCore::MainResourceLoader::willSendRequest): Check appcache for the new URL.
+
+        * loader/MainResourceLoader.h: Made handleDataLoadSoon() take a const ResourceRequest
+        reference - it doesn't ever modify it, and we can call it from continueAfterNavigationPolicy() now.
+
 2010-10-06  Alejandro G. Castro  <alex at igalia.com>
 
         Reviewed by Dirk Schulze.
diff --git a/WebCore/loader/MainResourceLoader.cpp b/WebCore/loader/MainResourceLoader.cpp
index d976841..bc16001 100644
--- a/WebCore/loader/MainResourceLoader.cpp
+++ b/WebCore/loader/MainResourceLoader.cpp
@@ -123,10 +123,17 @@ void MainResourceLoader::callContinueAfterNavigationPolicy(void* argument, const
     static_cast<MainResourceLoader*>(argument)->continueAfterNavigationPolicy(request, shouldContinue);
 }
 
-void MainResourceLoader::continueAfterNavigationPolicy(const ResourceRequest&, bool shouldContinue)
+void MainResourceLoader::continueAfterNavigationPolicy(const ResourceRequest& request, bool shouldContinue)
 {
     if (!shouldContinue)
         stopLoadingForPolicyChange();
+    else if (m_substituteData.isValid()) {
+        // A redirect resulted in loading substitute data.
+        ASSERT(documentLoader()->timing()->redirectCount);
+        handle()->cancel();
+        handleDataLoadSoon(request);
+    }
+
     deref(); // balances ref in willSendRequest
 }
 
@@ -192,6 +199,15 @@ void MainResourceLoader::willSendRequest(ResourceRequest& newRequest, const Reso
     if (top != m_frame)
         frameLoader()->checkIfDisplayInsecureContent(top->document()->securityOrigin(), newRequest.url());
 
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+    if (!redirectResponse.isNull()) {
+        // We checked application cache for initial URL, now we need to check it for redirected one.
+        ASSERT(documentLoader()->applicationCacheHost()->status() == ApplicationCacheHost::UNCACHED);
+        ASSERT(!m_substituteData.isValid());
+        documentLoader()->applicationCacheHost()->maybeLoadMainResource(newRequest, m_substituteData);
+    }
+#endif
+
     // FIXME: Ideally we'd stop the I/O until we hear back from the navigation policy delegate
     // listener. But there's no way to do that in practice. So instead we cancel later if the
     // listener tells us to. In practice that means the navigation policy needs to be decided
@@ -500,7 +516,7 @@ void MainResourceLoader::startDataLoadTimer()
 #endif
 }
 
-void MainResourceLoader::handleDataLoadSoon(ResourceRequest& r)
+void MainResourceLoader::handleDataLoadSoon(const ResourceRequest& r)
 {
     m_initialRequest = r;
     
diff --git a/WebCore/loader/MainResourceLoader.h b/WebCore/loader/MainResourceLoader.h
index 35eab2f..1620f7a 100644
--- a/WebCore/loader/MainResourceLoader.h
+++ b/WebCore/loader/MainResourceLoader.h
@@ -79,7 +79,7 @@ namespace WebCore {
         bool loadNow(ResourceRequest&);
 
         void handleEmptyLoad(const KURL&, bool forURLScheme);
-        void handleDataLoadSoon(ResourceRequest& r);
+        void handleDataLoadSoon(const ResourceRequest& r);
 
         void startDataLoadTimer();
         void handleDataLoad(ResourceRequest&);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list