Skip to main content

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 animations;
24mod css;
25#[macro_use]
26mod tasks;
27// Bao embedder-callback API (vendor patch) lives on the upstream ScriptThread
28// in event_loop; re-exported here so `servo` crate / bao embedders can reach it.
29pub use event_loop::script_thread::{register_embedder_callback, register_worker_scope_callback};
30mod body;
31pub(crate) mod conversions;
32mod devtools;
33#[macro_use]
34mod dom;
35pub(crate) use dom::canvas_context;
36mod event_loop;
37pub(crate) mod fetch;
38pub(crate) mod indexeddb;
39mod init;
40mod layout_image;
41mod url;
42
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 mime_multipart;
50pub(crate) mod modules;
51mod navigation;
52mod network_listener;
53mod realms;
54mod routed_promise;
55pub(crate) mod script_runtime;
56pub(crate) mod serviceworker_manager;
57mod stylesheet_loader;
58mod stylesheet_set;
59mod svg_font;
60pub mod test;
61mod timers;
62mod webdriver_handlers;
63mod window_named_properties;
64mod xpath;
65
66mod unminify;
67
68mod drag_data_store;
69mod links;
70
71pub use event_loop::script_thread::ScriptThread;
72pub use init::init;
73pub(crate) use script_bindings::DomTypes;
74pub(crate) use script_bindings::reflector::{AssociatedMemory, DomObject, MutDomObject, Reflector};
75pub use script_runtime::JSEngineSetup;
76pub use serviceworker_manager::ServiceWorkerManager;
77
78pub(crate) use crate::dom::bindings::codegen::DomTypeHolder::DomTypeHolder;
79// These trait exports are public, because they are used in the DOM bindings.
80// Since they are used in derive macros,
81// it is useful that they are accessible at the root of the crate.
82pub(crate) use crate::dom::bindings::inheritance::HasParent;
83pub(crate) use crate::dom::bindings::trace::{CustomTraceable, JSTraceable};