From 37bcdda882a64a4b14585cb55c650b42ea46066e Mon Sep 17 00:00:00 2001 From: Reuben Morais Date: Fri, 1 Nov 2013 14:01:59 -0200 Subject: [PATCH] Bug 930241 - Use toJSON instead of jsonifier in the Contacts interfaces. r=gwagner --HG-- extra : rebase_source : b19099dec587b7acc3a86e71928423b46b958e0e --- dom/contacts/tests/test_contacts_basics.html | 6 ++++++ dom/webidl/Contacts.webidl | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/dom/contacts/tests/test_contacts_basics.html b/dom/contacts/tests/test_contacts_basics.html index 2aea2e340a5b..5a00d062cda2 100644 --- a/dom/contacts/tests/test_contacts_basics.html +++ b/dom/contacts/tests/test_contacts_basics.html @@ -1054,6 +1054,12 @@ var steps = [ }; req.onerror = onFailure; }, + function() { + ok(true, "Test JSON.stringify output for mozContact objects"); + var json = JSON.parse(JSON.stringify(new mozContact(properties1))); + checkContacts(json, properties1); + next(); + }, function () { ok(true, "all done!\n"); clearTemps(); diff --git a/dom/webidl/Contacts.webidl b/dom/webidl/Contacts.webidl index f236e9ccff92..33c42dfd4f0f 100644 --- a/dom/webidl/Contacts.webidl +++ b/dom/webidl/Contacts.webidl @@ -22,6 +22,8 @@ interface ContactAddress { optional DOMString postalCode, optional DOMString countryName, optional boolean pref); + + object toJSON(); }; dictionary ContactAddressInit { @@ -45,6 +47,8 @@ interface ContactField { void initialize(optional sequence? type, optional DOMString value, optional boolean pref); + + object toJSON(); }; dictionary ContactFieldInit { @@ -63,6 +67,8 @@ interface ContactTelField : ContactField { optional DOMString value, optional DOMString? carrier, optional boolean pref); + + object toJSON(); }; dictionary ContactTelFieldInit : ContactFieldInit { @@ -140,7 +146,7 @@ interface mozContact { [ChromeOnly] void setMetadata(DOMString id, Date? published, Date? updated); - jsonifier; + object toJSON(); }; dictionary ContactFindSortOptions {