mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Move mozbrowser_enabled to util::prefs
This commit is contained in:
parent
34858fd0c9
commit
34dfc28e98
6 changed files with 18 additions and 18 deletions
|
@ -69,8 +69,9 @@ use style_traits::viewport::ViewportConstraints;
|
||||||
use timer_scheduler::TimerScheduler;
|
use timer_scheduler::TimerScheduler;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use util::geometry::PagePx;
|
use util::geometry::PagePx;
|
||||||
|
use util::opts;
|
||||||
|
use util::prefs::mozbrowser_enabled;
|
||||||
use util::thread::spawn_named;
|
use util::thread::spawn_named;
|
||||||
use util::{opts, prefs};
|
|
||||||
use webrender_traits;
|
use webrender_traits;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
|
@ -1129,7 +1130,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_alert(&mut self, pipeline_id: PipelineId, message: String, sender: IpcSender<bool>) {
|
fn handle_alert(&mut self, pipeline_id: PipelineId, message: String, sender: IpcSender<bool>) {
|
||||||
let display_alert_dialog = if prefs::get_pref("dom.mozbrowser.enabled").as_boolean().unwrap_or(false) {
|
let display_alert_dialog = if mozbrowser_enabled() {
|
||||||
let parent_pipeline_info = self.pipelines.get(&pipeline_id).and_then(|source| source.parent_info);
|
let parent_pipeline_info = self.pipelines.get(&pipeline_id).and_then(|source| source.parent_info);
|
||||||
if let Some(_) = parent_pipeline_info {
|
if let Some(_) = parent_pipeline_info {
|
||||||
let root_pipeline_id = self.root_frame_id
|
let root_pipeline_id = self.root_frame_id
|
||||||
|
@ -1421,7 +1422,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
||||||
containing_pipeline_id: PipelineId,
|
containing_pipeline_id: PipelineId,
|
||||||
subpage_id: SubpageId,
|
subpage_id: SubpageId,
|
||||||
event: MozBrowserEvent) {
|
event: MozBrowserEvent) {
|
||||||
assert!(prefs::get_pref("dom.mozbrowser.enabled").as_boolean().unwrap_or(false));
|
assert!(mozbrowser_enabled());
|
||||||
|
|
||||||
// Find the script channel for the given parent pipeline,
|
// Find the script channel for the given parent pipeline,
|
||||||
// and pass the event to that script thread.
|
// and pass the event to that script thread.
|
||||||
|
@ -1993,9 +1994,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
||||||
if let Some(pipeline_id) = rng.choose(&*pipeline_ids) {
|
if let Some(pipeline_id) = rng.choose(&*pipeline_ids) {
|
||||||
if let Some(pipeline) = self.pipelines.get(pipeline_id) {
|
if let Some(pipeline) = self.pipelines.get(pipeline_id) {
|
||||||
// Don't kill the mozbrowser pipeline
|
// Don't kill the mozbrowser pipeline
|
||||||
if prefs::get_pref("dom.mozbrowser.enabled").as_boolean().unwrap_or(false) &&
|
if mozbrowser_enabled() && pipeline.parent_info.is_none() {
|
||||||
pipeline.parent_info.is_none()
|
|
||||||
{
|
|
||||||
info!("Not closing mozbrowser pipeline {}.", pipeline_id);
|
info!("Not closing mozbrowser pipeline {}.", pipeline_id);
|
||||||
} else {
|
} else {
|
||||||
// Note that we deliberately do not do any of the tidying up
|
// Note that we deliberately do not do any of the tidying up
|
||||||
|
@ -2088,7 +2087,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowserlocationchange
|
// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowserlocationchange
|
||||||
// Note that this is a no-op if the pipeline is not an immediate child iframe of the root
|
// Note that this is a no-op if the pipeline is not an immediate child iframe of the root
|
||||||
fn trigger_mozbrowserlocationchange(&self, pipeline_id: PipelineId) {
|
fn trigger_mozbrowserlocationchange(&self, pipeline_id: PipelineId) {
|
||||||
if !prefs::get_pref("dom.mozbrowser.enabled").as_boolean().unwrap_or(false) { return; }
|
if !mozbrowser_enabled() { return; }
|
||||||
|
|
||||||
let event_info = self.pipelines.get(&pipeline_id).and_then(|pipeline| {
|
let event_info = self.pipelines.get(&pipeline_id).and_then(|pipeline| {
|
||||||
pipeline.parent_info.map(|(containing_pipeline_id, subpage_id)| {
|
pipeline.parent_info.map(|(containing_pipeline_id, subpage_id)| {
|
||||||
|
@ -2114,7 +2113,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowsererror
|
// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowsererror
|
||||||
// Note that this does not require the pipeline to be an immediate child of the root
|
// Note that this does not require the pipeline to be an immediate child of the root
|
||||||
fn trigger_mozbrowsererror(&self, pipeline_id: PipelineId, reason: String, backtrace: String) {
|
fn trigger_mozbrowsererror(&self, pipeline_id: PipelineId, reason: String, backtrace: String) {
|
||||||
if !prefs::get_pref("dom.mozbrowser.enabled").as_boolean().unwrap_or(false) { return; }
|
if !mozbrowser_enabled() { return; }
|
||||||
|
|
||||||
let ancestor_info = self.get_root_pipeline_and_containing_parent(&pipeline_id);
|
let ancestor_info = self.get_root_pipeline_and_containing_parent(&pipeline_id);
|
||||||
|
|
||||||
|
|
|
@ -356,7 +356,7 @@ impl Pipeline {
|
||||||
pub fn trigger_mozbrowser_event(&self,
|
pub fn trigger_mozbrowser_event(&self,
|
||||||
subpage_id: SubpageId,
|
subpage_id: SubpageId,
|
||||||
event: MozBrowserEvent) {
|
event: MozBrowserEvent) {
|
||||||
assert!(prefs::get_pref("dom.mozbrowser.enabled").as_boolean().unwrap_or(false));
|
assert!(prefs::mozbrowser_enabled());
|
||||||
|
|
||||||
let event = ConstellationControlMsg::MozBrowserEvent(self.id,
|
let event = ConstellationControlMsg::MozBrowserEvent(self.id,
|
||||||
subpage_id,
|
subpage_id,
|
||||||
|
|
|
@ -56,7 +56,7 @@ use dom::htmlembedelement::HTMLEmbedElement;
|
||||||
use dom::htmlformelement::HTMLFormElement;
|
use dom::htmlformelement::HTMLFormElement;
|
||||||
use dom::htmlheadelement::HTMLHeadElement;
|
use dom::htmlheadelement::HTMLHeadElement;
|
||||||
use dom::htmlhtmlelement::HTMLHtmlElement;
|
use dom::htmlhtmlelement::HTMLHtmlElement;
|
||||||
use dom::htmliframeelement::{self, HTMLIFrameElement};
|
use dom::htmliframeelement::HTMLIFrameElement;
|
||||||
use dom::htmlimageelement::HTMLImageElement;
|
use dom::htmlimageelement::HTMLImageElement;
|
||||||
use dom::htmllinkelement::HTMLLinkElement;
|
use dom::htmllinkelement::HTMLLinkElement;
|
||||||
use dom::htmlmetaelement::HTMLMetaElement;
|
use dom::htmlmetaelement::HTMLMetaElement;
|
||||||
|
@ -127,6 +127,7 @@ use task_source::dom_manipulation::DOMManipulationTask;
|
||||||
use time;
|
use time;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use url::percent_encoding::percent_decode;
|
use url::percent_encoding::percent_decode;
|
||||||
|
use util::prefs::mozbrowser_enabled;
|
||||||
use util::str::{split_html_space_chars, str_join};
|
use util::str::{split_html_space_chars, str_join};
|
||||||
|
|
||||||
#[derive(JSTraceable, PartialEq, HeapSizeOf)]
|
#[derive(JSTraceable, PartialEq, HeapSizeOf)]
|
||||||
|
@ -1261,7 +1262,7 @@ impl Document {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn trigger_mozbrowser_event(&self, event: MozBrowserEvent) {
|
pub fn trigger_mozbrowser_event(&self, event: MozBrowserEvent) {
|
||||||
if htmliframeelement::mozbrowser_enabled() {
|
if mozbrowser_enabled() {
|
||||||
if let Some((containing_pipeline_id, subpage_id)) = self.window.parent_info() {
|
if let Some((containing_pipeline_id, subpage_id)) = self.window.parent_info() {
|
||||||
let event = ConstellationMsg::MozBrowserEvent(containing_pipeline_id,
|
let event = ConstellationMsg::MozBrowserEvent(containing_pipeline_id,
|
||||||
subpage_id,
|
subpage_id,
|
||||||
|
|
|
@ -42,13 +42,9 @@ use std::cell::Cell;
|
||||||
use string_cache::Atom;
|
use string_cache::Atom;
|
||||||
use style::context::ReflowGoal;
|
use style::context::ReflowGoal;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use util::prefs;
|
use util::prefs::mozbrowser_enabled;
|
||||||
use util::str::LengthOrPercentageOrAuto;
|
use util::str::LengthOrPercentageOrAuto;
|
||||||
|
|
||||||
pub fn mozbrowser_enabled() -> bool {
|
|
||||||
prefs::get_pref("dom.mozbrowser.enabled").as_boolean().unwrap_or(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(HeapSizeOf)]
|
#[derive(HeapSizeOf)]
|
||||||
enum SandboxAllowance {
|
enum SandboxAllowance {
|
||||||
AllowNothing = 0x00,
|
AllowNothing = 0x00,
|
||||||
|
|
|
@ -62,7 +62,7 @@ use string_cache::Atom;
|
||||||
use time;
|
use time;
|
||||||
use timers::{OneshotTimerCallback, OneshotTimerHandle};
|
use timers::{OneshotTimerCallback, OneshotTimerHandle};
|
||||||
use url::{Url, Position};
|
use url::{Url, Position};
|
||||||
use util::prefs;
|
use util::prefs::mozbrowser_enabled;
|
||||||
|
|
||||||
#[derive(JSTraceable, PartialEq, Copy, Clone, HeapSizeOf)]
|
#[derive(JSTraceable, PartialEq, Copy, Clone, HeapSizeOf)]
|
||||||
enum XMLHttpRequestState {
|
enum XMLHttpRequestState {
|
||||||
|
@ -884,7 +884,7 @@ impl XMLHttpRequest {
|
||||||
// story. See https://github.com/servo/servo/issues/9582
|
// story. See https://github.com/servo/servo/issues/9582
|
||||||
if let GlobalRoot::Window(win) = self.global() {
|
if let GlobalRoot::Window(win) = self.global() {
|
||||||
let is_root_pipeline = win.parent_info().is_none();
|
let is_root_pipeline = win.parent_info().is_none();
|
||||||
let is_mozbrowser_enabled = prefs::get_pref("dom.mozbrowser.enabled").as_boolean().unwrap_or(false);
|
let is_mozbrowser_enabled = mozbrowser_enabled();
|
||||||
is_root_pipeline && is_mozbrowser_enabled
|
is_root_pipeline && is_mozbrowser_enabled
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
|
|
|
@ -243,3 +243,7 @@ pub fn reset_all_prefs() {
|
||||||
reset_pref(name);
|
reset_pref(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn mozbrowser_enabled() -> bool {
|
||||||
|
get_pref("dom.mozbrowser.enabled").as_boolean().unwrap_or(false)
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue