diff options
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/document.rs | 5 | ||||
-rw-r--r-- | components/script/dom/htmliframeelement.rs | 14 | ||||
-rw-r--r-- | components/script/dom/mouseevent.rs | 4 |
3 files changed, 13 insertions, 10 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 3841c0a45cb..b562920f796 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -50,7 +50,7 @@ use dom::htmlcollection::{HTMLCollection, CollectionFilter}; use dom::htmlelement::{HTMLElement, HTMLElementTypeId}; use dom::htmlheadelement::HTMLHeadElement; use dom::htmlhtmlelement::HTMLHtmlElement; -use dom::htmliframeelement::HTMLIFrameElement; +use dom::htmliframeelement::{self, HTMLIFrameElement}; use dom::htmlscriptelement::HTMLScriptElement; use dom::keyboardevent::KeyboardEvent; use dom::location::Location; @@ -79,7 +79,6 @@ use net_traits::CookieSource::NonHTTP; use net_traits::{Metadata, PendingAsyncLoad, AsyncResponseTarget}; use script_task::Runnable; use script_traits::{MouseButton, UntrustedNodeAddress}; -use util::opts; use util::str::{DOMString, split_html_space_chars}; use euclid::point::Point2D; @@ -856,7 +855,7 @@ impl Document { } pub fn trigger_mozbrowser_event(&self, event: MozBrowserEvent) { - if opts::experimental_enabled() { + if htmliframeelement::mozbrowser_enabled() { let window = self.window.root(); if let Some((containing_pipeline_id, subpage_id)) = window.r().parent_info() { diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index 4732037cbe4..eabf16b9cac 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -30,7 +30,7 @@ use msg::constellation_msg::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandbo use msg::constellation_msg::Msg as ConstellationMsg; use msg::constellation_msg::{PipelineId, SubpageId, ConstellationChan, MozBrowserEvent, NavigationDirection}; use string_cache::Atom; -use util::opts; +use util::prefs; use util::str::DOMString; use js::jsapi::{RootedValue, JSAutoRequest, JSAutoCompartment}; @@ -41,6 +41,10 @@ use std::cell::Cell; use url::{Url, UrlParser}; use util::str::{self, LengthOrPercentageOrAuto}; +pub fn mozbrowser_enabled() -> bool { + prefs::get_pref("dom.mozbrowser.enabled", false) +} + #[derive(HeapSizeOf)] enum SandboxAllowance { AllowNothing = 0x00, @@ -117,7 +121,7 @@ impl HTMLIFrameElement { old_subpage_id, sandboxed)).unwrap(); - if opts::experimental_enabled() { + if mozbrowser_enabled() { // https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowserloadstart self.dispatch_mozbrowser_event(MozBrowserEvent::LoadStart); } @@ -136,7 +140,7 @@ impl HTMLIFrameElement { // TODO(gw): Support mozbrowser event types that have detail which is not a string. // See https://developer.mozilla.org/en-US/docs/Web/API/Using_the_Browser_API // for a list of mozbrowser events. - assert!(opts::experimental_enabled()); + assert!(mozbrowser_enabled()); if self.Mozbrowser() { let window = window_from_node(self); @@ -302,7 +306,7 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement { // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-mozbrowser fn Mozbrowser(&self) -> bool { - if opts::experimental_enabled() { + if mozbrowser_enabled() { let element = ElementCast::from_ref(self); element.has_attribute(&Atom::from_slice("mozbrowser")) } else { @@ -312,7 +316,7 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement { // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-mozbrowser fn SetMozbrowser(&self, value: bool) -> ErrorResult { - if opts::experimental_enabled() { + if mozbrowser_enabled() { let element = ElementCast::from_ref(self); element.set_bool_attribute(&Atom::from_slice("mozbrowser"), value); } diff --git a/components/script/dom/mouseevent.rs b/components/script/dom/mouseevent.rs index c3722fa0adf..5fcd232826e 100644 --- a/components/script/dom/mouseevent.rs +++ b/components/script/dom/mouseevent.rs @@ -16,7 +16,7 @@ use dom::uievent::{UIEvent, UIEventTypeId}; use dom::window::Window; use std::cell::Cell; use std::default::Default; -use util::opts; +use util::prefs; use util::str::DOMString; #[dom_struct] @@ -171,7 +171,7 @@ impl MouseEventMethods for MouseEvent { // This returns the same result as current gecko. // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/which fn Which(&self) -> i32 { - if opts::experimental_enabled() { + if prefs::get_pref("dom.mouseevent.which.enabled", false) { (self.button.get() + 1) as i32 } else { 0 |