script: Pass &mut JSContext to FetchResponseListener::process_response (#43259)

Add the cx parameter to `fn process_response` in the
`FetchResponseListener` trait and the traits that that interface change
requires. Chose to add it as the first parameter, following the same
order that `FetchResponseListener::process_response_eof` uses.

Testing: Checked that servo builds locally as well as `./mach fmt` and
`./mach test-tidy`. I don't think more tests are needed as we are not
introducing new functionality
Fixes: #42840

---------

Signed-off-by: Javier Olaechea <pirata@gmail.com>
This commit is contained in:
Javier Olaechea
2026-03-19 01:22:00 -05:00
committed by GitHub
parent 8215118a12
commit eea60b8eb1
20 changed files with 85 additions and 36 deletions

View File

@@ -35,7 +35,6 @@ use script_bindings::codegen::InheritTypes::{
ElementTypeId, HTMLElementTypeId, HTMLMediaElementTypeId, NodeTypeId,
};
use script_bindings::root::assert_in_script;
use script_bindings::script_runtime::temp_cx;
use script_bindings::weakref::WeakRef;
use servo_config::pref;
use servo_media::player::audio::AudioRenderer;
@@ -3713,11 +3712,12 @@ impl FetchResponseListener for HTMLMediaElementFetchListener {
fn process_request_eof(&mut self, _: RequestId) {}
#[expect(unsafe_code)]
fn process_response(&mut self, _: RequestId, metadata: Result<FetchMetadata, NetworkError>) {
// TODO: https://github.com/servo/servo/issues/42840
let mut cx = unsafe { temp_cx() };
let cx = &mut cx;
fn process_response(
&mut self,
cx: &mut js::context::JSContext,
_: RequestId,
metadata: Result<FetchMetadata, NetworkError>,
) {
let element = self.element.root();
let (metadata, origin_clean) = match metadata {