From 34c73fb452e960ecef3b0488476e7ec2a64eba00 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Sun, 16 Feb 2025 08:19:51 -0500 Subject: [PATCH] net: Use the unfiltered response status when comparing against cached resources. (#35483) Signed-off-by: Josh Matthews --- components/net/http_cache.rs | 6 ++++-- tests/wpt/mozilla/meta/MANIFEST.json | 7 +++++++ .../tests/mozilla/cache-crossorigin.sub.html | 18 ++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 tests/wpt/mozilla/tests/mozilla/cache-crossorigin.sub.html diff --git a/components/net/http_cache.rs b/components/net/http_cache.rs index 0f0f715b3f6..4a606671554 100644 --- a/components/net/http_cache.rs +++ b/components/net/http_cache.rs @@ -625,13 +625,15 @@ impl HttpCache { Some(resources) => resources, }; + let actual_response = response.actual_response(); + // Ensure we only wake-up consumers of relevant resources, // ie we don't want to wake-up 200 awaiting consumers with a 206. 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; } - resource.status == response.status + resource.status == actual_response.status }); for cached_resource in relevant_cached_resources { diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index ae5c9073ac9..66ea0dc9151 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -12758,6 +12758,13 @@ {} ] ], + "cache-crossorigin.sub.html": [ + "b186dff229d06886fb613629a6f37cb1f526985f", + [ + null, + {} + ] + ], "cache_crossorigin_response.sub.html": [ "266995f30afa3e9b3472e4cc43be6493c562aef6", [ diff --git a/tests/wpt/mozilla/tests/mozilla/cache-crossorigin.sub.html b/tests/wpt/mozilla/tests/mozilla/cache-crossorigin.sub.html new file mode 100644 index 00000000000..b186dff229d --- /dev/null +++ b/tests/wpt/mozilla/tests/mozilla/cache-crossorigin.sub.html @@ -0,0 +1,18 @@ + + + + + Cache entries update when cross-origin requests complete + + + + + + + + +