Title: [107607] trunk
Revision
107607
Author
[email protected]
Date
2012-02-13 14:12:44 -0800 (Mon, 13 Feb 2012)

Log Message

<rdar://problem/7196487> and https://bugs.webkit.org/show_bug.cgi?id=26777 Add https pages to the page cache in some cases

Reviewed by Anders Carlsson.

Source/WebCore:

Test: http/tests/navigation/https-in-page-cache.html

* history/PageCache.cpp:
(WebCore::PageCache::canCachePageContainingThisFrame): Allow HTTPS pages that do not specify cache-control: no-cache
  or cache-control: no-store into the page cache. This will match Firefox's behavior for HTTPS in their bfcache.

LayoutTests:

* http/tests/navigation/https-in-page-cache.html: Added.
* http/tests/navigation/https-in-page-cache-expected.txt: Added.
* http/tests/navigation/resources/https-in-page-cache-1.php: Added.
* http/tests/navigation/resources/https-in-page-cache-2.php: Added.
* http/tests/navigation/resources/https-in-page-cache-3.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (107606 => 107607)


--- trunk/LayoutTests/ChangeLog	2012-02-13 22:04:29 UTC (rev 107606)
+++ trunk/LayoutTests/ChangeLog	2012-02-13 22:12:44 UTC (rev 107607)
@@ -1,3 +1,16 @@
+2012-02-13  Brady Eidson  <[email protected]>
+
+        <rdar://problem/7196487> and https://bugs.webkit.org/show_bug.cgi?id=26777
+        Add https pages to the page cache in some cases
+
+        Reviewed by Anders Carlsson.
+
+        * http/tests/navigation/https-in-page-cache.html: Added.
+        * http/tests/navigation/https-in-page-cache-expected.txt: Added.
+        * http/tests/navigation/resources/https-in-page-cache-1.php: Added.
+        * http/tests/navigation/resources/https-in-page-cache-2.php: Added.
+        * http/tests/navigation/resources/https-in-page-cache-3.html: Added.
+
 2012-02-13  Raul Hudea  <[email protected]>
 
         [CSS Regions] Inconsistent text selection behavior in regions

Added: trunk/LayoutTests/http/tests/navigation/https-in-page-cache-expected.txt (0 => 107607)


--- trunk/LayoutTests/http/tests/navigation/https-in-page-cache-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/https-in-page-cache-expected.txt	2012-02-13 22:12:44 UTC (rev 107607)
@@ -0,0 +1,7 @@
+ALERT: This page is https and has the no-store cache-control directive. It should NOT go in to the page cache.
+ALERT: The page was reloaded on back, not from the page cache. Good job. Running part 2 of the test.
+ALERT: This page is https and has the no-cache cache-control directive. It should NOT go in to the page cache.
+ALERT: The page was reloaded on back, not from the page cache. Good job. Running part 3 of the test.
+ALERT: This page is https and should go in to the page cache.
+ALERT: The page was restored from the page cache. Good job!
+

Added: trunk/LayoutTests/http/tests/navigation/https-in-page-cache.html (0 => 107607)


--- trunk/LayoutTests/http/tests/navigation/https-in-page-cache.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/https-in-page-cache.html	2012-02-13 22:12:44 UTC (rev 107607)
@@ -0,0 +1,12 @@
+<script>
+
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+    layoutTestController.overridePreference("WebKitUsesPageCachePreferenceKey", 1);
+}
+
+if (location.protocol != "https:")
+    location = "https://127.0.0.1:8443/navigation/resources/https-in-page-cache-1.php";
+
+</script>

Added: trunk/LayoutTests/http/tests/navigation/resources/https-in-page-cache-1.php (0 => 107607)


--- trunk/LayoutTests/http/tests/navigation/resources/https-in-page-cache-1.php	                        (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/resources/https-in-page-cache-1.php	2012-02-13 22:12:44 UTC (rev 107607)
@@ -0,0 +1,32 @@
+<?php
+header("cache-control: no-store");
+?>
+<script>
+
+function nextTest() {
+	if (window.sessionStorage.https_in_page_cache_started)
+		delete window.sessionStorage.https_in_page_cache_started;
+	location = "https://127.0.0.1:8443/navigation/resources/https-in-page-cache-2.php";
+}
+
+window._onpageshow_ = function(evt) {
+	if (evt.persisted) {
+		alert("The page was restored from the page cache. It should NOT have been. Running part 2 of the test.");
+		nextTest();
+	}
+}
+
+window._onload_ = function() {
+	if (window.sessionStorage.https_in_page_cache_started) {
+		alert("The page was reloaded on back, not from the page cache. Good job. Running part 2 of the test.");
+		nextTest();
+		return;
+	}
+
+	alert("This page is https and has the no-store cache-control directive. It should NOT go in to the page cache.");
+	window.sessionStorage.https_in_page_cache_started = true;
+	setTimeout('window.location = "go-back.html"', 0);
+
+}
+
+</script>
\ No newline at end of file

Added: trunk/LayoutTests/http/tests/navigation/resources/https-in-page-cache-2.php (0 => 107607)


--- trunk/LayoutTests/http/tests/navigation/resources/https-in-page-cache-2.php	                        (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/resources/https-in-page-cache-2.php	2012-02-13 22:12:44 UTC (rev 107607)
@@ -0,0 +1,32 @@
+<?php
+header("cache-control: no-cache");
+?>
+<script>
+
+function nextTest() {
+	if (window.sessionStorage.https_in_page_cache_started)
+		delete window.sessionStorage.https_in_page_cache_started;
+	location = "https://127.0.0.1:8443/navigation/resources/https-in-page-cache-3.html";
+}
+
+window._onpageshow_ = function(evt) {
+	if (evt.persisted) {
+		alert("The page was restored from the page cache. It should NOT have been. Running part 3 of the test.");
+		nextTest();
+	}
+}
+
+window._onload_ = function() {
+	if (window.sessionStorage.https_in_page_cache_started) {
+		alert("The page was reloaded on back, not from the page cache. Good job. Running part 3 of the test.");
+		nextTest();
+		return;
+	}
+
+	alert("This page is https and has the no-cache cache-control directive. It should NOT go in to the page cache.");
+	window.sessionStorage.https_in_page_cache_started = true;
+	setTimeout('window.location = "go-back.html"', 0);
+
+}
+
+</script>
\ No newline at end of file

Added: trunk/LayoutTests/http/tests/navigation/resources/https-in-page-cache-3.html (0 => 107607)


--- trunk/LayoutTests/http/tests/navigation/resources/https-in-page-cache-3.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/resources/https-in-page-cache-3.html	2012-02-13 22:12:44 UTC (rev 107607)
@@ -0,0 +1,18 @@
+<script>
+
+window._onpageshow_ = function(evt) {
+	if (!evt.persisted)
+		return;
+
+	alert("The page was restored from the page cache. Good job!");
+
+	if (window.layoutTestController)
+		layoutTestController.notifyDone();
+}
+
+window._onload_ = function() {
+	alert("This page is https and should go in to the page cache.");
+	setTimeout('window.location = "go-back.html"', 0);
+}
+
+</script>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (107606 => 107607)


--- trunk/Source/WebCore/ChangeLog	2012-02-13 22:04:29 UTC (rev 107606)
+++ trunk/Source/WebCore/ChangeLog	2012-02-13 22:12:44 UTC (rev 107607)
@@ -1,3 +1,16 @@
+2012-02-13  Brady Eidson  <[email protected]>
+
+        <rdar://problem/7196487> and https://bugs.webkit.org/show_bug.cgi?id=26777
+        Add https pages to the page cache in some cases
+
+        Reviewed by Anders Carlsson.
+
+        Test: http/tests/navigation/https-in-page-cache.html
+
+        * history/PageCache.cpp:
+        (WebCore::PageCache::canCachePageContainingThisFrame): Allow HTTPS pages that do not specify cache-control: no-cache
+          or cache-control: no-store into the page cache. This will match Firefox's behavior for HTTPS in their bfcache.
+
 2012-02-10  Enrica Casucci  <[email protected]>
 
         Refactor Mac platform implementation of the Pasteboard class to use Platform Strategies.

Modified: trunk/Source/WebCore/history/PageCache.cpp (107606 => 107607)


--- trunk/Source/WebCore/history/PageCache.cpp	2012-02-13 22:04:29 UTC (rev 107606)
+++ trunk/Source/WebCore/history/PageCache.cpp	2012-02-13 22:12:44 UTC (rev 107607)
@@ -260,7 +260,7 @@
         // Do not cache error pages (these can be recognized as pages with substitute data or unreachable URLs).
         && !(documentLoader->substituteData().isValid() && !documentLoader->substituteData().failingURL().isEmpty())
         && (!frameLoader->subframeLoader()->containsPlugins() || frame->page()->settings()->pageCacheSupportsPlugins())
-        && !document->url().protocolIs("https")
+        && (!document->url().protocolIs("https") || (!documentLoader->response().cacheControlContainsNoCache() && !documentLoader->response().cacheControlContainsNoStore()))
         && (!frame->domWindow() || !frame->domWindow()->hasEventListeners(eventNames().unloadEvent))
 #if ENABLE(SQL_DATABASE)
         && !document->hasOpenDatabases()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to