script/
realms.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5use js::context::JSContext;
6use js::jsapi::JSAutoRealm;
7use js::realm::AutoRealm;
8pub(crate) use script_bindings::realms::{AlreadyInRealm, InRealm};
9use script_bindings::reflector::DomObject;
10
11pub(crate) fn enter_realm(object: &impl DomObject) -> JSAutoRealm {
12    script_bindings::realms::enter_realm::<crate::DomTypeHolder>(object)
13}
14
15pub(crate) fn enter_auto_realm<'cx>(
16    cx: &'cx mut JSContext,
17    object: &impl DomObject,
18) -> AutoRealm<'cx> {
19    script_bindings::realms::enter_auto_realm::<crate::DomTypeHolder>(cx, object)
20}