script: Correctly apply resource timing buffer limit (#44228)

Strictly follow the
[specs](https://w3c.github.io/resource-timing/#performance-can-add-resource-timing-entry)

Also fires the performance resource timing earlier to
match WPT expectations.

Testing: More WPT tests Passed.

---------

Signed-off-by: Shubham Gupta <shubham.gupta@chromium.org>
This commit is contained in:
Shubham Gupta
2026-04-21 19:17:11 +08:00
committed by GitHub
parent 4a5fe14788
commit d1e3e8080c
25 changed files with 13 additions and 115 deletions

View File

@@ -438,6 +438,9 @@ impl FetchResponseListener for ClassicContext {
response: Result<(), NetworkError>,
timing: ResourceFetchTiming,
) {
// Resource timing is expected to be available before "error" or "load" events are fired.
network_listener::submit_timing(cx, &self, &response, &timing);
let elem = self.elem.root();
match (response.as_ref(), self.status.as_ref()) {
@@ -446,9 +449,6 @@ impl FetchResponseListener for ClassicContext {
// Step 6, response is an error.
*elem.result.borrow_mut() = Some(Err(()));
finish_fetching_a_script(&elem, self.kind, cx);
// Resource timing is expected to be available before "error" or "load" events are fired.
network_listener::submit_timing(cx, &self, &response, &timing);
return;
},
_ => {},
@@ -522,8 +522,6 @@ impl FetchResponseListener for ClassicContext {
*elem.result.borrow_mut() = Some(Ok(Script::Classic(script)));
finish_fetching_a_script(&elem, self.kind, cx);
// }
network_listener::submit_timing(cx, &self, &response, &timing);
}
fn process_csp_violations(&mut self, _request_id: RequestId, violations: Vec<Violation>) {