mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Extract user_agent from global opts
This commit is contained in:
parent
50ea9fc02d
commit
2c306227e9
9 changed files with 108 additions and 75 deletions
|
@ -166,7 +166,7 @@ use servo_config::{opts, pref};
|
|||
use servo_rand::{random, Rng, ServoRng, SliceRandom};
|
||||
use servo_remutex::ReentrantMutex;
|
||||
use servo_url::{Host, ImmutableOrigin, ServoUrl};
|
||||
use std::borrow::ToOwned;
|
||||
use std::borrow::{Cow, ToOwned};
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::collections::{HashMap, HashSet, VecDeque};
|
||||
use std::marker::PhantomData;
|
||||
|
@ -503,6 +503,9 @@ pub struct Constellation<Message, LTF, STF, SWF> {
|
|||
|
||||
/// Pipeline ID of the active media session.
|
||||
active_media_session: Option<PipelineId>,
|
||||
|
||||
/// User agent string to report in network requests.
|
||||
user_agent: Cow<'static, str>,
|
||||
}
|
||||
|
||||
/// State needed to construct a constellation.
|
||||
|
@ -562,6 +565,9 @@ pub struct InitialConstellationState {
|
|||
|
||||
/// A flag share with the compositor to indicate that a WR frame is in progress.
|
||||
pub pending_wr_frame: Arc<AtomicBool>,
|
||||
|
||||
/// User agent string to report in network requests.
|
||||
pub user_agent: Cow<'static, str>,
|
||||
}
|
||||
|
||||
/// Data needed for webdriver
|
||||
|
@ -1021,6 +1027,7 @@ where
|
|||
player_context: state.player_context,
|
||||
event_loop_waker: state.event_loop_waker,
|
||||
active_media_session: None,
|
||||
user_agent: state.user_agent,
|
||||
};
|
||||
|
||||
constellation.run();
|
||||
|
@ -1268,6 +1275,7 @@ where
|
|||
webxr_registry: self.webxr_registry.clone(),
|
||||
player_context: self.player_context.clone(),
|
||||
event_loop_waker: self.event_loop_waker.as_ref().map(|w| (*w).clone_box()),
|
||||
user_agent: self.user_agent.clone(),
|
||||
});
|
||||
|
||||
let pipeline = match result {
|
||||
|
|
|
@ -41,6 +41,7 @@ use script_traits::{ScriptThreadFactory, TimerSchedulerMsg, WindowSizeData};
|
|||
use servo_config::opts::{self, Opts};
|
||||
use servo_config::{prefs, prefs::PrefValue};
|
||||
use servo_url::ServoUrl;
|
||||
use std::borrow::Cow;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::rc::Rc;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
|
@ -201,6 +202,9 @@ pub struct InitialPipelineState {
|
|||
|
||||
/// Mechanism to force the compositor to process events.
|
||||
pub event_loop_waker: Option<Box<dyn EventLoopWaker>>,
|
||||
|
||||
/// User agent string to report in network requests.
|
||||
pub user_agent: Cow<'static, str>,
|
||||
}
|
||||
|
||||
pub struct NewPipeline {
|
||||
|
@ -304,6 +308,7 @@ impl Pipeline {
|
|||
webvr_chan: state.webvr_chan,
|
||||
webxr_registry: state.webxr_registry,
|
||||
player_context: state.player_context,
|
||||
user_agent: state.user_agent,
|
||||
};
|
||||
|
||||
// Spawn the child process.
|
||||
|
@ -520,6 +525,7 @@ pub struct UnprivilegedPipelineContent {
|
|||
webvr_chan: Option<IpcSender<WebVRMsg>>,
|
||||
webxr_registry: webxr_api::Registry,
|
||||
player_context: WindowGLContext,
|
||||
user_agent: Cow<'static, str>,
|
||||
}
|
||||
|
||||
impl UnprivilegedPipelineContent {
|
||||
|
@ -588,7 +594,7 @@ impl UnprivilegedPipelineContent {
|
|||
self.opts.userscripts,
|
||||
self.opts.headless,
|
||||
self.opts.replace_surrogates,
|
||||
self.opts.user_agent,
|
||||
self.user_agent,
|
||||
);
|
||||
|
||||
LTF::create(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue