aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2016-05-24 00:10:01 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2016-05-27 00:55:04 +0200
commit34dfc28e989a8583aa925cc252f635693bb8bfbb (patch)
treee1835d63e35c7e589506807faac6b43a2a209835 /components/script/dom
parent34858fd0c94d470f69f4ed206f7b79dca2dbfb2a (diff)
downloadservo-34dfc28e989a8583aa925cc252f635693bb8bfbb.tar.gz
servo-34dfc28e989a8583aa925cc252f635693bb8bfbb.zip
Move mozbrowser_enabled to util::prefs
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/document.rs5
-rw-r--r--components/script/dom/htmliframeelement.rs6
-rw-r--r--components/script/dom/xmlhttprequest.rs4
3 files changed, 6 insertions, 9 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 89755564bb6..d65efd7acd8 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -56,7 +56,7 @@ use dom::htmlembedelement::HTMLEmbedElement;
use dom::htmlformelement::HTMLFormElement;
use dom::htmlheadelement::HTMLHeadElement;
use dom::htmlhtmlelement::HTMLHtmlElement;
-use dom::htmliframeelement::{self, HTMLIFrameElement};
+use dom::htmliframeelement::HTMLIFrameElement;
use dom::htmlimageelement::HTMLImageElement;
use dom::htmllinkelement::HTMLLinkElement;
use dom::htmlmetaelement::HTMLMetaElement;
@@ -127,6 +127,7 @@ use task_source::dom_manipulation::DOMManipulationTask;
use time;
use url::Url;
use url::percent_encoding::percent_decode;
+use util::prefs::mozbrowser_enabled;
use util::str::{split_html_space_chars, str_join};
#[derive(JSTraceable, PartialEq, HeapSizeOf)]
@@ -1261,7 +1262,7 @@ impl Document {
}
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() {
let event = ConstellationMsg::MozBrowserEvent(containing_pipeline_id,
subpage_id,
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs
index 8cec0aa6659..a2d6d4bac5a 100644
--- a/components/script/dom/htmliframeelement.rs
+++ b/components/script/dom/htmliframeelement.rs
@@ -42,13 +42,9 @@ use std::cell::Cell;
use string_cache::Atom;
use style::context::ReflowGoal;
use url::Url;
-use util::prefs;
+use util::prefs::mozbrowser_enabled;
use util::str::LengthOrPercentageOrAuto;
-pub fn mozbrowser_enabled() -> bool {
- prefs::get_pref("dom.mozbrowser.enabled").as_boolean().unwrap_or(false)
-}
-
#[derive(HeapSizeOf)]
enum SandboxAllowance {
AllowNothing = 0x00,
diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs
index 27fe4a783f0..e1ce424a1c5 100644
--- a/components/script/dom/xmlhttprequest.rs
+++ b/components/script/dom/xmlhttprequest.rs
@@ -62,7 +62,7 @@ use string_cache::Atom;
use time;
use timers::{OneshotTimerCallback, OneshotTimerHandle};
use url::{Url, Position};
-use util::prefs;
+use util::prefs::mozbrowser_enabled;
#[derive(JSTraceable, PartialEq, Copy, Clone, HeapSizeOf)]
enum XMLHttpRequestState {
@@ -884,7 +884,7 @@ impl XMLHttpRequest {
// story. See https://github.com/servo/servo/issues/9582
if let GlobalRoot::Window(win) = self.global() {
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
} else {
false