mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Enable resetable and String prefs.
This allows both boolean and string-type preferences. It also implements a system where prefs that are read from a configuration file can be reset back to their initial value, which is useful in a number of cases e.g. when running tests to ensure that each test starts with the same values for the prefs.
This commit is contained in:
parent
d811f2d1ba
commit
79e548905e
10 changed files with 174 additions and 33 deletions
|
@ -40,7 +40,7 @@ use util::str::DOMString;
|
|||
use util::str::{self, LengthOrPercentageOrAuto};
|
||||
|
||||
pub fn mozbrowser_enabled() -> bool {
|
||||
prefs::get_pref("dom.mozbrowser.enabled").unwrap_or(false)
|
||||
prefs::get_pref("dom.mozbrowser.enabled").as_boolean().unwrap_or(false)
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf)]
|
||||
|
|
|
@ -171,7 +171,7 @@ impl MouseEventMethods for MouseEvent {
|
|||
// This returns the same result as current gecko.
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/which
|
||||
fn Which(&self) -> i32 {
|
||||
if prefs::get_pref("dom.mouseevent.which.enabled").unwrap_or(false) {
|
||||
if prefs::get_pref("dom.mouseevent.which.enabled").as_boolean().unwrap_or(false) {
|
||||
(self.button.get() + 1) as i32
|
||||
} else {
|
||||
0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue