mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Share prefs to content processes
Without this `./mach run -b -- -M` would start fine but navigating to a site would fail with: `thread 'ScriptThread PipelineId { namespace_id: PipelineNamespaceId(0), index: PipelineIndex(0) }' panicked at 'assertion failed: mozbrowser_enabled()', /Users/ulf/Documents/Code/servo/components/script/dom/htmliframeelement.rs:163`
This commit is contained in:
parent
f9608022ca
commit
d433fb01ed
3 changed files with 16 additions and 4 deletions
|
@ -26,6 +26,7 @@ use profile_traits::time;
|
||||||
use script_traits::{ConstellationControlMsg, InitialScriptState, MozBrowserEvent};
|
use script_traits::{ConstellationControlMsg, InitialScriptState, MozBrowserEvent};
|
||||||
use script_traits::{LayoutControlMsg, LayoutMsg, NewLayoutInfo, ScriptMsg};
|
use script_traits::{LayoutControlMsg, LayoutMsg, NewLayoutInfo, ScriptMsg};
|
||||||
use script_traits::{ScriptToCompositorMsg, ScriptThreadFactory, TimerEventRequest};
|
use script_traits::{ScriptToCompositorMsg, ScriptThreadFactory, TimerEventRequest};
|
||||||
|
use std::collections::HashMap;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::sync::mpsc::{Receiver, Sender, channel};
|
use std::sync::mpsc::{Receiver, Sender, channel};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
@ -33,7 +34,7 @@ use util;
|
||||||
use util::geometry::{PagePx, ViewportPx};
|
use util::geometry::{PagePx, ViewportPx};
|
||||||
use util::ipc::OptionalIpcSender;
|
use util::ipc::OptionalIpcSender;
|
||||||
use util::opts::{self, Opts};
|
use util::opts::{self, Opts};
|
||||||
use util::prefs;
|
use util::prefs::{self, Pref};
|
||||||
use util::thread;
|
use util::thread;
|
||||||
use webrender_traits;
|
use webrender_traits;
|
||||||
|
|
||||||
|
@ -232,6 +233,7 @@ impl Pipeline {
|
||||||
failure: failure,
|
failure: failure,
|
||||||
script_port: script_port,
|
script_port: script_port,
|
||||||
opts: (*opts::get()).clone(),
|
opts: (*opts::get()).clone(),
|
||||||
|
prefs: prefs::get_cloned(),
|
||||||
layout_to_paint_chan: layout_to_paint_chan,
|
layout_to_paint_chan: layout_to_paint_chan,
|
||||||
pipeline_port: pipeline_port,
|
pipeline_port: pipeline_port,
|
||||||
layout_shutdown_chan: layout_shutdown_chan,
|
layout_shutdown_chan: layout_shutdown_chan,
|
||||||
|
@ -408,6 +410,7 @@ pub struct UnprivilegedPipelineContent {
|
||||||
script_port: Option<IpcReceiver<ConstellationControlMsg>>,
|
script_port: Option<IpcReceiver<ConstellationControlMsg>>,
|
||||||
layout_to_paint_chan: OptionalIpcSender<LayoutToPaintMsg>,
|
layout_to_paint_chan: OptionalIpcSender<LayoutToPaintMsg>,
|
||||||
opts: Opts,
|
opts: Opts,
|
||||||
|
prefs: HashMap<String, Pref>,
|
||||||
paint_shutdown_chan: IpcSender<()>,
|
paint_shutdown_chan: IpcSender<()>,
|
||||||
pipeline_port: Option<IpcReceiver<LayoutControlMsg>>,
|
pipeline_port: Option<IpcReceiver<LayoutControlMsg>>,
|
||||||
pipeline_namespace_id: PipelineNamespaceId,
|
pipeline_namespace_id: PipelineNamespaceId,
|
||||||
|
@ -472,6 +475,10 @@ impl UnprivilegedPipelineContent {
|
||||||
pub fn opts(&self) -> Opts {
|
pub fn opts(&self) -> Opts {
|
||||||
self.opts.clone()
|
self.opts.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn prefs(&self) -> HashMap<String, Pref> {
|
||||||
|
self.prefs.clone()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct PrivilegedPipelineContent {
|
pub struct PrivilegedPipelineContent {
|
||||||
|
|
|
@ -81,8 +81,8 @@ use profile_traits::mem;
|
||||||
use profile_traits::time;
|
use profile_traits::time;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::sync::mpsc::Sender;
|
use std::sync::mpsc::Sender;
|
||||||
use util::opts;
|
|
||||||
use util::resource_files::resources_dir_path;
|
use util::resource_files::resources_dir_path;
|
||||||
|
use util::{opts, prefs};
|
||||||
|
|
||||||
pub use gleam::gl;
|
pub use gleam::gl;
|
||||||
|
|
||||||
|
@ -251,6 +251,7 @@ pub fn run_content_process(token: String) {
|
||||||
|
|
||||||
let unprivileged_content = unprivileged_content_receiver.recv().unwrap();
|
let unprivileged_content = unprivileged_content_receiver.recv().unwrap();
|
||||||
opts::set_defaults(unprivileged_content.opts());
|
opts::set_defaults(unprivileged_content.opts());
|
||||||
|
prefs::extend_prefs(unprivileged_content.prefs());
|
||||||
|
|
||||||
// Enter the sandbox if necessary.
|
// Enter the sandbox if necessary.
|
||||||
if opts::get().sandbox {
|
if opts::get().sandbox {
|
||||||
|
|
|
@ -19,7 +19,7 @@ lazy_static! {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Clone, Debug)]
|
#[derive(PartialEq, Clone, Debug, Deserialize, Serialize)]
|
||||||
pub enum PrefValue {
|
pub enum PrefValue {
|
||||||
Boolean(bool),
|
Boolean(bool),
|
||||||
String(String),
|
String(String),
|
||||||
|
@ -83,7 +83,7 @@ impl ToJson for PrefValue {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
pub enum Pref {
|
pub enum Pref {
|
||||||
NoDefault(Arc<PrefValue>),
|
NoDefault(Arc<PrefValue>),
|
||||||
WithDefault(Arc<PrefValue>, Option<Arc<PrefValue>>)
|
WithDefault(Arc<PrefValue>, Option<Arc<PrefValue>>)
|
||||||
|
@ -157,6 +157,10 @@ pub fn read_prefs_from_file<T>(mut file: T)
|
||||||
Ok(prefs)
|
Ok(prefs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_cloned() -> HashMap<String, Pref> {
|
||||||
|
PREFS.lock().unwrap().clone()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn extend_prefs(extension: HashMap<String, Pref>) {
|
pub fn extend_prefs(extension: HashMap<String, Pref>) {
|
||||||
PREFS.lock().unwrap().extend(extension);
|
PREFS.lock().unwrap().extend(extension);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue