#8539 Config preferences backend restructure

This commit is contained in:
Peter Hall 2019-02-14 12:53:59 +00:00
parent 34fda66dfa
commit 8bfd4dc1e2
53 changed files with 1748 additions and 680 deletions

View file

@ -57,7 +57,7 @@ use js::rust::CustomAutoRooterGuard;
use js::rust::{HandleObject, HandleValue};
use js::typedarray;
use script_traits::MsDuration;
use servo_config::prefs::PREFS;
use servo_config::prefs;
use std::borrow::ToOwned;
use std::ptr;
use std::ptr::NonNull;
@ -887,12 +887,15 @@ impl TestBindingMethods for TestBinding {
#[allow(unsafe_code)]
unsafe fn PassVariadicObject(&self, _: *mut JSContext, _: Vec<*mut JSObject>) {}
fn BooleanMozPreference(&self, pref_name: DOMString) -> bool {
PREFS.get(pref_name.as_ref()).as_boolean().unwrap_or(false)
prefs::pref_map()
.get(pref_name.as_ref())
.as_bool()
.unwrap_or(false)
}
fn StringMozPreference(&self, pref_name: DOMString) -> DOMString {
PREFS
prefs::pref_map()
.get(pref_name.as_ref())
.as_string()
.as_str()
.map(|s| DOMString::from(s))
.unwrap_or_else(|| DOMString::new())
}