script: Pass &mut JSContext to reflect_node_with_proto (#43952)

A lot (and I mean, really a lot) depends on these constructors.
Therefore, this is the one spaghetti ball that I could extract and
convert all `can_gc` to `cx`. There are some new introductions of
`temp_cx` in the callbacks of the servo parser, but we already had some
in other callbacks.

Part of #40600

Testing: It compiles

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
This commit is contained in:
Tim van der Lippe
2026-04-05 20:07:30 +02:00
committed by GitHub
parent 621f6b0cf7
commit a1c8896eda
97 changed files with 354 additions and 414 deletions

View File

@@ -7,7 +7,6 @@ use std::cell::Ref;
use js::context::JSContext;
use script_bindings::codegen::GenericBindings::CharacterDataBinding::CharacterDataMethods;
use script_bindings::root::Dom;
use script_bindings::script_runtime::CanGc;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::inheritance::Castable;
@@ -61,11 +60,7 @@ struct TextValueShadowTree {
impl TextValueShadowTree {
fn new(cx: &mut JSContext, shadow_root: &Node) -> Self {
let value = Text::new(
Default::default(),
&shadow_root.owner_document(),
CanGc::from_cx(cx),
);
let value = Text::new(cx, Default::default(), &shadow_root.owner_document());
Node::replace_all(cx, Some(value.upcast()), shadow_root);
Self {
value: value.as_traced(),