script_bindings/
import.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
5pub(crate) mod base {
6    pub(crate) use std::ptr;
7    pub(crate) use std::rc::Rc;
8
9    #[allow(unused_imports)]
10    pub(crate) use js::context::{JSContext, RawJSContext};
11    pub(crate) use js::conversions::{
12        ConversionBehavior, ConversionResult, FromJSValConvertible, ToJSValConvertible,
13    };
14    pub(crate) use js::error::throw_type_error;
15    pub(crate) use js::jsapi::{
16        HandleValue as RawHandleValue, HandleValueArray, Heap, IsCallable, JS_NewObject, JSObject,
17    };
18    pub(crate) use js::jsval::{JSVal, NullValue, ObjectOrNullValue, ObjectValue, UndefinedValue};
19    pub(crate) use js::panic::maybe_resume_unwind;
20    #[allow(unused_imports)]
21    pub(crate) use js::realm::{AutoRealm, CurrentRealm};
22    pub(crate) use js::rust::wrappers::Call;
23    pub(crate) use js::rust::{HandleObject, HandleValue, MutableHandleObject, MutableHandleValue};
24    pub(crate) use js::typedarray::{
25        ArrayBuffer, ArrayBufferView, Float32Array, Float64Array, Uint8Array, Uint8ClampedArray,
26    };
27
28    pub(crate) use crate::callback::{
29        CallSetup, CallbackContainer, CallbackFunction, CallbackInterface, CallbackObject,
30        ExceptionHandling, ThisReflector, wrap_call_this_value,
31    };
32    pub(crate) use crate::codegen::DomTypes::DomTypes;
33    pub(crate) use crate::codegen::GenericUnionTypes;
34    pub(crate) use crate::conversions::{StringificationBehavior, root_from_handlevalue};
35    pub(crate) use crate::error::Error::JSFailed;
36    pub(crate) use crate::error::Fallible;
37    pub(crate) use crate::interfaces::*;
38    pub(crate) use crate::lock::ThreadUnsafeOnceLock;
39    pub(crate) use crate::num::Finite;
40    pub(crate) use crate::proxyhandler::CrossOriginProperties;
41    pub(crate) use crate::reflector::{DomGlobalGeneric, DomObject};
42    pub(crate) use crate::root::DomRoot;
43    pub(crate) use crate::script_runtime::{CanGc, JSContext as SafeJSContext};
44    pub(crate) use crate::str::{ByteString, DOMString, USVString};
45    pub(crate) use crate::trace::RootedTraceableBox;
46    pub(crate) use crate::utils::{get_dictionary_property, set_dictionary_property};
47}
48
49pub(crate) mod module {
50    pub(crate) use std::cmp;
51    pub(crate) use std::ffi::CString;
52    pub(crate) use std::ptr::NonNull;
53
54    pub(crate) use js::conversions::ToJSValConvertible;
55    pub(crate) use js::glue::{
56        CreateProxyHandler, GetProxyReservedSlot, JS_GetReservedSlot, ProxyTraps,
57        SetProxyReservedSlot,
58    };
59    pub(crate) use js::jsapi::{
60        __BindgenBitfieldUnit, CallArgs, GCContext, GetRealmErrorPrototype,
61        GetRealmFunctionPrototype, GetRealmIteratorPrototype, GetRealmObjectPrototype,
62        GetWellKnownSymbol, Handle as RawHandle, HandleId as RawHandleId,
63        HandleObject as RawHandleObject, JS_AtomizeAndPinString, JS_ForwardGetPropertyTo,
64        JS_GetPropertyDescriptorById, JS_HasPropertyById, JS_NewPlainObject, JS_SetReservedSlot,
65        JSAutoRealm, JSCLASS_FOREGROUND_FINALIZE, JSCLASS_RESERVED_SLOTS_SHIFT, JSClass,
66        JSClassOps, JSFunctionSpec, JSITER_HIDDEN, JSITER_OWNONLY, JSITER_SYMBOLS,
67        JSJitGetterCallArgs, JSJitInfo, JSJitInfo__bindgen_ty_1, JSJitInfo__bindgen_ty_2,
68        JSJitInfo__bindgen_ty_3, JSJitInfo_AliasSet, JSJitInfo_ArgType, JSJitInfo_OpType,
69        JSJitMethodCallArgs, JSJitSetterCallArgs, JSNativeWrapper, JSPROP_ENUMERATE,
70        JSPROP_PERMANENT, JSPROP_READONLY, JSPropertySpec, JSPropertySpec_Accessor,
71        JSPropertySpec_AccessorsOrValue, JSPropertySpec_AccessorsOrValue_Accessors,
72        JSPropertySpec_Kind, JSPropertySpec_Name, JSPropertySpec_ValueWrapper,
73        JSPropertySpec_ValueWrapper__bindgen_ty_1, JSPropertySpec_ValueWrapper_Type, JSTracer,
74        JSTypedMethodJitInfo, JSValueType, MutableHandle as RawMutableHandle,
75        MutableHandleIdVector as RawMutableHandleIdVector,
76        MutableHandleObject as RawMutableHandleObject, MutableHandleValue as RawMutableHandleValue,
77        ObjectOpResult, PropertyDescriptor, SymbolCode, UndefinedHandleValue, jsid,
78    };
79    pub(crate) use js::jsval::PrivateValue;
80    pub(crate) use js::panic::wrap_panic;
81    pub(crate) use js::rust::wrappers::{
82        AppendToIdVector, Call, GetPropertyKeys, JS_CopyOwnPropertiesAndPrivateFields,
83        JS_DefineProperty, JS_DefinePropertyById2, JS_GetProperty,
84        JS_InitializePropertiesFromCompatibleNativeObject, JS_NewObjectWithGivenProto,
85        JS_NewObjectWithoutMetadata, JS_SetImmutablePrototype, JS_SetProperty, JS_SetPrototype,
86        JS_WrapObject, NewProxyObject, RUST_INTERNED_STRING_TO_JSID, RUST_SYMBOL_TO_JSID,
87        int_to_jsid,
88    };
89    pub(crate) use js::rust::{
90        CustomAutoRooterGuard, GCMethods, Handle, MutableHandle, get_context_realm,
91        get_object_class, get_object_realm,
92    };
93    pub(crate) use js::{
94        JS_CALLEE, JSCLASS_GLOBAL_SLOT_COUNT, JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL,
95        JSCLASS_RESERVED_SLOTS_MASK, typedarray,
96    };
97    pub(crate) use servo_config::pref;
98
99    pub(crate) use super::base::*;
100    pub(crate) use crate::codegen::Globals::Globals;
101    pub(crate) use crate::codegen::{PrototypeList, RegisterBindings};
102    pub(crate) use crate::constant::{ConstantSpec, ConstantVal};
103    pub(crate) use crate::constructor::call_default_constructor;
104    pub(crate) use crate::conversions::{
105        DOM_OBJECT_SLOT, StringificationBehavior, is_array_like, jsid_to_string,
106        native_from_handlevalue, native_from_object_static,
107    };
108    pub(crate) use crate::error::{Error, ErrorResult};
109    pub(crate) use crate::finalize::{
110        finalize_common, finalize_global, finalize_weak_referenceable,
111    };
112    pub(crate) use crate::guard::{Condition, Guard};
113    pub(crate) use crate::inheritance::Castable;
114    pub(crate) use crate::interface::{
115        ConstructorClassHook, InterfaceConstructorBehavior, NonCallbackInterfaceObjectClass,
116        ProtoOrIfaceIndex, create_callback_interface_object, create_global_object,
117        create_interface_prototype_object, create_named_constructors,
118        create_noncallback_interface_object, define_dom_interface, define_guarded_methods,
119        define_guarded_properties, get_per_interface_object_handle, is_exposed_in,
120    };
121    pub(crate) use crate::iterable::{Iterable, IterableIterator, IteratorType};
122    pub(crate) use crate::like::{Maplike, Setlike};
123    pub(crate) use crate::mem::malloc_size_of_including_raw_self;
124    pub(crate) use crate::namespace::{NamespaceObjectClass, create_namespace_object};
125    pub(crate) use crate::proxyhandler::{
126        ensure_expando_object, get_expando_object, set_property_descriptor,
127    };
128    pub(crate) use crate::realms::{AlreadyInRealm, InRealm};
129    pub(crate) use crate::root::{Dom, DomSlice, MaybeUnreflectedDom, Root};
130    pub(crate) use crate::script_runtime::CanGc;
131    pub(crate) use crate::utils::{
132        AsVoidPtr, DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, DOMClass, DOMJSClass, JSCLASS_DOM_GLOBAL,
133        ProtoOrIfaceArray, enumerate_global, enumerate_window, exception_to_promise,
134        generic_getter, generic_lenient_getter, generic_lenient_setter, generic_method,
135        generic_setter, generic_static_promise_method, get_array_index_from_id,
136        get_property_on_prototype, has_property_on_prototype, may_resolve_global,
137        may_resolve_window, resolve_global, resolve_window, trace_global,
138    };
139    pub(crate) use crate::weakref::DOM_WEAK_SLOT;
140    pub(crate) use crate::{JSTraceable, proxyhandler};
141}