mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
util: Set the experimental_enabled flag when options are set
This commit is contained in:
parent
f8bbc0a974
commit
df9c132551
3 changed files with 4 additions and 3 deletions
|
@ -78,8 +78,6 @@ pub struct Browser {
|
||||||
impl Browser {
|
impl Browser {
|
||||||
pub fn new<Window>(window: Option<Rc<Window>>) -> Browser
|
pub fn new<Window>(window: Option<Rc<Window>>) -> Browser
|
||||||
where Window: WindowMethods + 'static {
|
where Window: WindowMethods + 'static {
|
||||||
::util::opts::set_experimental_enabled(opts::get().enable_experimental);
|
|
||||||
|
|
||||||
// Global configuration options, parsed from the command line.
|
// Global configuration options, parsed from the command line.
|
||||||
let opts = opts::get();
|
let opts = opts::get();
|
||||||
|
|
||||||
|
|
|
@ -406,6 +406,9 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
|
||||||
|
|
||||||
static mut EXPERIMENTAL_ENABLED: bool = false;
|
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) {
|
pub fn set_experimental_enabled(new_value: bool) {
|
||||||
unsafe {
|
unsafe {
|
||||||
EXPERIMENTAL_ENABLED = new_value;
|
EXPERIMENTAL_ENABLED = new_value;
|
||||||
|
@ -426,6 +429,7 @@ static mut OPTIONS: *mut Opts = 0 as *mut Opts;
|
||||||
pub fn set(opts: Opts) {
|
pub fn set(opts: Opts) {
|
||||||
unsafe {
|
unsafe {
|
||||||
assert!(OPTIONS.is_null());
|
assert!(OPTIONS.is_null());
|
||||||
|
set_experimental_enabled(opts.enable_experimental);
|
||||||
let box_opts = box opts;
|
let box_opts = box opts;
|
||||||
OPTIONS = mem::transmute(box_opts);
|
OPTIONS = mem::transmute(box_opts);
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,6 @@ impl Browser {
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
pub fn new<Window>(window: Option<Rc<Window>>) -> Browser
|
pub fn new<Window>(window: Option<Rc<Window>>) -> Browser
|
||||||
where Window: WindowMethods + 'static {
|
where Window: WindowMethods + 'static {
|
||||||
::util::opts::set_experimental_enabled(opts::get().enable_experimental);
|
|
||||||
// Global configuration options, parsed from the command line.
|
// Global configuration options, parsed from the command line.
|
||||||
let opts = opts::get();
|
let opts = opts::get();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue