script: Limit public exports. (#34915)

* script: Restrict reexport visibility of DOM types.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Mass pub->pub(crate) conversion.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Hide existing dead code warnings.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Formatting.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Fix clippy warnings.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Formatting.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Fix unit tests.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Fix clippy.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* More formatting.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2025-01-10 03:19:19 -05:00 committed by GitHub
parent f220d6d3a5
commit c94d909a86
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
585 changed files with 5411 additions and 5013 deletions

View file

@ -3,60 +3,60 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
#[allow(unused_imports)]
pub mod base {
pub use std::ptr;
pub use std::rc::Rc;
pub(crate) mod base {
pub(crate) use std::ptr;
pub(crate) use std::rc::Rc;
pub use js::error::throw_type_error;
pub use js::jsapi::{
pub(crate) use js::error::throw_type_error;
pub(crate) use js::jsapi::{
CurrentGlobalOrNull, HandleValue as RawHandleValue, HandleValueArray, Heap, IsCallable,
JSContext, JSObject, JS_NewObject,
};
pub use js::jsval::{JSVal, NullValue, ObjectOrNullValue, ObjectValue, UndefinedValue};
pub use js::panic::maybe_resume_unwind;
pub use js::rust::wrappers::{JS_CallFunctionValue, JS_WrapValue};
pub use js::rust::{HandleObject, HandleValue, MutableHandleObject, MutableHandleValue};
pub(crate) use js::jsval::{JSVal, NullValue, ObjectOrNullValue, ObjectValue, UndefinedValue};
pub(crate) use js::panic::maybe_resume_unwind;
pub(crate) use js::rust::wrappers::{JS_CallFunctionValue, JS_WrapValue};
pub(crate) use js::rust::{HandleObject, HandleValue, MutableHandleObject, MutableHandleValue};
pub use crate::dom::bindings::callback::{
pub(crate) use crate::dom::bindings::callback::{
wrap_call_this_object, CallSetup, CallbackContainer, CallbackFunction, CallbackInterface,
CallbackObject, ExceptionHandling, ThisReflector,
};
pub use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
pub(crate) use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
ChannelCountMode, ChannelCountModeValues, ChannelInterpretation,
ChannelInterpretationValues,
};
pub use crate::dom::bindings::codegen::DomTypes::DomTypes;
pub use crate::dom::bindings::codegen::UnionTypes;
pub use crate::dom::bindings::conversions::{
pub(crate) use crate::dom::bindings::codegen::DomTypes::DomTypes;
pub(crate) use crate::dom::bindings::codegen::UnionTypes;
pub(crate) use crate::dom::bindings::conversions::{
root_from_handlevalue, ConversionBehavior, ConversionResult, FromJSValConvertible,
StringificationBehavior, ToJSValConvertible,
};
pub use crate::dom::bindings::error::Error::JSFailed;
pub use crate::dom::bindings::error::{throw_dom_exception, Fallible};
pub use crate::dom::bindings::num::Finite;
pub use crate::dom::bindings::proxyhandler::CrossOriginProperties;
pub use crate::dom::bindings::reflector::DomObject;
pub use crate::dom::bindings::root::DomRoot;
pub use crate::dom::bindings::str::{ByteString, DOMString, USVString};
pub use crate::dom::bindings::trace::RootedTraceableBox;
pub use crate::dom::bindings::utils::{
pub(crate) use crate::dom::bindings::error::Error::JSFailed;
pub(crate) use crate::dom::bindings::error::{throw_dom_exception, Fallible};
pub(crate) use crate::dom::bindings::num::Finite;
pub(crate) use crate::dom::bindings::proxyhandler::CrossOriginProperties;
pub(crate) use crate::dom::bindings::reflector::DomObject;
pub(crate) use crate::dom::bindings::root::DomRoot;
pub(crate) use crate::dom::bindings::str::{ByteString, DOMString, USVString};
pub(crate) use crate::dom::bindings::trace::RootedTraceableBox;
pub(crate) use crate::dom::bindings::utils::{
get_dictionary_property, set_dictionary_property, ThreadUnsafeOnceLock,
};
pub use crate::dom::globalscope::GlobalScope;
pub use crate::script_runtime::JSContext as SafeJSContext;
pub(crate) use crate::dom::globalscope::GlobalScope;
pub(crate) use crate::script_runtime::JSContext as SafeJSContext;
}
#[allow(unused_imports)]
pub mod module {
pub use std::cmp;
pub use std::ffi::CString;
pub use std::ptr::NonNull;
pub(crate) mod module {
pub(crate) use std::cmp;
pub(crate) use std::ffi::CString;
pub(crate) use std::ptr::NonNull;
pub use js::glue::{
pub(crate) use js::glue::{
CreateProxyHandler, GetProxyReservedSlot, JS_GetReservedSlot, ProxyTraps,
SetProxyReservedSlot,
};
pub use js::jsapi::{
pub(crate) use js::jsapi::{
JSJitInfo_OpType, JSJitInfo__bindgen_ty_1, JSJitInfo__bindgen_ty_2,
JSJitInfo__bindgen_ty_3, JSJitMethodCallArgs, JSJitSetterCallArgs, JSNativeWrapper,
JSPropertySpec, JSPropertySpec_Accessor, JSPropertySpec_AccessorsOrValue,
@ -76,79 +76,87 @@ pub mod module {
JSCLASS_FOREGROUND_FINALIZE, JSCLASS_RESERVED_SLOTS_SHIFT, JSITER_HIDDEN, JSITER_OWNONLY,
JSITER_SYMBOLS, JSPROP_ENUMERATE, JSPROP_PERMANENT, JSPROP_READONLY,
};
pub use js::jsval::PrivateValue;
pub use js::panic::wrap_panic;
pub use js::rust::wrappers::{
pub(crate) use js::jsval::PrivateValue;
pub(crate) use js::panic::wrap_panic;
pub(crate) use js::rust::wrappers::{
int_to_jsid, AppendToIdVector, Call, GetPropertyKeys, JS_CopyOwnPropertiesAndPrivateFields,
JS_DefineProperty, JS_DefinePropertyById2, JS_GetProperty,
JS_InitializePropertiesFromCompatibleNativeObject, JS_NewObjectWithGivenProto,
JS_NewObjectWithoutMetadata, JS_SetImmutablePrototype, JS_SetProperty, JS_SetPrototype,
JS_WrapObject, NewProxyObject, RUST_INTERNED_STRING_TO_JSID, RUST_SYMBOL_TO_JSID,
};
pub use js::rust::{
pub(crate) use js::rust::{
get_context_realm, get_object_class, get_object_realm, CustomAutoRooterGuard, GCMethods,
Handle, MutableHandle,
};
pub use js::typedarray::{
pub(crate) use js::typedarray::{
ArrayBuffer, ArrayBufferView, Float32Array, Float64Array, Uint8Array, Uint8ClampedArray,
};
pub use js::{
pub(crate) use js::{
jsapi, typedarray, JSCLASS_GLOBAL_SLOT_COUNT, JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL,
JSCLASS_RESERVED_SLOTS_MASK, JS_CALLEE,
};
pub use servo_config::pref;
pub(crate) use servo_config::pref;
pub use super::base::*;
pub use crate::dom::bindings::codegen::Bindings::AnalyserNodeBinding::AnalyserOptions;
pub use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
pub(crate) use super::base::*;
pub(crate) use crate::dom::bindings::codegen::Bindings::AnalyserNodeBinding::AnalyserOptions;
pub(crate) use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
AudioNode_Binding, ChannelCountMode, ChannelCountModeValues, ChannelInterpretation,
ChannelInterpretationValues,
};
pub use crate::dom::bindings::codegen::Bindings::EventTargetBinding::EventTarget_Binding;
pub use crate::dom::bindings::codegen::{InterfaceObjectMap, PrototypeList, RegisterBindings};
pub use crate::dom::bindings::constant::{ConstantSpec, ConstantVal};
pub use crate::dom::bindings::constructor::{
pub(crate) use crate::dom::bindings::codegen::Bindings::EventTargetBinding::EventTarget_Binding;
pub(crate) use crate::dom::bindings::codegen::{
InterfaceObjectMap, PrototypeList, RegisterBindings,
};
pub(crate) use crate::dom::bindings::constant::{ConstantSpec, ConstantVal};
pub(crate) use crate::dom::bindings::constructor::{
call_default_constructor, call_html_constructor, pop_current_element_queue,
push_new_element_queue,
};
pub use crate::dom::bindings::conversions::{
pub(crate) use crate::dom::bindings::conversions::{
is_array_like, jsid_to_string, native_from_handlevalue, native_from_object_static,
IDLInterface, StringificationBehavior, ToJSValConvertible, DOM_OBJECT_SLOT,
};
pub use crate::dom::bindings::error::{throw_constructor_without_new, Error, ErrorResult};
pub use crate::dom::bindings::finalize::{
pub(crate) use crate::dom::bindings::error::{
throw_constructor_without_new, Error, ErrorResult,
};
pub(crate) use crate::dom::bindings::finalize::{
finalize_common, finalize_global, finalize_weak_referenceable,
};
pub use crate::dom::bindings::guard::{Condition, Guard};
pub use crate::dom::bindings::inheritance::Castable;
pub use crate::dom::bindings::interface::{
pub(crate) use crate::dom::bindings::guard::{Condition, Guard};
pub(crate) use crate::dom::bindings::inheritance::Castable;
pub(crate) use crate::dom::bindings::interface::{
create_callback_interface_object, create_global_object, create_interface_prototype_object,
create_named_constructors, create_noncallback_interface_object, define_dom_interface,
define_guarded_methods, define_guarded_properties, get_desired_proto,
get_per_interface_object_handle, is_exposed_in, ConstructorClassHook,
InterfaceConstructorBehavior, NonCallbackInterfaceObjectClass, ProtoOrIfaceIndex,
};
pub use crate::dom::bindings::iterable::{Iterable, IteratorType};
pub use crate::dom::bindings::like::{Maplike, Setlike};
pub use crate::dom::bindings::namespace::{create_namespace_object, NamespaceObjectClass};
pub use crate::dom::bindings::proxyhandler;
pub use crate::dom::bindings::proxyhandler::{
pub(crate) use crate::dom::bindings::iterable::{Iterable, IteratorType};
pub(crate) use crate::dom::bindings::like::{Maplike, Setlike};
pub(crate) use crate::dom::bindings::namespace::{
create_namespace_object, NamespaceObjectClass,
};
pub(crate) use crate::dom::bindings::proxyhandler;
pub(crate) use crate::dom::bindings::proxyhandler::{
ensure_expando_object, get_expando_object, set_property_descriptor,
};
pub use crate::dom::bindings::record::Record;
pub use crate::dom::bindings::reflector::{DomObjectIteratorWrap, DomObjectWrap, Reflector};
pub use crate::dom::bindings::root::{Dom, DomSlice, MaybeUnreflectedDom, Root};
pub use crate::dom::bindings::trace::JSTraceable;
pub use crate::dom::bindings::utils::{
pub(crate) use crate::dom::bindings::record::Record;
pub(crate) use crate::dom::bindings::reflector::{
DomObjectIteratorWrap, DomObjectWrap, Reflector,
};
pub(crate) use crate::dom::bindings::root::{Dom, DomSlice, MaybeUnreflectedDom, Root};
pub(crate) use crate::dom::bindings::trace::JSTraceable;
pub(crate) use crate::dom::bindings::utils::{
enumerate_global, exception_to_promise, generic_getter, generic_lenient_getter,
generic_lenient_setter, generic_method, generic_setter, generic_static_promise_method,
get_array_index_from_id, get_property_on_prototype, has_property_on_prototype,
resolve_global, trace_global, AsVoidPtr, DOMClass, DOMJSClass, ProtoOrIfaceArray,
DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, JSCLASS_DOM_GLOBAL,
};
pub use crate::dom::bindings::weakref::{WeakReferenceable, DOM_WEAK_SLOT};
pub use crate::dom::types::{AnalyserNode, AudioNode, BaseAudioContext, EventTarget};
pub use crate::mem::malloc_size_of_including_raw_self;
pub use crate::realms::{AlreadyInRealm, InRealm};
pub use crate::script_runtime::CanGc;
pub(crate) use crate::dom::bindings::weakref::{WeakReferenceable, DOM_WEAK_SLOT};
pub(crate) use crate::dom::types::{AnalyserNode, AudioNode, BaseAudioContext, EventTarget};
pub(crate) use crate::mem::malloc_size_of_including_raw_self;
pub(crate) use crate::realms::{AlreadyInRealm, InRealm};
pub(crate) use crate::script_runtime::CanGc;
}