mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
net: Use the unfiltered response status when comparing against cached resources. (#35483)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
5ab3641a8e
commit
34c73fb452
3 changed files with 29 additions and 2 deletions
|
@ -625,13 +625,15 @@ impl HttpCache {
|
||||||
Some(resources) => resources,
|
Some(resources) => resources,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let actual_response = response.actual_response();
|
||||||
|
|
||||||
// Ensure we only wake-up consumers of relevant resources,
|
// Ensure we only wake-up consumers of relevant resources,
|
||||||
// ie we don't want to wake-up 200 awaiting consumers with a 206.
|
// ie we don't want to wake-up 200 awaiting consumers with a 206.
|
||||||
let relevant_cached_resources = cached_resources.iter().filter(|resource| {
|
let relevant_cached_resources = cached_resources.iter().filter(|resource| {
|
||||||
if response.actual_response().is_network_error() {
|
if actual_response.is_network_error() {
|
||||||
return *resource.body.lock().unwrap() == ResponseBody::Empty;
|
return *resource.body.lock().unwrap() == ResponseBody::Empty;
|
||||||
}
|
}
|
||||||
resource.status == response.status
|
resource.status == actual_response.status
|
||||||
});
|
});
|
||||||
|
|
||||||
for cached_resource in relevant_cached_resources {
|
for cached_resource in relevant_cached_resources {
|
||||||
|
|
7
tests/wpt/mozilla/meta/MANIFEST.json
vendored
7
tests/wpt/mozilla/meta/MANIFEST.json
vendored
|
@ -12758,6 +12758,13 @@
|
||||||
{}
|
{}
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
"cache-crossorigin.sub.html": [
|
||||||
|
"b186dff229d06886fb613629a6f37cb1f526985f",
|
||||||
|
[
|
||||||
|
null,
|
||||||
|
{}
|
||||||
|
]
|
||||||
|
],
|
||||||
"cache_crossorigin_response.sub.html": [
|
"cache_crossorigin_response.sub.html": [
|
||||||
"266995f30afa3e9b3472e4cc43be6493c562aef6",
|
"266995f30afa3e9b3472e4cc43be6493c562aef6",
|
||||||
[
|
[
|
||||||
|
|
18
tests/wpt/mozilla/tests/mozilla/cache-crossorigin.sub.html
vendored
Normal file
18
tests/wpt/mozilla/tests/mozilla/cache-crossorigin.sub.html
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf=8">
|
||||||
|
<title>Cache entries update when cross-origin requests complete</title>
|
||||||
|
<script src="/resources/testharness.js"></script>
|
||||||
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
var t = async_test("Prefetched cross-origin script loads correctly");
|
||||||
|
</script>
|
||||||
|
<!-- Load a script from a cross-origin domain. Prefetching will ensure a
|
||||||
|
cache entry is created for this resource, then the actual load should
|
||||||
|
read from the cache entry rather than the network. -->
|
||||||
|
<script src="http://{{domains[www]}}:{{ports[http][0]}}/common/get-host-info.sub.js?pipe=trickle(1:d1)|header(Cache-Control,max-age=604800)|header(Pragma,ignored)" onload="t.done()"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Add table
Add a link
Reference in a new issue