From df9c132551075fc2cbc9c4194fe190eeb0921c63 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Sat, 9 May 2015 02:22:59 -0700 Subject: [PATCH] util: Set the experimental_enabled flag when options are set --- components/servo/lib.rs | 2 -- components/util/opts.rs | 4 ++++ ports/gonk/src/lib.rs | 1 - 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/components/servo/lib.rs b/components/servo/lib.rs index 1682f0e8c2ba..d4c1d4e44d37 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 c806e19b4a06..3505b33f2108 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 3174c5294ee6..0038ee8eeb61 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();