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
23#[macro_use]
24mod tasks;
25// Bao embedder-callback API (vendor patch) lives on the upstream ScriptThread
26// in event_loop; re-exported here so `servo` crate / bao embedders can reach it.
27pub use event_loop::script_thread::{register_embedder_callback, register_worker_scope_callback};
28pub(crate) mod conversions;
29mod css;
30mod devtools;
31mod fetch;
32#[macro_use]
33mod dom;
34pub(crate) use dom::canvas_context;
35mod drag;
36mod engine;
37mod event_loop;
38mod url;
39
40pub mod layout_dom;
41mod links;
42pub(crate) mod messaging;
43mod microtask;
44pub(crate) mod mime;
45pub(crate) mod modules;
46mod navigation;
47mod realms;
48mod routed_promise;
49pub(crate) mod script_runtime;
50pub mod test;
51mod timers;
52mod unminify;
53mod webdriver_handlers;
54mod window_named_properties;
55mod xpath;
56
57pub use event_loop::script_thread::ScriptThread;
58pub(crate) use script_bindings::DomTypes;
59pub(crate) use script_bindings::reflector::{AssociatedMemory, DomObject, MutDomObject, Reflector};
60
61pub(crate) use crate::dom::bindings::codegen::DomTypeHolder::DomTypeHolder;
62// These trait exports are public, because they are used in the DOM bindings.
63// Since they are used in derive macros,
64// it is useful that they are accessible at the root of the crate.
65pub(crate) use crate::dom::bindings::inheritance::HasParent;
66pub(crate) use crate::dom::bindings::trace::{CustomTraceable, JSTraceable};
67pub use crate::dom::serviceworker::serviceworker_manager::ServiceWorkerManager;
68pub use crate::engine::handle::JSEngineSetup;
69pub use crate::engine::init::init;