Title: [144694] trunk
Revision
144694
Author
jp...@apple.com
Date
2013-03-04 16:22:27 -0800 (Mon, 04 Mar 2013)

Log Message

Cache partitioning does not affect iframe MainResources
https://bugs.webkit.org/show_bug.cgi?id=111022

Reviewed by David Kilzer.

Source/WebCore:

Set the partition of a main resource request if in a subframe.

Test: http/tests/cache/partitioned-cache-iframe.html

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadURL):

LayoutTests:

These tests results are for the case in which the cache is not
partitioned, as no shipping ports have cache partitioning enabled

* http/tests/cache/partitioned-cache-iframe-expected.txt: Added.
* http/tests/cache/partitioned-cache-iframe.html: Added.
* http/tests/cache/resources/random-cached-iframe.cgi: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (144693 => 144694)


--- trunk/LayoutTests/ChangeLog	2013-03-04 23:51:59 UTC (rev 144693)
+++ trunk/LayoutTests/ChangeLog	2013-03-05 00:22:27 UTC (rev 144694)
@@ -1,3 +1,17 @@
+2013-02-27  Jeffrey Pfau  <jp...@apple.com>
+
+        Cache partitioning does not affect iframe MainResources
+        https://bugs.webkit.org/show_bug.cgi?id=111022
+
+        Reviewed by David Kilzer.
+
+        These tests results are for the case in which the cache is not
+        partitioned, as no shipping ports have cache partitioning enabled
+
+        * http/tests/cache/partitioned-cache-iframe-expected.txt: Added.
+        * http/tests/cache/partitioned-cache-iframe.html: Added.
+        * http/tests/cache/resources/random-cached-iframe.cgi: Added.
+
 2013-03-04  Rafael Weinstein  <rafa...@chromium.org>
 
         Unreviewed gardening.

Added: trunk/LayoutTests/http/tests/cache/partitioned-cache-iframe-expected.txt (0 => 144694)


--- trunk/LayoutTests/http/tests/cache/partitioned-cache-iframe-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/cache/partitioned-cache-iframe-expected.txt	2013-03-05 00:22:27 UTC (rev 144694)
@@ -0,0 +1,2 @@
+CONSOLE MESSAGE: line 18: The cache is not properly partitioned
+

Added: trunk/LayoutTests/http/tests/cache/partitioned-cache-iframe.html (0 => 144694)


--- trunk/LayoutTests/http/tests/cache/partitioned-cache-iframe.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/cache/partitioned-cache-iframe.html	2013-03-05 00:22:27 UTC (rev 144694)
@@ -0,0 +1,33 @@
+<html>
+<head>
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+    internals.settings.setStorageBlockingPolicy('BlockThirdParty');
+}
+
+var value = window.location.href.match(/\?value=([^&]*)/);
+if (value)
+    value = value[1];
+
+window._onmessage_ = function(event) {
+    var cachedValue = event.data;
+    if (value !== null) {
+        if (cachedValue == value)
+            console.log("The cache is not properly partitioned");
+        else
+            console.log("PASS");
+        if (window.testRunner) {
+            testRunner.notifyDone();
+            internals.settings.setStorageBlockingPolicy('AllowAll');
+        }
+    } else
+        window.location = "http://localhost:8000/cache/partitioned-cache-iframe.html?value=" + cachedValue;
+}
+</script>
+</head>
+<body>
+<iframe src=""
+</body>
+</html>

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


--- trunk/LayoutTests/http/tests/cache/resources/random-cached-iframe.cgi	                        (rev 0)
+++ trunk/LayoutTests/http/tests/cache/resources/random-cached-iframe.cgi	2013-03-05 00:22:27 UTC (rev 144694)
@@ -0,0 +1,16 @@
+#!/usr/bin/perl -w
+
+print "Content-type: text/html\n";
+print "Cache-control: max-age=60000\n";
+print "ETag: \"123456789\"\n";
+print "\n";
+
+my $random_number = int(rand(1000000000000));
+print << "END";
+
+<script>
+var randomNumber =  $random_number;
+top.postMessage(randomNumber, "*");
+</script>
+
+END
Property changes on: trunk/LayoutTests/http/tests/cache/resources/random-cached-iframe.cgi
___________________________________________________________________

Added: svn:executable

Modified: trunk/Source/WebCore/ChangeLog (144693 => 144694)


--- trunk/Source/WebCore/ChangeLog	2013-03-04 23:51:59 UTC (rev 144693)
+++ trunk/Source/WebCore/ChangeLog	2013-03-05 00:22:27 UTC (rev 144694)
@@ -1,3 +1,17 @@
+2013-02-27  Jeffrey Pfau  <jp...@apple.com>
+
+        Cache partitioning does not affect iframe MainResources
+        https://bugs.webkit.org/show_bug.cgi?id=111022
+
+        Reviewed by David Kilzer.
+
+        Set the partition of a main resource request if in a subframe.
+
+        Test: http/tests/cache/partitioned-cache-iframe.html
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::loadURL):
+
 2013-03-04  Chris Fleizach  <cfleiz...@apple.com>
 
         AX: user agent shadow roots for plugins should be 'accessible'

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (144693 => 144694)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2013-03-04 23:51:59 UTC (rev 144693)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2013-03-05 00:22:27 UTC (rev 144694)
@@ -1194,6 +1194,10 @@
         RefPtr<SecurityOrigin> referrerOrigin = SecurityOrigin::createFromString(referrer);
         addHTTPOriginIfNeeded(request, referrerOrigin->toString());
     }
+#if ENABLE(CACHE_PARTITIONING)
+    if (m_frame->tree()->top() != m_frame)
+        request.setCachePartition(m_frame->tree()->top()->document()->securityOrigin()->cachePartition());
+#endif
     addExtraFieldsToRequest(request, newLoadType, true);
     if (newLoadType == FrameLoadTypeReload || newLoadType == FrameLoadTypeReloadFromOrigin)
         request.setCachePolicy(ReloadIgnoringCacheData);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to