script: propagate VirtualMethods::unbind_from_tree with &mut JSContext (#44422)

Propagate `&mut JSContext` in `VirtualMethods::unbind_from_tree`

Testing: Successful build is enough
Fixes: #42837

---------

Signed-off-by: Emmanuel Paul Elom <elomemmanuel007@gmail.com>
This commit is contained in:
elomscansio
2026-04-23 15:09:11 +01:00
committed by GitHub
parent ff0e9655a8
commit aa7eca43b7
25 changed files with 71 additions and 92 deletions

View File

@@ -6,7 +6,6 @@ use dom_struct::dom_struct;
use html5ever::{LocalName, Prefix, local_name};
use js::context::JSContext;
use js::rust::HandleObject;
use script_bindings::script_runtime::temp_cx;
use style::attr::AttrValue;
use crate::dom::attr::Attr;
@@ -23,7 +22,6 @@ use crate::dom::html::htmlmediaelement::HTMLMediaElement;
use crate::dom::html::htmlpictureelement::HTMLPictureElement;
use crate::dom::node::{BindContext, Node, NodeDamage, UnbindContext};
use crate::dom::virtualmethods::VirtualMethods;
use crate::script_runtime::CanGc;
#[dom_struct]
pub(crate) struct HTMLSourceElement {
@@ -175,15 +173,9 @@ impl VirtualMethods for HTMLSourceElement {
}
}
#[expect(unsafe_code)]
/// <https://html.spec.whatwg.org/multipage/#the-source-element:html-element-removing-steps>
fn unbind_from_tree(&self, context: &UnbindContext, _can_gc: CanGc) {
// TODO: https://github.com/servo/servo/issues/42837
let mut cx = unsafe { temp_cx() };
let cx = &mut cx;
self.super_type()
.unwrap()
.unbind_from_tree(context, CanGc::from_cx(cx));
fn unbind_from_tree(&self, cx: &mut js::context::JSContext, context: &UnbindContext) {
self.super_type().unwrap().unbind_from_tree(cx, context);
// Step 1. If oldParent is a picture element, then for each child of oldParent's children,
// if child is an img element, then count this as a relevant mutation for child.