Commit 62b31a48 authored by ap@apple.com's avatar ap@apple.com
Browse files

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.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154505 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b70c3c7b
2013-08-23 Alexey Proskuryakov <ap@apple.com>
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 <betravis@adobe.com>
 
<https://webkit.org/b/119864> [CSS Shapes] Remove extraneous window.internals calls in layout tests
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"
......@@ -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";
......
#!/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}';";
<?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); ?>';
......@@ -2,21 +2,34 @@
<head>
<script src="../../resources/js-test-pre.js"></script>
<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=' + string, false);
xhr.send();
}
console.log('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>
......
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.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment