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

@ -20,7 +20,7 @@ use crate::script_runtime::CanGc;
#[repr(u16)]
#[allow(clippy::enum_variant_names)]
#[derive(Clone, Copy, Debug, Eq, JSTraceable, MallocSizeOf, Ord, PartialEq, PartialOrd)]
pub enum DOMErrorName {
pub(crate) enum DOMErrorName {
IndexSizeError = DOMExceptionConstants::INDEX_SIZE_ERR,
HierarchyRequestError = DOMExceptionConstants::HIERARCHY_REQUEST_ERR,
WrongDocumentError = DOMExceptionConstants::WRONG_DOCUMENT_ERR,
@ -50,7 +50,7 @@ pub enum DOMErrorName {
}
impl DOMErrorName {
pub fn from(s: &DOMString) -> Option<DOMErrorName> {
pub(crate) fn from(s: &DOMString) -> Option<DOMErrorName> {
match s.as_ref() {
"IndexSizeError" => Some(DOMErrorName::IndexSizeError),
"HierarchyRequestError" => Some(DOMErrorName::HierarchyRequestError),
@ -84,7 +84,7 @@ impl DOMErrorName {
}
#[dom_struct]
pub struct DOMException {
pub(crate) struct DOMException {
reflector_: Reflector,
message: DOMString,
name: DOMString,
@ -137,7 +137,7 @@ impl DOMException {
)
}
pub fn new_inherited(message: DOMString, name: DOMString) -> DOMException {
pub(crate) fn new_inherited(message: DOMString, name: DOMString) -> DOMException {
DOMException {
reflector_: Reflector::new(),
message,
@ -145,7 +145,7 @@ impl DOMException {
}
}
pub fn new(global: &GlobalScope, code: DOMErrorName) -> DomRoot<DOMException> {
pub(crate) fn new(global: &GlobalScope, code: DOMErrorName) -> DomRoot<DOMException> {
let (message, name) = DOMException::get_error_data_by_code(code);
reflect_dom_object(
@ -156,7 +156,7 @@ impl DOMException {
}
// not an IDL stringifier, used internally
pub fn stringifier(&self) -> DOMString {
pub(crate) fn stringifier(&self) -> DOMString {
DOMString::from(format!("{}: {}", self.name, self.message))
}
}