Skip to main content

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    pub(crate) use js::typedarray::{
26        HeapArrayBuffer, HeapArrayBufferView, HeapFloat32Array, HeapFloat64Array, HeapUint8Array,
27        HeapUint8ClampedArray,
28    };
29
30    pub(crate) use crate::callback::{
31        CallbackContainer, CallbackFunction, CallbackInterface, CallbackObject, ExceptionHandling,
32        ThisReflector, call_setup, wrap_call_this_value,
33    };
34    pub(crate) use crate::codegen::DomTypes::DomTypes;
35    pub(crate) use crate::codegen::GenericUnionTypes;
36    pub(crate) use crate::conversions::{StringificationBehavior, root_from_handlevalue};
37    pub(crate) use crate::error::Error::JSFailed;
38    pub(crate) use crate::error::Fallible;
39    pub(crate) use crate::interfaces::*;
40    pub(crate) use crate::lock::ThreadUnsafeOnceLock;
41    pub(crate) use crate::num::Finite;
42    pub(crate) use crate::proxyhandler::CrossOriginProperties;
43    pub(crate) use crate::reflector::{DomGlobalGeneric, DomObject};
44    pub(crate) use crate::root::DomRoot;
45    pub(crate) use crate::script_runtime::JSContext as SafeJSContext;
46    pub(crate) use crate::str::{ByteString, DOMString, USVString};
47    pub(crate) use crate::trace::RootedTraceableBox;
48    pub(crate) use crate::utils::{get_dictionary_property, set_dictionary_property};
49}
50
51pub(crate) mod module {
52    pub(crate) use std::cmp;
53    pub(crate) use std::ffi::CString;
54    pub(crate) use std::ptr::NonNull;
55
56    pub(crate) use js::conversions::ToJSValConvertible;
57    pub(crate) use js::glue::{
58        CreateProxyHandler, GetProxyReservedSlot, JS_GetReservedSlot, ProxyTraps,
59    };
60    pub(crate) use js::jsapi::{
61        __BindgenBitfieldUnit, CallArgs, GCContext, GetRealmErrorPrototype,
62        GetRealmFunctionPrototype, GetRealmIteratorPrototype, GetRealmObjectPrototype,
63        GetWellKnownSymbol, Handle as RawHandle, HandleId as RawHandleId,
64        HandleObject as RawHandleObject, JS_AtomizeAndPinString, JS_ForwardGetPropertyTo,
65        JS_GetPropertyDescriptorById, JS_HasPropertyById, JS_NewPlainObject, JS_SetReservedSlot,
66        JSAutoRealm, JSCLASS_FOREGROUND_FINALIZE, JSCLASS_RESERVED_SLOTS_SHIFT, JSClass,
67        JSClassOps, JSFunctionSpec, JSITER_HIDDEN, JSITER_OWNONLY, JSITER_SYMBOLS,
68        JSJitGetterCallArgs, JSJitInfo, JSJitInfo__bindgen_ty_1, JSJitInfo__bindgen_ty_2,
69        JSJitInfo__bindgen_ty_3, JSJitInfo_AliasSet, JSJitInfo_ArgType, JSJitInfo_OpType,
70        JSJitMethodCallArgs, JSJitSetterCallArgs, JSNativeWrapper, JSPROP_ENUMERATE,
71        JSPROP_PERMANENT, JSPROP_READONLY, JSPropertySpec, JSPropertySpec_Accessor,
72        JSPropertySpec_AccessorsOrValue, JSPropertySpec_AccessorsOrValue_Accessors,
73        JSPropertySpec_Kind, JSPropertySpec_Name, JSPropertySpec_ValueWrapper,
74        JSPropertySpec_ValueWrapper__bindgen_ty_1, JSPropertySpec_ValueWrapper_Type, JSTracer,
75        JSTypedMethodJitInfo, JSValueType, MutableHandle as RawMutableHandle,
76        MutableHandleIdVector as RawMutableHandleIdVector,
77        MutableHandleObject as RawMutableHandleObject, MutableHandleValue as RawMutableHandleValue,
78        ObjectOpResult, PropertyDescriptor, SymbolCode, jsid,
79    };
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, JS_NewObjectWithoutMetadata,
84        JS_SetImmutablePrototype, JS_SetProperty, JS_SetPrototype, RUST_INTERNED_STRING_TO_JSID,
85        RUST_SYMBOL_TO_JSID, int_to_jsid,
86    };
87    pub(crate) use js::rust::{CustomAutoRooterGuard, GCMethods, Handle, MutableHandle};
88    pub(crate) use js::{
89        JS_CALLEE, JSCLASS_GLOBAL_SLOT_COUNT, JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL,
90        JSCLASS_RESERVED_SLOTS_MASK, typedarray,
91    };
92    pub(crate) use servo_config::pref;
93
94    pub(crate) use super::base::*;
95    pub(crate) use crate::codegen::Globals::Globals;
96    pub(crate) use crate::codegen::{PrototypeList, RegisterBindings};
97    pub(crate) use crate::constant::{ConstantSpec, ConstantVal};
98    pub(crate) use crate::constructor::{
99        CallbackInit, NamespaceInit, call_default_constructor, create_callback_interface_objects,
100        create_namespace_interface_objects,
101    };
102    #[cfg(feature = "testbinding")]
103    pub(crate) use crate::conversions::native_from_handlevalue;
104    pub(crate) use crate::conversions::{
105        StringificationBehavior, is_array_like, jsid_to_string, native_from_object_static,
106    };
107    pub(crate) use crate::error::{Error, ErrorResult};
108    pub(crate) use crate::finalize::{
109        finalize_common, finalize_global, finalize_weak_referenceable,
110    };
111    pub(crate) use crate::guard::{Condition, Guard};
112    pub(crate) use crate::inheritance::Castable;
113    pub(crate) use crate::interface::{
114        ConstructorClassHook, InterfaceConstructorBehavior, NonCallbackInterfaceObjectClass,
115        ProtoOrIfaceIndex, create_global_object, create_interface_prototype_object,
116        create_named_constructors, create_noncallback_interface_object, define_dom_interface,
117        define_guarded_methods, define_guarded_properties, get_per_interface_object_handle,
118        is_exposed_in,
119    };
120    pub(crate) use crate::iterable::{Iterable, IterableIterator, IteratorType};
121    #[cfg(feature = "testbinding")]
122    pub(crate) use crate::like::Maplike;
123    pub(crate) use crate::like::Setlike;
124    pub(crate) use crate::mem::malloc_size_of_including_raw_self;
125    pub(crate) use crate::namespace::NamespaceObjectClass;
126    pub(crate) use crate::proxyhandler::{get_expando_object, set_property_descriptor};
127    pub(crate) use crate::realms::{AlreadyInRealm, InRealm};
128    #[cfg(feature = "testbinding")]
129    pub(crate) use crate::root::{Dom, DomSlice};
130    pub(crate) use crate::root::{MaybeUnreflectedDom, Root};
131    pub(crate) use crate::script_runtime::CanGc;
132    pub(crate) use crate::utils::{
133        DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, DOMClass, DOMJSClass, JSCLASS_DOM_GLOBAL,
134        ProtoOrIfaceArray, call_policies, enumerate_global, enumerate_window, exception_to_promise,
135        generic_getter, generic_method, generic_setter, generic_static_promise_method,
136        get_array_index_from_id, get_property_on_prototype, has_property_on_prototype,
137        may_resolve_global, may_resolve_window, resolve_global, resolve_window, trace_global,
138    };
139    pub(crate) use crate::{JSTraceable, proxyhandler};
140}