mirror of
https://github.com/servo/servo
synced 2026-04-26 01:25:32 +02:00
script: Pass &mut JSContext in FetchResponseListener::process_response_eof (#42729)
`process_response_eof` is the only method that needs cx at least right now. This PR removes one temp_cx and introduces one, removing that one will is hard (needs VirtualMethods and a lot of work) Testing: Just refactor Part of #40600 --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
@@ -375,6 +375,7 @@ impl FetchResponseListener for ClassicContext {
|
||||
/// step 4-9
|
||||
fn process_response_eof(
|
||||
mut self,
|
||||
cx: &mut js::context::JSContext,
|
||||
_: RequestId,
|
||||
response: Result<(), NetworkError>,
|
||||
timing: ResourceFetchTiming,
|
||||
@@ -388,11 +389,11 @@ impl FetchResponseListener for ClassicContext {
|
||||
self.kind,
|
||||
self.url.clone(),
|
||||
Err(()),
|
||||
CanGc::note(),
|
||||
CanGc::from_cx(cx),
|
||||
);
|
||||
|
||||
// Resource timing is expected to be available before "error" or "load" events are fired.
|
||||
network_listener::submit_timing(&self, &response, &timing, CanGc::note());
|
||||
network_listener::submit_timing(&self, &response, &timing, CanGc::from_cx(cx));
|
||||
return;
|
||||
},
|
||||
_ => {},
|
||||
@@ -469,11 +470,11 @@ impl FetchResponseListener for ClassicContext {
|
||||
self.kind,
|
||||
self.url.clone(),
|
||||
Ok(load),
|
||||
CanGc::note(),
|
||||
CanGc::from_cx(cx),
|
||||
);
|
||||
// }
|
||||
|
||||
network_listener::submit_timing(&self, &response, &timing, CanGc::note());
|
||||
network_listener::submit_timing(&self, &response, &timing, CanGc::from_cx(cx));
|
||||
}
|
||||
|
||||
fn process_csp_violations(&mut self, _request_id: RequestId, violations: Vec<Violation>) {
|
||||
|
||||
Reference in New Issue
Block a user