Files
servo/components/script/dom/bindings/import.rs
Sam fa12f7a5e5 script: Add cx_no_gc/cx/realm codegen option and demostrate them (#40582)
Companion to https://github.com/servo/mozjs/pull/650

We added 3 new options to bindings.conf, each more powerful then the
previous one, so one should use the least powerful as possible to keep
things flexible:
1 `cx_no_gc` prepends argument `&JSContext`, which allows creating NoGC
tokens and using functions that do not trigger GC.
2. `cx` prepends argument `&mut JSContext`, which allows everything that
previous one allows, but it also allows calling GC triggering functions.
3. `realm` prepends argument `&mut CurrentRealm`, which can be deref_mut
to `&mut JSContext` (so it can do everything that previous can), but it
also ensures that there is current entered realm, which can be used for
creation of InRealm.

next steps: #40600 

reviewable per commit

Testing: It's just refactoring
try run: https://github.com/sagudev/servo/actions/runs/19287700927

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-11-16 04:53:54 +00:00

30 lines
1.1 KiB
Rust

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
pub(crate) mod base {
pub(crate) use std::ptr;
#[allow(unused_imports)]
pub(crate) use js::context::JSContext;
#[allow(unused_imports)]
pub(crate) use js::realm::CurrentRealm;
pub(crate) use js::rust::{HandleObject, MutableHandleObject};
pub(crate) use crate::script_runtime::{CanGc, JSContext as SafeJSContext};
}
pub(crate) mod module {
pub(crate) use script_bindings::codegen::PrototypeList;
pub(crate) use script_bindings::conversions::IDLInterface;
pub(crate) use script_bindings::utils::DOMClass;
pub(crate) use super::base::*;
pub(crate) use crate::dom::bindings::iterable::IterableIterator;
pub(crate) use crate::dom::bindings::reflector::{
DomObjectIteratorWrap, DomObjectWrap, Reflector,
};
pub(crate) use crate::dom::bindings::root::{Dom, Root};
pub(crate) use crate::dom::bindings::weakref::WeakReferenceable;
}