mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-27 19:09:47 +00:00
Bug 935804 - Handle null and undefined correctly in mozContact field properties. r=bz
This commit is contained in:
parent
3013273d77
commit
d186425182
@ -1009,19 +1009,21 @@ var steps = [
|
||||
next();
|
||||
},
|
||||
function() {
|
||||
ok(true, "Undefined strings should be treated as null");
|
||||
ok(true, "Undefined properties of fields should be treated correctly");
|
||||
var c = new mozContact({
|
||||
adr: [{value: undefined}],
|
||||
adr: [{streetAddress: undefined}],
|
||||
email: [{value: undefined}],
|
||||
url: [{value: undefined}],
|
||||
impp: [{value: undefined}],
|
||||
tel: [{value: undefined}],
|
||||
});
|
||||
is(c.adr[0].type, null, "adr is null");
|
||||
is(c.email[0].type, null, "email is null");
|
||||
is(c.url[0].type, null, "url is null");
|
||||
is(c.impp[0].type, null, "impp is null");
|
||||
is(c.tel[0].type, null, "tel is null");
|
||||
ise(c.adr[0].streetAddress, null, "adr.streetAddress is null");
|
||||
ise(c.adr[0].locality, null, "adr.locality is null");
|
||||
ise(c.adr[0].pref, null, "adr.pref is null");
|
||||
ise(c.email[0].value, null, "email.value is null");
|
||||
ise(c.url[0].value, null, "url.value is null");
|
||||
ise(c.impp[0].value, null, "impp.value is null");
|
||||
ise(c.tel[0].value, null, "tel.value is null");
|
||||
next();
|
||||
},
|
||||
function() {
|
||||
|
@ -7,21 +7,21 @@
|
||||
[ChromeOnly, Constructor, JSImplementation="@mozilla.org/contactAddress;1"]
|
||||
interface ContactAddress {
|
||||
attribute object? type; // DOMString[]
|
||||
[TreatUndefinedAs=Null] attribute DOMString? streetAddress;
|
||||
[TreatUndefinedAs=Null] attribute DOMString? locality;
|
||||
[TreatUndefinedAs=Null] attribute DOMString? region;
|
||||
[TreatUndefinedAs=Null] attribute DOMString? postalCode;
|
||||
[TreatUndefinedAs=Null] attribute DOMString? countryName;
|
||||
attribute DOMString? streetAddress;
|
||||
attribute DOMString? locality;
|
||||
attribute DOMString? region;
|
||||
attribute DOMString? postalCode;
|
||||
attribute DOMString? countryName;
|
||||
attribute boolean? pref;
|
||||
|
||||
[ChromeOnly]
|
||||
void initialize(optional sequence<DOMString>? type,
|
||||
optional DOMString streetAddress,
|
||||
optional DOMString locality,
|
||||
optional DOMString region,
|
||||
optional DOMString postalCode,
|
||||
optional DOMString countryName,
|
||||
optional boolean pref);
|
||||
optional DOMString? streetAddress,
|
||||
optional DOMString? locality,
|
||||
optional DOMString? region,
|
||||
optional DOMString? postalCode,
|
||||
optional DOMString? countryName,
|
||||
optional boolean? pref);
|
||||
|
||||
object toJSON();
|
||||
};
|
||||
@ -40,13 +40,13 @@ dictionary ContactAddressInit {
|
||||
[ChromeOnly, Constructor, JSImplementation="@mozilla.org/contactField;1"]
|
||||
interface ContactField {
|
||||
attribute object? type; // DOMString[]
|
||||
[TreatUndefinedAs=Null] attribute DOMString? value;
|
||||
attribute DOMString? value;
|
||||
attribute boolean? pref;
|
||||
|
||||
[ChromeOnly]
|
||||
void initialize(optional sequence<DOMString>? type,
|
||||
optional DOMString value,
|
||||
optional boolean pref);
|
||||
optional DOMString? value,
|
||||
optional boolean? pref);
|
||||
|
||||
object toJSON();
|
||||
};
|
||||
@ -60,13 +60,13 @@ dictionary ContactFieldInit {
|
||||
|
||||
[ChromeOnly, Constructor, JSImplementation="@mozilla.org/contactTelField;1"]
|
||||
interface ContactTelField : ContactField {
|
||||
[TreatUndefinedAs=Null] attribute DOMString? carrier;
|
||||
attribute DOMString? carrier;
|
||||
|
||||
[ChromeOnly]
|
||||
void initialize(optional sequence<DOMString>? type,
|
||||
optional DOMString value,
|
||||
optional DOMString? value,
|
||||
optional DOMString? carrier,
|
||||
optional boolean pref);
|
||||
optional boolean? pref);
|
||||
|
||||
object toJSON();
|
||||
};
|
||||
@ -117,8 +117,8 @@ interface mozContact {
|
||||
attribute Date? bday;
|
||||
attribute Date? anniversary;
|
||||
|
||||
[TreatUndefinedAs=Null] attribute DOMString? sex;
|
||||
[TreatUndefinedAs=Null] attribute DOMString? genderIdentity;
|
||||
attribute DOMString? sex;
|
||||
attribute DOMString? genderIdentity;
|
||||
|
||||
attribute object? photo;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user