mirror of
https://github.com/servo/servo
synced 2026-04-26 17:45:19 +02:00
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:
@@ -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>) {
|
||||
|
||||
Reference in New Issue
Block a user