aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/window.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2025-02-17 23:13:43 -0500
committerGitHub <noreply@github.com>2025-02-18 04:13:43 +0000
commit1d606bb85cd34c6d37ae8d022b7cb32adadb9b08 (patch)
tree3c1c70468394f3cd722117f22d84cbcb069cebec /components/script/dom/window.rs
parent32f19c1eae3ead86987fa353f3f3e7e6fadb47eb (diff)
downloadservo-1d606bb85cd34c6d37ae8d022b7cb32adadb9b08.tar.gz
servo-1d606bb85cd34c6d37ae8d022b7cb32adadb9b08.zip
Make WebBluetooth an optional feature. (#35479)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r--components/script/dom/window.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 0e3bf71d269..375e6621992 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -18,6 +18,7 @@ use backtrace::Backtrace;
use base::cross_process_instant::CrossProcessInstant;
use base::id::{BrowsingContextId, PipelineId, WebViewId};
use base64::Engine;
+#[cfg(feature = "bluetooth")]
use bluetooth_traits::BluetoothRequest;
use canvas_traits::webgl::WebGLChan;
use crossbeam_channel::{unbounded, Sender};
@@ -113,6 +114,7 @@ use crate::dom::bindings::structuredclone;
use crate::dom::bindings::trace::{CustomTraceable, JSTraceable, RootedTraceableBox};
use crate::dom::bindings::utils::GlobalStaticData;
use crate::dom::bindings::weakref::DOMTracker;
+#[cfg(feature = "bluetooth")]
use crate::dom::bluetooth::BluetoothExtraPermissionData;
use crate::dom::crypto::Crypto;
use crate::dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSStyleOwner};
@@ -137,6 +139,7 @@ use crate::dom::promise::Promise;
use crate::dom::screen::Screen;
use crate::dom::selection::Selection;
use crate::dom::storage::Storage;
+#[cfg(feature = "bluetooth")]
use crate::dom::testrunner::TestRunner;
use crate::dom::types::UIEvent;
use crate::dom::webglrenderingcontext::WebGLCommandSender;
@@ -273,8 +276,10 @@ pub(crate) struct Window {
/// A handle for communicating messages to the bluetooth thread.
#[no_trace]
+ #[cfg(feature = "bluetooth")]
bluetooth_thread: IpcSender<BluetoothRequest>,
+ #[cfg(feature = "bluetooth")]
bluetooth_extra_permission_data: BluetoothExtraPermissionData,
/// An enlarged rectangle around the page contents visible in the viewport, used
@@ -307,6 +312,7 @@ pub(crate) struct Window {
/// All the MediaQueryLists we need to update
media_query_lists: DOMTracker<MediaQueryList>,
+ #[cfg(feature = "bluetooth")]
test_runner: MutNullableDom<TestRunner>,
/// A handle for communicating messages to the WebGL thread, if available.
@@ -504,10 +510,12 @@ impl Window {
})
}
+ #[cfg(feature = "bluetooth")]
pub(crate) fn bluetooth_thread(&self) -> IpcSender<BluetoothRequest> {
self.bluetooth_thread.clone()
}
+ #[cfg(feature = "bluetooth")]
pub(crate) fn bluetooth_extra_permission_data(&self) -> &BluetoothExtraPermissionData {
&self.bluetooth_extra_permission_data
}
@@ -1425,6 +1433,7 @@ impl WindowMethods<crate::DomTypeHolder> for Window {
fetch::Fetch(self.upcast(), input, init, comp, can_gc)
}
+ #[cfg(feature = "bluetooth")]
fn TestRunner(&self) -> DomRoot<TestRunner> {
self.test_runner.or_init(|| TestRunner::new(self.upcast()))
}
@@ -2733,7 +2742,7 @@ impl Window {
image_cache_sender: IpcSender<PendingImageResponse>,
image_cache: Arc<dyn ImageCache>,
resource_threads: ResourceThreads,
- bluetooth_thread: IpcSender<BluetoothRequest>,
+ #[cfg(feature = "bluetooth")] bluetooth_thread: IpcSender<BluetoothRequest>,
mem_profiler_chan: MemProfilerChan,
time_profiler_chan: TimeProfilerChan,
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
@@ -2809,7 +2818,9 @@ impl Window {
parent_info,
dom_static: GlobalStaticData::new(),
js_runtime: DomRefCell::new(Some(runtime.clone())),
+ #[cfg(feature = "bluetooth")]
bluetooth_thread,
+ #[cfg(feature = "bluetooth")]
bluetooth_extra_permission_data: BluetoothExtraPermissionData::new(),
page_clip_rect: Cell::new(MaxRect::max_rect()),
unhandled_resize_event: Default::default(),
@@ -2823,6 +2834,7 @@ impl Window {
error_reporter,
scroll_offsets: Default::default(),
media_query_lists: DOMTracker::new(),
+ #[cfg(feature = "bluetooth")]
test_runner: Default::default(),
webgl_chan,
#[cfg(feature = "webxr")]