servoshell: Move headless setting to ServoShellPreferences (#35377)

This is only used in servoshell, even though it was plumbed through
script previously. It's just about how the `RenderingContext` is set up,
which is something managed entirely outside of servo itself.

In addition, make the name of `servo_shell_preferences` in `app.rs` more
consistent with the rest of the codebase.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-02-07 21:04:31 +01:00 committed by GitHub
parent 1ba5d0e093
commit e227e0913b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 20 additions and 48 deletions

View file

@ -64,7 +64,6 @@ impl DissimilarOriginWindow {
// FIXME(nox): The microtask queue is probably not important
// here, but this whole DOM interface is a hack anyway.
global_to_clone_from.microtask_queue().clone(),
global_to_clone_from.is_headless(),
global_to_clone_from.get_user_agent(),
#[cfg(feature = "webgpu")]
global_to_clone_from.wgpu_id_hub(),

View file

@ -316,9 +316,6 @@ pub(crate) struct GlobalScope {
#[allow(clippy::vec_box)]
consumed_rejections: DomRefCell<Vec<Box<Heap<*mut JSObject>>>>,
/// True if headless mode.
is_headless: bool,
/// An optional string allowing the user agent to be set for testing.
user_agent: Cow<'static, str>,
@ -716,7 +713,6 @@ impl GlobalScope {
origin: MutableOrigin,
creation_url: Option<ServoUrl>,
microtask_queue: Rc<MicrotaskQueue>,
is_headless: bool,
user_agent: Cow<'static, str>,
#[cfg(feature = "webgpu")] gpu_id_hub: Arc<IdentityHub>,
inherited_secure_context: Option<bool>,
@ -751,7 +747,6 @@ impl GlobalScope {
event_source_tracker: DOMTracker::new(),
uncaught_rejections: Default::default(),
consumed_rejections: Default::default(),
is_headless,
user_agent,
#[cfg(feature = "webgpu")]
gpu_id_hub,
@ -2911,10 +2906,6 @@ impl GlobalScope {
);
}
pub(crate) fn is_headless(&self) -> bool {
self.is_headless
}
pub(crate) fn get_user_agent(&self) -> Cow<'static, str> {
self.user_agent.clone()
}

View file

@ -2778,7 +2778,6 @@ impl Window {
unminify_css: bool,
local_script_source: Option<String>,
userscripts_path: Option<String>,
is_headless: bool,
replace_surrogates: bool,
user_agent: Cow<'static, str>,
player_context: WindowGLContext,
@ -2807,7 +2806,6 @@ impl Window {
origin,
Some(creator_url),
microtask_queue,
is_headless,
user_agent,
#[cfg(feature = "webgpu")]
gpu_id_hub,

View file

@ -79,7 +79,6 @@ pub(crate) fn prepare_workerscope_init(
pipeline_id: global.pipeline_id(),
origin: global.origin().immutable().clone(),
creation_url: global.creation_url().clone(),
is_headless: global.is_headless(),
user_agent: global.get_user_agent(),
inherited_secure_context: Some(global.is_secure_context()),
};
@ -165,7 +164,6 @@ impl WorkerGlobalScope {
MutableOrigin::new(init.origin),
init.creation_url,
runtime.microtask_queue.clone(),
init.is_headless,
init.user_agent,
#[cfg(feature = "webgpu")]
gpu_id_hub,

View file

@ -96,7 +96,6 @@ impl WorkletGlobalScope {
MutableOrigin::new(ImmutableOrigin::new_opaque()),
None,
Default::default(),
init.is_headless,
init.user_agent.clone(),
#[cfg(feature = "webgpu")]
init.gpu_id_hub.clone(),
@ -186,8 +185,6 @@ pub(crate) struct WorkletGlobalScopeInit {
pub(crate) to_constellation_sender: IpcSender<(PipelineId, ScriptMsg)>,
/// The image cache
pub(crate) image_cache: Arc<dyn ImageCache>,
/// True if in headless mode
pub(crate) is_headless: bool,
/// An optional string allowing the user agent to be set for testing
pub(crate) user_agent: Cow<'static, str>,
/// Identity manager for WebGPU resources