Title: [154505] trunk/LayoutTests
Revision
154505
Author
[email protected]
Date
2013-08-23 12:17:58 -0700 (Fri, 23 Aug 2013)

Log Message

        http/tests/cache/partitioned-cache.html breaks subsequent cookie tests
        https://bugs.webkit.org/show_bug.cgi?id=120212

        Reviewed by Tim Horton.

        The test never deleted its localhost cookie, so subsequent third party cookie
        relaxing tests saw the existing cookie and failed.

        There is no need to use cookies in this test, and it's actually slightly incorrect,
        as the network layer may refuse to use a cached result simply because cookies changed,
        and then we wouldn't test 3rd party data blocking.

        * platform/qt/http/tests/cache/partitioned-cache-expected.txt:
        * http/tests/cache/partitioned-cache-expected.txt: Updated results. It took me 
        a long time to understand what the test was doing, so made it a bit more self-descriptive.

        * http/tests/cache/partitioned-cache.html: Tabs to spaces.

        * http/tests/cache/resources/echo-cookie.cgi: Removed.
        * http/tests/cache/resources/partitioned-cache-echo-state.php: Added.
        * http/tests/cache/resources/partitioned-cache-loader.html:
        Changed to use a local file on the server to modify resource content.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (154504 => 154505)


--- trunk/LayoutTests/ChangeLog	2013-08-23 19:02:07 UTC (rev 154504)
+++ trunk/LayoutTests/ChangeLog	2013-08-23 19:17:58 UTC (rev 154505)
@@ -1,3 +1,28 @@
+2013-08-23  Alexey Proskuryakov  <[email protected]>
+
+        http/tests/cache/partitioned-cache.html breaks subsequent cookie tests
+        https://bugs.webkit.org/show_bug.cgi?id=120212
+
+        Reviewed by Tim Horton.
+
+        The test never deleted its localhost cookie, so subsequent third party cookie
+        relaxing tests saw the existing cookie and failed.
+
+        There is no need to use cookies in this test, and it's actually slightly incorrect,
+        as the network layer may refuse to use a cached result simply because cookies changed,
+        and then we wouldn't test 3rd party data blocking.
+
+        * platform/qt/http/tests/cache/partitioned-cache-expected.txt:
+        * http/tests/cache/partitioned-cache-expected.txt: Updated results. It took me 
+        a long time to understand what the test was doing, so made it a bit more self-descriptive.
+
+        * http/tests/cache/partitioned-cache.html: Tabs to spaces.
+
+        * http/tests/cache/resources/echo-cookie.cgi: Removed.
+        * http/tests/cache/resources/partitioned-cache-echo-state.php: Added.
+        * http/tests/cache/resources/partitioned-cache-loader.html:
+        Changed to use a local file on the server to modify resource content.
+
 2013-08-23  Bear Travis  <[email protected]>
 
         <https://webkit.org/b/119864> [CSS Shapes] Remove extraneous window.internals calls in layout tests

Modified: trunk/LayoutTests/http/tests/cache/partitioned-cache-expected.txt (154504 => 154505)


--- trunk/LayoutTests/http/tests/cache/partitioned-cache-expected.txt	2013-08-23 19:02:07 UTC (rev 154504)
+++ trunk/LayoutTests/http/tests/cache/partitioned-cache-expected.txt	2013-08-23 19:17:58 UTC (rev 154505)
@@ -1,4 +1,8 @@
-CONSOLE MESSAGE: line 10: localhost
-CONSOLE MESSAGE: line 10: 127.0.0.1
+CONSOLE MESSAGE: line 13: Document domain is now localhost
+CONSOLE MESSAGE: line 14: Setting server-side persistent state to "localhost"
+CONSOLE MESSAGE: line 23: Server state retrieved via a 1st party resource: "localhost"
+CONSOLE MESSAGE: line 13: Document domain is now 127.0.0.1
+CONSOLE MESSAGE: line 14: Setting server-side persistent state to "127.0.0.1"
+CONSOLE MESSAGE: line 26: Server state retrieved via a 3rd party resource (possibly a cached result, but it shouldn't be): "127.0.0.1"
 PASS response is "127.0.0.1"
 

Modified: trunk/LayoutTests/http/tests/cache/partitioned-cache.html (154504 => 154505)


--- trunk/LayoutTests/http/tests/cache/partitioned-cache.html	2013-08-23 19:02:07 UTC (rev 154504)
+++ trunk/LayoutTests/http/tests/cache/partitioned-cache.html	2013-08-23 19:17:58 UTC (rev 154505)
@@ -2,12 +2,10 @@
 <head>
 <script>
 if (window.testRunner) {
-	testRunner.dumpAsText();
-	testRunner.dumpChildFramesAsText();
-	testRunner.waitUntilDone();
-	testRunner.setCanOpenWindows(true);
-	testRunner.setCloseRemainingWindowsWhenComplete(true);
-	internals.settings.setStorageBlockingPolicy('BlockThirdParty');
+    testRunner.dumpAsText();
+    testRunner.dumpChildFramesAsText();
+    testRunner.waitUntilDone();
+    internals.settings.setStorageBlockingPolicy('BlockThirdParty');
 }
 
 document.location = "http://localhost:8000/cache/resources/partitioned-cache-loader.html";

Deleted: trunk/LayoutTests/http/tests/cache/resources/echo-cookie.cgi (154504 => 154505)


--- trunk/LayoutTests/http/tests/cache/resources/echo-cookie.cgi	2013-08-23 19:02:07 UTC (rev 154504)
+++ trunk/LayoutTests/http/tests/cache/resources/echo-cookie.cgi	2013-08-23 19:17:58 UTC (rev 154505)
@@ -1,11 +0,0 @@
-#!/usr/bin/perl -w
-
-use CGI;
-$query = new CGI;
-
-my $cookie = $query->cookie('value');
-
-print "Content-type: text/plain\n";
-print "Cache-control: max-age=3600\n";
-print "\n";
-print "var response = '${cookie}';";

Added: trunk/LayoutTests/http/tests/cache/resources/partitioned-cache-echo-state.php (0 => 154505)


--- trunk/LayoutTests/http/tests/cache/resources/partitioned-cache-echo-state.php	                        (rev 0)
+++ trunk/LayoutTests/http/tests/cache/resources/partitioned-cache-echo-state.php	2013-08-23 19:17:58 UTC (rev 154505)
@@ -0,0 +1,9 @@
+<?php
+require_once '../../resources/portabilityLayer.php';
+
+header('Content-Type: application/_javascript_');
+header('Cache-Control: max-age=3600');
+
+$tmpFile = sys_get_temp_dir() . "/" . "partitioned-cache-state";
+?>
+var response = '<?php print file_get_contents($tmpFile); ?>';

Modified: trunk/LayoutTests/http/tests/cache/resources/partitioned-cache-loader.html (154504 => 154505)


--- trunk/LayoutTests/http/tests/cache/resources/partitioned-cache-loader.html	2013-08-23 19:02:07 UTC (rev 154504)
+++ trunk/LayoutTests/http/tests/cache/resources/partitioned-cache-loader.html	2013-08-23 19:17:58 UTC (rev 154505)
@@ -2,21 +2,34 @@
 <head>
 <script src=""
 <script>
-	var scriptElement = document.createElement('script');
-	document.cookie = 'value=' + document.domain;
-	scriptElement.setAttribute('src', 'http://localhost:8000/cache/resources/echo-cookie.cgi');
-	document.head.appendChild(scriptElement);
-	window._onload_ = function() {
-		console.log(response);
-		shouldBeEqualToString('response',  document.domain);
-		if (document.domain == 'localhost') {
-			document.cookie = 'value=127.0.0.1';
-			document.location = 'http://127.0.0.1:8000/cache/resources/partitioned-cache-loader.html';
-		} else if (window.testRunner) {
-			internals.settings.setStorageBlockingPolicy('AllowAll');
-			testRunner.notifyDone();
-		}
-	};
+function setServerState(string)
+{
+    var xhr = new XMLHttpRequest;
+    xhr.open('POST', '/resources/write-temp-file.php?filename=partitioned-cache-state&data=''Document domain is now ' + document.domain);
+console.log('Setting server-side persistent state to "' + document.domain + '"');
+setServerState(document.domain);
+
+var scriptElement = document.createElement('script');
+scriptElement.setAttribute('src', 'http://localhost:8000/cache/resources/partitioned-cache-echo-state.php');
+document.head.appendChild(scriptElement);
+
+window._onload_ = function() {
+    if (document.domain == 'localhost') {
+        console.log('Server state retrieved via a 1st party resource: "' + response + '"');
+        document.location = 'http://127.0.0.1:8000/cache/resources/partitioned-cache-loader.html';
+    } else {
+        console.log('Server state retrieved via a 3rd party resource (possibly a cached result, but it shouldn\'t be): "' + response + '"');
+        shouldBeEqualToString('response',  document.domain);
+        if (window.testRunner) {
+            internals.settings.setStorageBlockingPolicy('AllowAll');
+            testRunner.notifyDone();
+        }
+    }
+}
 </script>
 </head>
 <body>

Modified: trunk/LayoutTests/platform/qt/http/tests/cache/partitioned-cache-expected.txt (154504 => 154505)


--- trunk/LayoutTests/platform/qt/http/tests/cache/partitioned-cache-expected.txt	2013-08-23 19:02:07 UTC (rev 154504)
+++ trunk/LayoutTests/platform/qt/http/tests/cache/partitioned-cache-expected.txt	2013-08-23 19:17:58 UTC (rev 154505)
@@ -1,4 +1,8 @@
-CONSOLE MESSAGE: line 10: localhost
-CONSOLE MESSAGE: line 10: localhost
+CONSOLE MESSAGE: line 13: Document domain is now localhost
+CONSOLE MESSAGE: line 14: Setting server-side persistent state to "localhost"
+CONSOLE MESSAGE: line 23: Server state retrieved via a 1st party resource: "localhost"
+CONSOLE MESSAGE: line 13: Document domain is now 127.0.0.1
+CONSOLE MESSAGE: line 14: Setting server-side persistent state to "127.0.0.1"
+CONSOLE MESSAGE: line 26: Server state retrieved via a 3rd party resource (possibly a cached result, but it shouldn't be): "localhost"
 FAIL response should be 127.0.0.1. Was localhost.
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to