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

@ -30,7 +30,7 @@ use crate::script_runtime::{CanGc, JSContext};
/// The values that an iterator will iterate over.
#[derive(JSTraceable, MallocSizeOf)]
pub enum IteratorType {
pub(crate) enum IteratorType {
/// The keys of the iterable object.
Keys,
/// The values of the iterable object.
@ -40,7 +40,7 @@ pub enum IteratorType {
}
/// A DOM object that can be iterated over using a pair value iterator.
pub trait Iterable {
pub(crate) trait Iterable {
/// The type of the key of the iterator pair.
type Key: ToJSValConvertible;
/// The type of the value of the iterator pair.
@ -56,7 +56,7 @@ pub trait Iterable {
/// An iterator over the iterable entries of a given DOM interface.
//FIXME: #12811 prevents dom_struct with type parameters
#[dom_struct]
pub struct IterableIterator<T: DomObjectIteratorWrap + JSTraceable + Iterable> {
pub(crate) struct IterableIterator<T: DomObjectIteratorWrap + JSTraceable + Iterable> {
reflector: Reflector,
iterable: Dom<T>,
type_: IteratorType,
@ -65,7 +65,7 @@ pub struct IterableIterator<T: DomObjectIteratorWrap + JSTraceable + Iterable> {
impl<T: DomObjectIteratorWrap + JSTraceable + Iterable> IterableIterator<T> {
/// Create a new iterator instance for the provided iterable DOM interface.
pub fn new(iterable: &T, type_: IteratorType) -> DomRoot<Self> {
pub(crate) fn new(iterable: &T, type_: IteratorType) -> DomRoot<Self> {
let iterator = Box::new(IterableIterator {
reflector: Reflector::new(),
type_,
@ -77,7 +77,7 @@ impl<T: DomObjectIteratorWrap + JSTraceable + Iterable> IterableIterator<T> {
/// Return the next value from the iterable object.
#[allow(non_snake_case)]
pub fn Next(&self, cx: JSContext) -> Fallible<NonNull<JSObject>> {
pub(crate) fn Next(&self, cx: JSContext) -> Fallible<NonNull<JSObject>> {
let index = self.index.get();
rooted!(in(*cx) let mut value = UndefinedValue());
rooted!(in(*cx) let mut rval = ptr::null_mut::<JSObject>());