mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Don't build testbinding-related code by default (#37034)
Disabling the TestBinding-related bindings and implementations saves 2mb in a release build. Also, we lost the related test preferences when we turned the layout-2020 tests on, so the tests have all been failing for a long time. Testing: Existing tests in CI. --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
2eab9c6df1
commit
a028291466
35 changed files with 72 additions and 149 deletions
|
@ -18,6 +18,7 @@ crown = ['js/crown']
|
|||
debugmozjs = ['js/debugmozjs']
|
||||
jitspew = ['js/jitspew']
|
||||
profilemozjs = ['js/profilemozjs']
|
||||
testbinding = ["script_bindings/testbinding"]
|
||||
tracing = ["dep:tracing", "script_bindings/tracing"]
|
||||
webgl_backtrace = ["canvas_traits/webgl_backtrace"]
|
||||
js_backtrace = []
|
||||
|
|
|
@ -549,17 +549,29 @@ pub(crate) mod svgelement;
|
|||
pub(crate) mod svggraphicselement;
|
||||
pub(crate) mod svgimageelement;
|
||||
pub(crate) mod svgsvgelement;
|
||||
#[cfg(feature = "testbinding")]
|
||||
pub(crate) mod testbinding;
|
||||
#[cfg(feature = "testbinding")]
|
||||
pub(crate) mod testbindingiterable;
|
||||
#[cfg(feature = "testbinding")]
|
||||
pub(crate) mod testbindingmaplikewithinterface;
|
||||
#[cfg(feature = "testbinding")]
|
||||
pub(crate) mod testbindingmaplikewithprimitive;
|
||||
#[cfg(feature = "testbinding")]
|
||||
pub(crate) mod testbindingpairiterable;
|
||||
#[cfg(feature = "testbinding")]
|
||||
pub(crate) mod testbindingproxy;
|
||||
#[cfg(feature = "testbinding")]
|
||||
pub(crate) mod testbindingsetlikewithinterface;
|
||||
#[cfg(feature = "testbinding")]
|
||||
pub(crate) mod testbindingsetlikewithprimitive;
|
||||
#[cfg(feature = "testbinding")]
|
||||
pub(crate) mod testns;
|
||||
#[cfg(feature = "testbinding")]
|
||||
pub(crate) mod testutils;
|
||||
#[cfg(feature = "testbinding")]
|
||||
pub(crate) mod testworklet;
|
||||
#[cfg(feature = "testbinding")]
|
||||
pub(crate) mod testworkletglobalscope;
|
||||
pub(crate) mod text;
|
||||
pub(crate) mod textcontrol;
|
||||
|
|
|
@ -43,6 +43,7 @@ use crate::dom::bindings::str::USVString;
|
|||
use crate::dom::bindings::trace::{CustomTraceable, JSTraceable, RootedTraceableBox};
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::promise::Promise;
|
||||
#[cfg(feature = "testbinding")]
|
||||
use crate::dom::testworkletglobalscope::TestWorkletTask;
|
||||
use crate::dom::window::Window;
|
||||
use crate::dom::workletglobalscope::{
|
||||
|
@ -354,6 +355,7 @@ impl WorkletThreadPool {
|
|||
}
|
||||
|
||||
/// For testing.
|
||||
#[cfg(feature = "testbinding")]
|
||||
pub(crate) fn test_worklet_lookup(&self, id: WorkletId, key: String) -> Option<String> {
|
||||
let (sender, receiver) = unbounded();
|
||||
let msg = WorkletData::Task(id, WorkletTask::Test(TestWorkletTask::Lookup(key, sender)));
|
||||
|
|
|
@ -26,6 +26,7 @@ use crate::dom::bindings::trace::CustomTraceable;
|
|||
use crate::dom::bindings::utils::define_all_exposed_interfaces;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::paintworkletglobalscope::{PaintWorkletGlobalScope, PaintWorkletTask};
|
||||
#[cfg(feature = "testbinding")]
|
||||
use crate::dom::testworkletglobalscope::{TestWorkletGlobalScope, TestWorkletTask};
|
||||
#[cfg(feature = "webgpu")]
|
||||
use crate::dom::webgpu::identityhub::IdentityHub;
|
||||
|
@ -60,6 +61,7 @@ impl WorkletGlobalScope {
|
|||
init: &WorkletGlobalScopeInit,
|
||||
) -> DomRoot<WorkletGlobalScope> {
|
||||
let scope: DomRoot<WorkletGlobalScope> = match scope_type {
|
||||
#[cfg(feature = "testbinding")]
|
||||
WorkletGlobalScopeType::Test => DomRoot::upcast(TestWorkletGlobalScope::new(
|
||||
runtime,
|
||||
pipeline_id,
|
||||
|
@ -163,6 +165,7 @@ impl WorkletGlobalScope {
|
|||
/// Perform a worklet task
|
||||
pub(crate) fn perform_a_worklet_task(&self, task: WorkletTask) {
|
||||
match task {
|
||||
#[cfg(feature = "testbinding")]
|
||||
WorkletTask::Test(task) => match self.downcast::<TestWorkletGlobalScope>() {
|
||||
Some(global) => global.perform_a_worklet_task(task),
|
||||
None => warn!("This is not a test worklet."),
|
||||
|
@ -203,6 +206,7 @@ pub(crate) struct WorkletGlobalScopeInit {
|
|||
#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf)]
|
||||
pub(crate) enum WorkletGlobalScopeType {
|
||||
/// A servo-specific testing worklet
|
||||
#[cfg(feature = "testbinding")]
|
||||
Test,
|
||||
/// A paint worklet
|
||||
Paint,
|
||||
|
@ -210,6 +214,7 @@ pub(crate) enum WorkletGlobalScopeType {
|
|||
|
||||
/// A task which can be performed in the context of a worklet global.
|
||||
pub(crate) enum WorkletTask {
|
||||
#[cfg(feature = "testbinding")]
|
||||
Test(TestWorkletTask),
|
||||
Paint(PaintWorkletTask),
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ use crate::dom::bindings::str::DOMString;
|
|||
use crate::dom::document::{FakeRequestAnimationFrameCallback, RefreshRedirectDue};
|
||||
use crate::dom::eventsource::EventSourceTimeoutCallback;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
#[cfg(feature = "testbinding")]
|
||||
use crate::dom::testbinding::TestBindingCallback;
|
||||
use crate::dom::types::{Window, WorkerGlobalScope};
|
||||
use crate::dom::xmlhttprequest::XHRTimeoutCallback;
|
||||
|
@ -78,6 +79,7 @@ pub(crate) enum OneshotTimerCallback {
|
|||
XhrTimeout(XHRTimeoutCallback),
|
||||
EventSourceTimeout(EventSourceTimeoutCallback),
|
||||
JsTimer(JsTimerTask),
|
||||
#[cfg(feature = "testbinding")]
|
||||
TestBindingCallback(TestBindingCallback),
|
||||
FakeRequestAnimationFrame(FakeRequestAnimationFrameCallback),
|
||||
RefreshRedirectDue(RefreshRedirectDue),
|
||||
|
@ -89,6 +91,7 @@ impl OneshotTimerCallback {
|
|||
OneshotTimerCallback::XhrTimeout(callback) => callback.invoke(can_gc),
|
||||
OneshotTimerCallback::EventSourceTimeout(callback) => callback.invoke(),
|
||||
OneshotTimerCallback::JsTimer(task) => task.invoke(this, js_timers, can_gc),
|
||||
#[cfg(feature = "testbinding")]
|
||||
OneshotTimerCallback::TestBindingCallback(callback) => callback.invoke(),
|
||||
OneshotTimerCallback::FakeRequestAnimationFrame(callback) => callback.invoke(can_gc),
|
||||
OneshotTimerCallback::RefreshRedirectDue(callback) => callback.invoke(can_gc),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue