Commit 7d58d6ea authored by antti@apple.com's avatar antti@apple.com
Browse files

Source/WebCore: https://bugs.webkit.org/show_bug.cgi?id=52044

REGRESSION(r74807): No-store is ignored within a document
        
Reviewed by Alexey Proskuryakov.

Don't use cached resources with Cache-control: no-store (unless cache policy is CachePolicyHistoryBuffer).
This matches a behavior that got lost in r74807.

Test: http/tests/misc/script-no-store.html
(by Alexey Proskuryakov)

* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::determineRevalidationPolicy):

LayoutTests: https://bugs.webkit.org/show_bug.cgi?id=52044
REGRESSION(r74807): No-store is ignored within a document

Reviewed by Alexey Proskuryakov.

* http/tests/misc/script-no-store-expected.txt: Added.
* http/tests/misc/script-no-store.html: Added.
* http/tests/misc/resources/random-no-store.php: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75384 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3a7b5a97
2011-01-10 Antti Koivisto <antti@apple.com>
Reviewed by Alexey Proskuryakov.
https://bugs.webkit.org/show_bug.cgi?id=52044
REGRESSION(r74807): No-store is ignored within a document
* http/tests/misc/script-no-store-expected.txt: Added.
* http/tests/misc/script-no-store.html: Added.
* http/tests/misc/resources/random-no-store.php: Added.
2011-01-10 Alejandro G. Castro <alex@igalia.com>
 
Reviewed by Martin Robinson.
......
<?php
header("Cache-Control: no-store");
?>
var p = document.createElement("p");
p.appendChild(document.createTextNode("<?php
print rand();
?>
"));
document.body.appendChild(p);
<body>
<script>
var count = 0;
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
function addRandom()
{
var script = document.createElement("script");
script.setAttribute("src", "resources/random-no-store.php");
document.body.appendChild(script);
}
++count;
addRandom();
setInterval(function() {
if (count == 1 && document.getElementsByTagName("p").length == 1) {
++count;
addRandom();
} else if (document.getElementsByTagName("p").length == 2) {
document.write(document.getElementsByTagName("p")[0].innerHTML == document.getElementsByTagName("p")[1].innerHTML ?
"FAIL<br>" : "PASS<br>");
if (window.layoutTestController)
layoutTestController.notifyDone();
}
}, 10);
</script>
2011-01-10 Antti Koivisto <antti@apple.com>
Reviewed by Alexey Proskuryakov.
https://bugs.webkit.org/show_bug.cgi?id=52044
REGRESSION(r74807): No-store is ignored within a document
Don't use cached resources with Cache-control: no-store (unless cache policy is CachePolicyHistoryBuffer).
This matches a behavior that got lost in r74807.
Test: http/tests/misc/script-no-store.html
(by Alexey Proskuryakov)
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::determineRevalidationPolicy):
2011-01-10 Patrick Gansterer <paroga@webkit.org>
 
Reviewed by Laszlo Gombos.
......
......@@ -402,6 +402,16 @@ CachedResourceLoader::RevalidationPolicy CachedResourceLoader::determineRevalida
if (existingResource->isPreloaded())
return Use;
// CachePolicyHistoryBuffer uses the cache no matter what.
if (cachePolicy() == CachePolicyHistoryBuffer)
return Use;
// Don't reuse resources with Cache-control: no-store.
if (existingResource->response().cacheControlContainsNoStore()) {
LOG(ResourceLoading, "CachedResourceLoader::determineRevalidationPolicy reloading due to Cache-control: no-store.");
return Reload;
}
// Avoid loading the same resource multiple times for a single document, even if the cache policies would tell us to.
if (m_validatedURLs.contains(existingResource->url()))
return Use;
......@@ -412,10 +422,6 @@ CachedResourceLoader::RevalidationPolicy CachedResourceLoader::determineRevalida
return Reload;
}
// CachePolicyHistoryBuffer uses the cache no matter what.
if (cachePolicy() == CachePolicyHistoryBuffer)
return Use;
// We'll try to reload the resource if it failed last time.
if (existingResource->errorOccurred()) {
LOG(ResourceLoading, "CachedResourceLoader::determineRevalidationPolicye reloading due to resource being in the error state");
......
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