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

@ -41,11 +41,11 @@ use crate::realms::enter_realm;
use crate::script_runtime::{CanGc, JSContext, ThreadSafeJSContext};
use crate::task::TaskOnce;
pub type TrustedWorkerAddress = Trusted<Worker>;
pub(crate) type TrustedWorkerAddress = Trusted<Worker>;
// https://html.spec.whatwg.org/multipage/#worker
#[dom_struct]
pub struct Worker {
pub(crate) struct Worker {
eventtarget: EventTarget,
/// Sender to the Receiver associated with the DedicatedWorkerGlobalScope
/// this Worker created.
@ -84,11 +84,11 @@ impl Worker {
)
}
pub fn is_terminated(&self) -> bool {
pub(crate) fn is_terminated(&self) -> bool {
self.terminated.get()
}
pub fn set_context_for_interrupt(&self, cx: ThreadSafeJSContext) {
pub(crate) fn set_context_for_interrupt(&self, cx: ThreadSafeJSContext) {
assert!(
self.context_for_interrupt.borrow().is_none(),
"Context for interrupt must be set only once"
@ -96,7 +96,7 @@ impl Worker {
*self.context_for_interrupt.borrow_mut() = Some(cx);
}
pub fn handle_message(
pub(crate) fn handle_message(
address: TrustedWorkerAddress,
data: StructuredSerializedData,
can_gc: CanGc,
@ -127,7 +127,7 @@ impl Worker {
}
}
pub fn dispatch_simple_error(address: TrustedWorkerAddress, can_gc: CanGc) {
pub(crate) fn dispatch_simple_error(address: TrustedWorkerAddress, can_gc: CanGc) {
let worker = address.root();
worker.upcast().fire_event(atom!("error"), can_gc);
}