blob: 557a648845f71f1296b9e4017b10f433601ec6fc [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>Test Caching "no-store" For History Only</title>
<script src="../../js-test-resources/js-test-pre.js"></script>
</head>
<body>
<p>Verifies that resources are loaded only once during the initial document
load, but are reloaded if they are requested again later and can not be cached.
</p>
<pre id="console"></pre>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
}
var randomNumber = 0;
var firstRandomNumber = 0;
var secondRandomNumber = 0;
var thirdRandomNumber = 0;
function firstLoaded() {
firstRandomNumber = randomNumber;
var newScript = document.createElement("script");
newScript.src = "resources/cache-simulator.cgi?uniqueId=1&Cache-control=max-age=0";
newScript.onload = secondLoaded;
document.getElementsByTagName("head")[0].appendChild(newScript);
}
function secondLoaded() {
secondRandomNumber = randomNumber;
}
function loadNextScript() {
var newScript = document.createElement("script");
newScript.src = "resources/cache-simulator.cgi?uniqueId=1&Cache-control=max-age=0";
newScript.onload = thirdLoaded;
document.getElementsByTagName("head")[0].appendChild(newScript);
}
function thirdLoaded() {
thirdRandomNumber = randomNumber;
shouldBeNonZero("firstRandomNumber");
shouldBeNonZero("secondRandomNumber");
shouldBeNonZero("thirdRandomNumber");
shouldBeTrue("firstRandomNumber == secondRandomNumber");
shouldBeTrue("firstRandomNumber != thirdRandomNumber");
finishJSTest();
}
window.addEventListener("load", function() { setTimeout(loadNextScript, 0); }, false);
var jsTestIsAsync = true;
</script>
<script src="resources/cache-simulator.cgi?uniqueId=1&Cache-control=max-age=0" onload="firstLoaded()" async></script>
<script src="../../js-test-resources/js-test-post.js"></script>
</body>
</html>