Auto merge of #10362 - amarant:10348-string-preferences, r=jdm

Issue #10348 Implement StringMozPreference, string preferences, WPT test

I'm not exactly sure of the wanted semantics with boolean values.

Fixes #10348.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10362)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-04-05 16:06:26 +05:30
commit 17ffc6cf71
4 changed files with 21 additions and 1 deletions

View file

@ -490,6 +490,9 @@ impl TestBindingMethods for TestBinding {
fn BooleanMozPreference(&self, pref_name: DOMString) -> bool {
get_pref(pref_name.as_ref()).as_boolean().unwrap_or(false)
}
fn StringMozPreference(&self, pref_name: DOMString) -> DOMString {
get_pref(pref_name.as_ref()).as_string().map(|s| DOMString::from(s)).unwrap_or_else(|| DOMString::new())
}
}
impl TestBinding {

View file

@ -400,4 +400,5 @@ interface TestBinding {
static attribute boolean booleanAttributeStatic;
static void receiveVoidStatic();
boolean BooleanMozPreference(DOMString pref_name);
DOMString StringMozPreference(DOMString pref_name);
};