Skip to content

Commit

Permalink
util: Set the experimental_enabled flag when options are set
Browse files Browse the repository at this point in the history
  • Loading branch information
brson committed May 9, 2015
1 parent f8bbc0a commit df9c132
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 0 additions & 2 deletions components/servo/lib.rs
Expand Up @@ -78,8 +78,6 @@ pub struct Browser {
impl Browser {
pub fn new<Window>(window: Option<Rc<Window>>) -> 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();

Expand Down
4 changes: 4 additions & 0 deletions components/util/opts.rs
Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down
1 change: 0 additions & 1 deletion ports/gonk/src/lib.rs
Expand Up @@ -78,7 +78,6 @@ impl Browser {
#[cfg(not(test))]
pub fn new<Window>(window: Option<Rc<Window>>) -> 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();

Expand Down

0 comments on commit df9c132

Please sign in to comment.