script: Pass &mut JSContext to DOM apis that call Element::create (#43108)

Testing: No behaviour change, a successful build is enough.
Part of #40600

---------

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
This commit is contained in:
Gae24
2026-03-09 11:07:13 +01:00
committed by GitHub
parent c32d9f51af
commit fa86bbedbe
13 changed files with 154 additions and 99 deletions

View File

@@ -4,6 +4,7 @@
use dom_struct::dom_struct;
use html5ever::{LocalName, Prefix, QualName, local_name, ns};
use js::context::JSContext;
use js::rust::HandleObject;
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
use style::color::AbsoluteColor;
@@ -78,12 +79,13 @@ impl HTMLTableSectionElementMethods<crate::DomTypeHolder> for HTMLTableSectionEl
}
/// <https://html.spec.whatwg.org/multipage/#dom-tbody-insertrow>
fn InsertRow(&self, index: i32, can_gc: CanGc) -> Fallible<DomRoot<HTMLElement>> {
fn InsertRow(&self, cx: &mut JSContext, index: i32) -> Fallible<DomRoot<HTMLElement>> {
let node = self.upcast::<Node>();
node.insert_cell_or_row(
cx,
index,
|| self.Rows(),
|| {
|cx| {
let row = Element::create(
QualName::new(None, ns!(html), local_name!("tr")),
None,
@@ -91,11 +93,10 @@ impl HTMLTableSectionElementMethods<crate::DomTypeHolder> for HTMLTableSectionEl
ElementCreator::ScriptCreated,
CustomElementCreationMode::Asynchronous,
None,
can_gc,
CanGc::from_cx(cx),
);
DomRoot::downcast::<HTMLTableRowElement>(row).unwrap()
},
can_gc,
)
}