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 script_window_proxies;
26#[macro_use]
27mod task;
28mod body;
29pub(crate) mod clipboard_provider;
30pub(crate) mod conversions;
31mod devtools;
32pub(crate) mod document_loader;
33#[macro_use]
34mod dom;
35pub(crate) use dom::canvas_context;
36pub(crate) mod fetch;
37pub(crate) mod indexed_db;
38mod init;
39mod layout_image;
40
41pub(crate) mod document_collection;
42pub(crate) mod iframe_collection;
43pub(crate) mod image_animation;
44pub mod layout_dom;
45pub(crate) mod messaging;
46mod microtask;
47pub(crate) mod mime;
48mod navigation;
49mod network_listener;
50mod realms;
51mod routed_promise;
52#[expect(dead_code)]
53mod script_module;
54mod script_mutation_observers;
55pub(crate) mod script_runtime;
56#[expect(unsafe_code)]
57pub(crate) mod script_thread;
58pub(crate) mod security_manager;
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::{DomObject, MutDomObject, Reflector};
89pub(crate) use crate::dom::bindings::trace::{CustomTraceable, JSTraceable};