Title: [116584] trunk
Revision
116584
Author
[email protected]
Date
2012-05-09 17:32:55 -0700 (Wed, 09 May 2012)

Log Message

Subresources loaded after a reload completes shouldn't be revalidated.
https://bugs.webkit.org/show_bug.cgi?id=84614

Source/WebCore:

Based on patch by Darin Fisher.

Reviewed by Darin Fisher.

Tests: http/tests/cache/loaded-from-cache-after-reload-within-iframe.html
       http/tests/cache/loaded-from-cache-after-reload.html

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::checkLoadCompleteForThisFrame): Reset m_loadType after the load completes.

LayoutTests:

Tests by Darin Fisher.

Reviewed by Darin Fisher.

* http/tests/cache/loaded-from-cache-after-reload-expected.txt: Added.
* http/tests/cache/loaded-from-cache-after-reload-within-iframe-expected.txt: Added.
* http/tests/cache/loaded-from-cache-after-reload-within-iframe.html: Added.
* http/tests/cache/loaded-from-cache-after-reload.html: Added.
* http/tests/cache/resources/loaded-from-cache-after-reload-within-iframe-subframe.html: Added.
* http/tests/cache/resources/random-cached.cgi: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (116583 => 116584)


--- trunk/LayoutTests/ChangeLog	2012-05-10 00:19:55 UTC (rev 116583)
+++ trunk/LayoutTests/ChangeLog	2012-05-10 00:32:55 UTC (rev 116584)
@@ -1,3 +1,19 @@
+2012-05-09  Tony Gentilcore  <[email protected]>
+
+        Subresources loaded after a reload completes shouldn't be revalidated.
+        https://bugs.webkit.org/show_bug.cgi?id=84614
+
+        Tests by Darin Fisher.
+
+        Reviewed by Darin Fisher.
+
+        * http/tests/cache/loaded-from-cache-after-reload-expected.txt: Added.
+        * http/tests/cache/loaded-from-cache-after-reload-within-iframe-expected.txt: Added.
+        * http/tests/cache/loaded-from-cache-after-reload-within-iframe.html: Added.
+        * http/tests/cache/loaded-from-cache-after-reload.html: Added.
+        * http/tests/cache/resources/loaded-from-cache-after-reload-within-iframe-subframe.html: Added.
+        * http/tests/cache/resources/random-cached.cgi: Added.
+
 2012-05-09  Hugo Parente Lima  <[email protected]>
 
         Use suitable viewport values on XHTML-MP pages.

Added: trunk/LayoutTests/http/tests/cache/loaded-from-cache-after-reload-expected.txt (0 => 116584)


--- trunk/LayoutTests/http/tests/cache/loaded-from-cache-after-reload-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/cache/loaded-from-cache-after-reload-expected.txt	2012-05-10 00:32:55 UTC (rev 116584)
@@ -0,0 +1 @@
+PASS

Added: trunk/LayoutTests/http/tests/cache/loaded-from-cache-after-reload-within-iframe-expected.txt (0 => 116584)


--- trunk/LayoutTests/http/tests/cache/loaded-from-cache-after-reload-within-iframe-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/cache/loaded-from-cache-after-reload-within-iframe-expected.txt	2012-05-10 00:32:55 UTC (rev 116584)
@@ -0,0 +1 @@
+PASS

Added: trunk/LayoutTests/http/tests/cache/loaded-from-cache-after-reload-within-iframe.html (0 => 116584)


--- trunk/LayoutTests/http/tests/cache/loaded-from-cache-after-reload-within-iframe.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/cache/loaded-from-cache-after-reload-within-iframe.html	2012-05-10 00:32:55 UTC (rev 116584)
@@ -0,0 +1,53 @@
+<body>
+<h1></h1>
+<script>
+// Test that a subresource fetched after onload, following a reload, is still
+// loaded from the cache.
+
+if (!sessionStorage.lastRandom) {
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+        layoutTestController.waitUntilDone();
+    }
+}
+
+function done(result)
+{
+    delete sessionStorage.lastRandom;
+
+    document.body.innerText = result;
+
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+}
+
+function iframeLoaded()
+{
+    setTimeout(function() {
+        if (!window.randomNumber)
+            done('FAIL: window.randomNumber not defined!');
+        else if (sessionStorage.lastRandom) {
+            if ((sessionStorage.lastRandom - 0) == (randomNumber - 0))
+                done('PASS');
+            else
+                done('FAIL');
+        } else {
+            sessionStorage.lastRandom = randomNumber;
+            location.reload();
+        }
+    }, 0);
+}
+
+_onload_ = function()
+{
+    // After onload, add a script tag that should always load from the cache.
+    setTimeout(function()
+    {
+        var f = document.createElement('iframe');
+        f.src = '';
+        f._onload_ = iframeLoaded;
+        document.body.appendChild(f);
+    }, 1000);
+};
+</script>
+</body>

Added: trunk/LayoutTests/http/tests/cache/loaded-from-cache-after-reload.html (0 => 116584)


--- trunk/LayoutTests/http/tests/cache/loaded-from-cache-after-reload.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/cache/loaded-from-cache-after-reload.html	2012-05-10 00:32:55 UTC (rev 116584)
@@ -0,0 +1,54 @@
+<body>
+<h1></h1>
+<script>
+// Test that a subresource fetched after onload, following a reload, is still
+// loaded from the cache.
+
+if (!sessionStorage.lastRandom) {
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+        layoutTestController.waitUntilDone();
+    }
+}
+
+function done(result)
+{
+    delete sessionStorage.lastRandom;
+
+    document.body.innerText = result;
+
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+}
+
+function scriptLoaded()
+{
+    setTimeout(function()
+    {
+        if (!window.randomNumber)
+            done('FAIL: window.randomNumber not defined!');
+        else if (sessionStorage.lastRandom) {
+            if ((sessionStorage.lastRandom - 0) == (randomNumber - 0))
+                done('PASS');
+            else
+                done('FAIL');
+        } else {
+            sessionStorage.lastRandom = randomNumber;
+            location.reload();
+        }
+    }, 0);
+}
+
+_onload_ = function()
+{
+    // After onload, add a script tag that should always load from the cache.
+    setTimeout(function()
+    {
+        var s = document.createElement("script");
+        s.src = ""
+        s._onload_ = scriptLoaded;
+        document.body.appendChild(s);
+    }, 0);
+};
+</script>
+</body>

Added: trunk/LayoutTests/http/tests/cache/resources/loaded-from-cache-after-reload-within-iframe-subframe.html (0 => 116584)


--- trunk/LayoutTests/http/tests/cache/resources/loaded-from-cache-after-reload-within-iframe-subframe.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/cache/resources/loaded-from-cache-after-reload-within-iframe-subframe.html	2012-05-10 00:32:55 UTC (rev 116584)
@@ -0,0 +1 @@
+<script src=''></script>

Added: trunk/LayoutTests/http/tests/cache/resources/random-cached.cgi (0 => 116584)


--- trunk/LayoutTests/http/tests/cache/resources/random-cached.cgi	                        (rev 0)
+++ trunk/LayoutTests/http/tests/cache/resources/random-cached.cgi	2012-05-10 00:32:55 UTC (rev 116584)
@@ -0,0 +1,10 @@
+#!/usr/bin/perl -w
+
+print "Content-type: text/_javascript_\n";
+print "Cache-control: max-age=60000\n";
+print "ETag: \"123456789\"\n";
+print "\n";
+
+my $random_number = int(rand(1000000000000));
+print "top.randomNumber = " . $random_number . ";\n";
+print "top.document.querySelector('h1').textContent = top.randomNumber;";
Property changes on: trunk/LayoutTests/http/tests/cache/resources/random-cached.cgi
___________________________________________________________________

Added: svn:executable

Modified: trunk/Source/WebCore/ChangeLog (116583 => 116584)


--- trunk/Source/WebCore/ChangeLog	2012-05-10 00:19:55 UTC (rev 116583)
+++ trunk/Source/WebCore/ChangeLog	2012-05-10 00:32:55 UTC (rev 116584)
@@ -1,3 +1,18 @@
+2012-05-09  Tony Gentilcore  <[email protected]>
+
+        Subresources loaded after a reload completes shouldn't be revalidated.
+        https://bugs.webkit.org/show_bug.cgi?id=84614
+
+        Based on patch by Darin Fisher.
+
+        Reviewed by Darin Fisher.
+
+        Tests: http/tests/cache/loaded-from-cache-after-reload-within-iframe.html
+               http/tests/cache/loaded-from-cache-after-reload.html
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::checkLoadCompleteForThisFrame): Reset m_loadType after the load completes.
+
 2012-05-09  Erik Arvidsson  <[email protected]>
 
         [V8] Fix issue where V8BindingPerContextData could keep the context object alive

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (116583 => 116584)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2012-05-10 00:19:55 UTC (rev 116583)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2012-05-10 00:32:55 UTC (rev 116584)
@@ -2119,6 +2119,7 @@
         }
         
         case FrameStateComplete:
+            m_loadType = FrameLoadTypeStandard;
             frameLoadCompleted();
             return;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to