blob: 53bb3d9265430fc6a2f26d78646048da41abb37e [file] [log] [blame]
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<script>
if (window.internals)
internals.settings.setStorageBlockingPolicy('BlockThirdParty');
function setServerState(string)
{
var xhr = new XMLHttpRequest;
xhr.open('POST', '/resources/write-temp-file.php?filename=cache-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>
</body>
</html>