script/
lib.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
5#![cfg_attr(crown, feature(register_tool))]
6#![deny(unsafe_code)]
7#![doc = "The script crate contains all matters DOM."]
8// Register the linter `crown`, which is the Servo-specific linter for the script crate.
9#![cfg_attr(crown, register_tool(crown))]
10
11// These are used a lot so let's keep them for now
12#[macro_use]
13extern crate js;
14#[macro_use]
15extern crate jstraceable_derive;
16#[macro_use]
17extern crate log;
18#[macro_use]
19extern crate malloc_size_of_derive;
20#[macro_use]
21extern crate stylo_atoms;
22
23mod animation_timeline;
24mod animations;
25mod css;
26mod script_window_proxies;
27#[macro_use]
28mod task;
29mod body;
30pub(crate) mod clipboard_provider;
31pub(crate) mod conversions;
32mod devtools;
33pub(crate) mod document_loader;
34#[macro_use]
35mod dom;
36pub(crate) use dom::canvas_context;
37pub(crate) mod fetch;
38pub(crate) mod indexeddb;
39mod init;
40mod layout_image;
41
42pub(crate) mod document_collection;
43pub(crate) mod iframe_collection;
44pub(crate) mod image_animation;
45pub mod layout_dom;
46pub(crate) mod messaging;
47mod microtask;
48pub(crate) mod mime;
49mod module_loading;
50mod navigation;
51mod network_listener;
52mod realms;
53mod routed_promise;
54mod script_module;
55mod script_mutation_observers;
56pub(crate) mod script_runtime;
57#[expect(unsafe_code)]
58pub(crate) mod script_thread;
59pub(crate) mod serviceworker_manager;
60mod stylesheet_loader;
61mod stylesheet_set;
62mod task_manager;
63mod task_queue;
64mod task_source;
65pub mod test;
66pub mod textinput;
67mod timers;
68mod webdriver_handlers;
69mod window_named_properties;
70mod xpath;
71
72mod unminify;
73
74mod drag_data_store;
75mod links;
76
77pub use init::init;
78pub(crate) use script_bindings::DomTypes;
79pub use script_runtime::JSEngineSetup;
80pub use script_thread::ScriptThread;
81pub use serviceworker_manager::ServiceWorkerManager;
82
83pub(crate) use crate::dom::bindings::codegen::DomTypeHolder::DomTypeHolder;
84// These trait exports are public, because they are used in the DOM bindings.
85// Since they are used in derive macros,
86// it is useful that they are accessible at the root of the crate.
87pub(crate) use crate::dom::bindings::inheritance::HasParent;
88pub(crate) use crate::dom::bindings::reflector::{
89    AssociatedMemory, DomObject, MutDomObject, Reflector,
90};
91pub(crate) use crate::dom::bindings::trace::{CustomTraceable, JSTraceable};