diff --git a/components/servo/lib.rs b/components/servo/lib.rs index 1682f0e8c2b..d4c1d4e44d3 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -78,8 +78,6 @@ pub struct Browser { impl Browser { pub fn new(window: Option>) -> Browser where Window: WindowMethods + 'static { - ::util::opts::set_experimental_enabled(opts::get().enable_experimental); - // Global configuration options, parsed from the command line. let opts = opts::get(); diff --git a/components/util/opts.rs b/components/util/opts.rs index c806e19b4a0..3505b33f210 100644 --- a/components/util/opts.rs +++ b/components/util/opts.rs @@ -406,6 +406,9 @@ pub fn from_cmdline_args(args: &[String]) -> bool { static mut EXPERIMENTAL_ENABLED: bool = false; +/// Turn on experimental features globally. Normally this is done +/// during initialization by `set` or `from_cmdline_args`, but +/// tests that require experimental features will also set it. pub fn set_experimental_enabled(new_value: bool) { unsafe { EXPERIMENTAL_ENABLED = new_value; @@ -426,6 +429,7 @@ static mut OPTIONS: *mut Opts = 0 as *mut Opts; pub fn set(opts: Opts) { unsafe { assert!(OPTIONS.is_null()); + set_experimental_enabled(opts.enable_experimental); let box_opts = box opts; OPTIONS = mem::transmute(box_opts); } diff --git a/ports/gonk/src/lib.rs b/ports/gonk/src/lib.rs index 3174c5294ee..0038ee8eeb6 100644 --- a/ports/gonk/src/lib.rs +++ b/ports/gonk/src/lib.rs @@ -78,7 +78,6 @@ impl Browser { #[cfg(not(test))] pub fn new(window: Option>) -> Browser where Window: WindowMethods + 'static { - ::util::opts::set_experimental_enabled(opts::get().enable_experimental); // Global configuration options, parsed from the command line. let opts = opts::get();