2012-02-28 22:01:48 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2012-07-03 18:00:53 +00:00
|
|
|
"use strict";
|
2012-02-28 22:01:48 +00:00
|
|
|
|
2013-07-02 06:14:32 +00:00
|
|
|
const DEBUG = false;
|
2012-08-22 21:34:57 +00:00
|
|
|
function debug(s) { dump("-*- ContactManager: " + s + "\n"); }
|
2012-02-28 22:01:48 +00:00
|
|
|
|
|
|
|
const Cc = Components.classes;
|
|
|
|
const Ci = Components.interfaces;
|
|
|
|
const Cu = Components.utils;
|
|
|
|
|
|
|
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
|
|
|
Cu.import("resource://gre/modules/Services.jsm");
|
2012-03-07 21:45:24 +00:00
|
|
|
Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
|
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
XPCOMUtils.defineLazyServiceGetter(Services, "DOMRequest",
|
|
|
|
"@mozilla.org/dom/dom-request-service;1",
|
|
|
|
"nsIDOMRequestService");
|
|
|
|
|
|
|
|
XPCOMUtils.defineLazyServiceGetter(this, "pm",
|
|
|
|
"@mozilla.org/permissionmanager;1",
|
|
|
|
"nsIPermissionManager");
|
|
|
|
|
2012-08-27 14:13:02 +00:00
|
|
|
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
|
|
|
"@mozilla.org/childprocessmessagemanager;1",
|
|
|
|
"nsIMessageSender");
|
2012-02-28 22:01:48 +00:00
|
|
|
|
2013-03-27 22:24:15 +00:00
|
|
|
const CONTACTS_SENDMORE_MINIMUM = 5;
|
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
function ContactAddressImpl() { }
|
2012-02-28 22:01:48 +00:00
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
ContactAddressImpl.prototype = {
|
2013-10-17 21:29:56 +00:00
|
|
|
// This function is meant to be called via bindings code for type checking,
|
|
|
|
// don't call it directly. Instead, create a content object and call initialize
|
|
|
|
// on that.
|
|
|
|
initialize: function(aType, aStreetAddress, aLocality, aRegion, aPostalCode, aCountryName, aPref) {
|
|
|
|
this.type = aType;
|
|
|
|
this.streetAddress = aStreetAddress;
|
|
|
|
this.locality = aLocality;
|
|
|
|
this.region = aRegion;
|
|
|
|
this.postalCode = aPostalCode;
|
|
|
|
this.countryName = aCountryName;
|
|
|
|
this.pref = aPref;
|
|
|
|
},
|
|
|
|
|
|
|
|
toJSON: function(excludeExposedProps) {
|
|
|
|
let json = {
|
|
|
|
type: this.type,
|
|
|
|
streetAddress: this.streetAddress,
|
|
|
|
locality: this.locality,
|
|
|
|
region: this.region,
|
|
|
|
postalCode: this.postalCode,
|
|
|
|
countryName: this.countryName,
|
|
|
|
pref: this.pref,
|
|
|
|
};
|
|
|
|
if (!excludeExposedProps) {
|
|
|
|
json.__exposedProps__ = {
|
|
|
|
type: "rw",
|
|
|
|
streetAddress: "rw",
|
|
|
|
locality: "rw",
|
|
|
|
region: "rw",
|
|
|
|
postalCode: "rw",
|
|
|
|
countryName: "rw",
|
|
|
|
pref: "rw",
|
|
|
|
};
|
|
|
|
}
|
|
|
|
return json;
|
|
|
|
},
|
2012-07-03 18:00:53 +00:00
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
classID: Components.ID("{9cbfa81c-bcab-4ca9-b0d2-f4318f295e33}"),
|
|
|
|
contractID: "@mozilla.org/contactAddress;1",
|
|
|
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]),
|
2012-07-03 18:00:53 +00:00
|
|
|
};
|
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
function ContactFieldImpl() { }
|
2012-05-11 04:51:48 +00:00
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
ContactFieldImpl.prototype = {
|
2013-10-17 21:29:56 +00:00
|
|
|
// This function is meant to be called via bindings code for type checking,
|
|
|
|
// don't call it directly. Instead, create a content object and call initialize
|
|
|
|
// on that.
|
|
|
|
initialize: function(aType, aValue, aPref) {
|
|
|
|
this.type = aType;
|
|
|
|
this.value = aValue;
|
|
|
|
this.pref = aPref;
|
|
|
|
},
|
|
|
|
|
|
|
|
toJSON: function(excludeExposedProps) {
|
|
|
|
let json = {
|
|
|
|
type: this.type,
|
|
|
|
value: this.value,
|
|
|
|
pref: this.pref,
|
|
|
|
};
|
|
|
|
if (!excludeExposedProps) {
|
|
|
|
json.__exposedProps__ = {
|
|
|
|
type: "rw",
|
|
|
|
value: "rw",
|
|
|
|
pref: "rw",
|
|
|
|
};
|
|
|
|
}
|
|
|
|
return json;
|
|
|
|
},
|
2012-05-11 04:51:48 +00:00
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
classID: Components.ID("{ad19a543-69e4-44f0-adfa-37c011556bc1}"),
|
|
|
|
contractID: "@mozilla.org/contactField;1",
|
|
|
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]),
|
2012-05-11 04:51:48 +00:00
|
|
|
};
|
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
function ContactTelFieldImpl() { }
|
2013-02-03 12:05:51 +00:00
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
ContactTelFieldImpl.prototype = {
|
2013-10-17 21:29:56 +00:00
|
|
|
// This function is meant to be called via bindings code for type checking,
|
|
|
|
// don't call it directly. Instead, create a content object and call initialize
|
|
|
|
// on that.
|
|
|
|
initialize: function(aType, aValue, aCarrier, aPref) {
|
|
|
|
this.type = aType;
|
|
|
|
this.value = aValue;
|
|
|
|
this.carrier = aCarrier;
|
|
|
|
this.pref = aPref;
|
|
|
|
},
|
|
|
|
|
|
|
|
toJSON: function(excludeExposedProps) {
|
|
|
|
let json = {
|
|
|
|
type: this.type,
|
|
|
|
value: this.value,
|
|
|
|
carrier: this.carrier,
|
|
|
|
pref: this.pref,
|
|
|
|
};
|
|
|
|
if (!excludeExposedProps) {
|
|
|
|
json.__exposedProps__ = {
|
|
|
|
type: "rw",
|
|
|
|
value: "rw",
|
|
|
|
carrier: "rw",
|
|
|
|
pref: "rw",
|
|
|
|
};
|
|
|
|
}
|
|
|
|
return json;
|
|
|
|
},
|
2013-02-03 12:05:51 +00:00
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
classID: Components.ID("{4d42c5a9-ea5d-4102-80c3-40cc986367ca}"),
|
|
|
|
contractID: "@mozilla.org/contactTelField;1",
|
|
|
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]),
|
2013-02-03 12:05:51 +00:00
|
|
|
};
|
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
function validateArrayField(data, createCb) {
|
|
|
|
// We use an array-like Proxy to validate data set by content, since we don't
|
|
|
|
// have WebIDL arrays yet. See bug 851726.
|
2012-02-28 22:01:48 +00:00
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
// ArrayPropertyExposedPropsProxy is used to return "rw" for any valid index
|
|
|
|
// and "length" in __exposedProps__.
|
|
|
|
const ArrayPropertyExposedPropsProxy = new Proxy({}, {
|
|
|
|
get: function(target, name) {
|
|
|
|
// Test for index access
|
|
|
|
if (String(name >>> 0) === name) {
|
|
|
|
return "rw";
|
2013-06-04 01:50:31 +00:00
|
|
|
}
|
2013-10-17 21:29:56 +00:00
|
|
|
if (name === "length") {
|
|
|
|
return "r";
|
2013-06-04 01:50:31 +00:00
|
|
|
}
|
|
|
|
}
|
2013-10-17 21:29:56 +00:00
|
|
|
});
|
2013-06-04 01:50:31 +00:00
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
const ArrayPropertyHandler = {
|
|
|
|
set: function(target, name, val, receiver) {
|
|
|
|
// Test for index access
|
|
|
|
if (String(name >>> 0) === name) {
|
|
|
|
target[name] = createCb(val);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
get: function(target, name) {
|
|
|
|
if (name === "__exposedProps__") {
|
|
|
|
return ArrayPropertyExposedPropsProxy;
|
|
|
|
}
|
|
|
|
return target[name];
|
|
|
|
}
|
|
|
|
};
|
2013-06-04 01:50:31 +00:00
|
|
|
|
2013-10-30 23:39:05 +00:00
|
|
|
if (data === null || data === undefined) {
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
data = Array.isArray(data) ? data : [data];
|
|
|
|
let filtered = [];
|
|
|
|
for (let i = 0, n = data.length; i < n; ++i) {
|
|
|
|
if (data[i]) {
|
2013-10-18 12:34:52 +00:00
|
|
|
filtered.push(createCb(data[i]));
|
2013-06-04 01:50:31 +00:00
|
|
|
}
|
|
|
|
}
|
2013-10-30 23:39:05 +00:00
|
|
|
return new Proxy(filtered, ArrayPropertyHandler);
|
2013-06-04 01:50:31 +00:00
|
|
|
}
|
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
// We need this to create a copy of the mozContact object in ContactManager.save
|
|
|
|
// Keep in sync with the interfaces.
|
|
|
|
const PROPERTIES = [
|
|
|
|
"name", "honorificPrefix", "givenName", "additionalName", "familyName",
|
|
|
|
"honorificSuffix", "nickname", "photo", "category", "org", "jobTitle",
|
|
|
|
"bday", "note", "anniversary", "sex", "genderIdentity", "key"
|
|
|
|
];
|
|
|
|
const ADDRESS_PROPERTIES = ["adr"];
|
|
|
|
const FIELD_PROPERTIES = ["email", "url", "impp"];
|
|
|
|
const TELFIELD_PROPERTIES = ["tel"];
|
2012-02-28 22:01:48 +00:00
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
function Contact() { }
|
2013-06-04 01:50:31 +00:00
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
Contact.prototype = {
|
|
|
|
// We need to create the content interfaces in these setters, otherwise when
|
|
|
|
// we return these objects (e.g. from a find call), the values in the array
|
|
|
|
// will be COW's, and content cannot see the properties.
|
2013-06-04 01:50:31 +00:00
|
|
|
set email(aEmail) {
|
2013-10-17 21:29:56 +00:00
|
|
|
this._email = aEmail;
|
2013-06-04 01:50:31 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
get email() {
|
2013-10-17 21:29:56 +00:00
|
|
|
this._email = validateArrayField(this._email, function(email) {
|
|
|
|
let obj = this._window.ContactField._create(this._window, new ContactFieldImpl());
|
|
|
|
obj.initialize(email.type, email.value, email.pref);
|
|
|
|
return obj;
|
|
|
|
}.bind(this));
|
2013-06-04 01:50:31 +00:00
|
|
|
return this._email;
|
|
|
|
},
|
|
|
|
|
|
|
|
set adr(aAdr) {
|
2013-10-17 21:29:56 +00:00
|
|
|
this._adr = aAdr;
|
|
|
|
},
|
|
|
|
|
|
|
|
get adr() {
|
|
|
|
this._adr = validateArrayField(this._adr, function(adr) {
|
|
|
|
let obj = this._window.ContactAddress._create(this._window, new ContactAddressImpl());
|
2013-10-17 21:29:56 +00:00
|
|
|
obj.initialize(adr.type, adr.streetAddress, adr.locality,
|
|
|
|
adr.region, adr.postalCode, adr.countryName,
|
|
|
|
adr.pref);
|
|
|
|
return obj;
|
|
|
|
}.bind(this));
|
2013-06-04 01:50:31 +00:00
|
|
|
return this._adr;
|
|
|
|
},
|
|
|
|
|
|
|
|
set tel(aTel) {
|
2013-10-17 21:29:56 +00:00
|
|
|
this._tel = aTel;
|
2013-06-04 01:50:31 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
get tel() {
|
2013-10-17 21:29:56 +00:00
|
|
|
this._tel = validateArrayField(this._tel, function(tel) {
|
|
|
|
let obj = this._window.ContactTelField._create(this._window, new ContactTelFieldImpl());
|
|
|
|
obj.initialize(tel.type, tel.value, tel.carrier, tel.pref);
|
|
|
|
return obj;
|
|
|
|
}.bind(this));
|
2013-06-04 01:50:31 +00:00
|
|
|
return this._tel;
|
|
|
|
},
|
|
|
|
|
|
|
|
set impp(aImpp) {
|
2013-10-17 21:29:56 +00:00
|
|
|
this._impp = aImpp;
|
2013-06-04 01:50:31 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
get impp() {
|
2013-10-17 21:29:56 +00:00
|
|
|
this._impp = validateArrayField(this._impp, function(impp) {
|
|
|
|
let obj = this._window.ContactField._create(this._window, new ContactFieldImpl());
|
|
|
|
obj.initialize(impp.type, impp.value, impp.pref);
|
|
|
|
return obj;
|
|
|
|
}.bind(this));
|
2013-06-04 01:50:31 +00:00
|
|
|
return this._impp;
|
|
|
|
},
|
|
|
|
|
|
|
|
set url(aUrl) {
|
2013-10-17 21:29:56 +00:00
|
|
|
this._url = aUrl;
|
2013-06-04 01:50:31 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
get url() {
|
2013-10-17 21:29:56 +00:00
|
|
|
this._url = validateArrayField(this._url, function(url) {
|
|
|
|
let obj = this._window.ContactField._create(this._window, new ContactFieldImpl());
|
|
|
|
obj.initialize(url.type, url.value, url.pref);
|
|
|
|
return obj;
|
|
|
|
}.bind(this));
|
2013-06-04 01:50:31 +00:00
|
|
|
return this._url;
|
|
|
|
},
|
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
init: function(aWindow) {
|
|
|
|
this._window = aWindow;
|
2013-06-14 17:15:57 +00:00
|
|
|
},
|
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
__init: function(aProp) {
|
2013-06-04 01:50:31 +00:00
|
|
|
this.name = aProp.name;
|
|
|
|
this.honorificPrefix = aProp.honorificPrefix;
|
|
|
|
this.givenName = aProp.givenName;
|
|
|
|
this.additionalName = aProp.additionalName;
|
|
|
|
this.familyName = aProp.familyName;
|
|
|
|
this.honorificSuffix = aProp.honorificSuffix;
|
|
|
|
this.nickname = aProp.nickname;
|
|
|
|
this.email = aProp.email;
|
|
|
|
this.photo = aProp.photo;
|
|
|
|
this.url = aProp.url;
|
|
|
|
this.category = aProp.category;
|
|
|
|
this.adr = aProp.adr;
|
|
|
|
this.tel = aProp.tel;
|
|
|
|
this.org = aProp.org;
|
|
|
|
this.jobTitle = aProp.jobTitle;
|
|
|
|
this.bday = aProp.bday;
|
|
|
|
this.note = aProp.note;
|
|
|
|
this.impp = aProp.impp;
|
|
|
|
this.anniversary = aProp.anniversary;
|
|
|
|
this.sex = aProp.sex;
|
|
|
|
this.genderIdentity = aProp.genderIdentity;
|
2013-06-14 17:15:57 +00:00
|
|
|
this.key = aProp.key;
|
2012-02-28 22:01:48 +00:00
|
|
|
},
|
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
setMetadata: function(aId, aPublished, aUpdated) {
|
|
|
|
this.id = aId;
|
|
|
|
if (aPublished) {
|
|
|
|
this.published = aPublished;
|
|
|
|
}
|
|
|
|
if (aUpdated) {
|
|
|
|
this.updated = aUpdated;
|
|
|
|
}
|
2012-02-28 22:01:48 +00:00
|
|
|
},
|
2012-05-11 04:51:48 +00:00
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
toJSON: function() {
|
|
|
|
return {
|
|
|
|
id: this.id,
|
|
|
|
published: this.published,
|
|
|
|
updated: this.updated,
|
|
|
|
|
|
|
|
name: this.name,
|
|
|
|
honorificPrefix: this.honorificPrefix,
|
|
|
|
givenName: this.givenName,
|
|
|
|
additionalName: this.additionalName,
|
|
|
|
familyName: this.familyName,
|
|
|
|
honorificSuffix: this.honorificSuffix,
|
|
|
|
nickname: this.nickname,
|
|
|
|
category: this.category,
|
|
|
|
org: this.org,
|
|
|
|
jobTitle: this.jobTitle,
|
|
|
|
note: this.note,
|
|
|
|
sex: this.sex,
|
|
|
|
genderIdentity: this.genderIdentity,
|
|
|
|
email: this.email,
|
|
|
|
photo: this.photo,
|
|
|
|
adr: this.adr,
|
|
|
|
url: this.url,
|
|
|
|
tel: this.tel,
|
|
|
|
bday: this.bday,
|
|
|
|
impp: this.impp,
|
|
|
|
anniversary: this.anniversary,
|
|
|
|
key: this.key,
|
|
|
|
|
|
|
|
__exposedProps__: {
|
|
|
|
id: "rw",
|
|
|
|
published: "rw",
|
|
|
|
updated: "rw",
|
|
|
|
name: "rw",
|
|
|
|
honorificPrefix: "rw",
|
|
|
|
givenName: "rw",
|
|
|
|
additionalName: "rw",
|
|
|
|
familyName: "rw",
|
|
|
|
honorificSuffix: "rw",
|
|
|
|
nickname: "rw",
|
|
|
|
category: "rw",
|
|
|
|
org: "rw",
|
|
|
|
jobTitle: "rw",
|
|
|
|
note: "rw",
|
|
|
|
sex: "rw",
|
|
|
|
genderIdentity: "rw",
|
|
|
|
email: "rw",
|
|
|
|
photo: "rw",
|
|
|
|
adr: "rw",
|
|
|
|
url: "rw",
|
|
|
|
tel: "rw",
|
|
|
|
bday: "rw",
|
|
|
|
impp: "rw",
|
|
|
|
anniversary: "rw",
|
|
|
|
key: "rw",
|
|
|
|
}
|
|
|
|
};
|
2012-02-28 22:01:48 +00:00
|
|
|
},
|
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
classID: Components.ID("{72a5ee28-81d8-4af8-90b3-ae935396cc66}"),
|
|
|
|
contractID: "@mozilla.org/contact;1",
|
|
|
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports,
|
|
|
|
Ci.nsIDOMGlobalPropertyInitializer]),
|
|
|
|
};
|
2012-02-28 22:01:48 +00:00
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
function ContactManager() { }
|
2012-02-28 22:01:48 +00:00
|
|
|
|
|
|
|
ContactManager.prototype = {
|
2012-03-07 21:45:24 +00:00
|
|
|
__proto__: DOMRequestIpcHelper.prototype,
|
2013-10-17 21:29:56 +00:00
|
|
|
hasListenPermission: false,
|
2013-07-18 22:01:00 +00:00
|
|
|
_cachedContacts: [] ,
|
2012-05-08 18:42:41 +00:00
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
set oncontactchange(aHandler) {
|
|
|
|
this.__DOM_IMPL__.setEventHandler("oncontactchange", aHandler);
|
2012-05-08 18:42:41 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
get oncontactchange() {
|
2013-10-17 21:29:56 +00:00
|
|
|
return this.__DOM_IMPL__.getEventHandler("oncontactchange");
|
2012-02-28 22:01:48 +00:00
|
|
|
},
|
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
_convertContact: function(aContact) {
|
|
|
|
let newContact = new this._window.mozContact(aContact.properties);
|
|
|
|
newContact.setMetadata(aContact.id, aContact.published, aContact.updated);
|
2013-02-03 12:05:51 +00:00
|
|
|
return newContact;
|
|
|
|
},
|
|
|
|
|
|
|
|
_convertContacts: function(aContacts) {
|
|
|
|
let contacts = [];
|
2012-02-28 22:01:48 +00:00
|
|
|
for (let i in aContacts) {
|
2013-02-03 12:05:51 +00:00
|
|
|
contacts.push(this._convertContact(aContacts[i]));
|
2012-02-28 22:01:48 +00:00
|
|
|
}
|
|
|
|
return contacts;
|
|
|
|
},
|
|
|
|
|
2013-02-25 03:53:55 +00:00
|
|
|
_fireSuccessOrDone: function(aCursor, aResult) {
|
|
|
|
if (aResult == null) {
|
|
|
|
Services.DOMRequest.fireDone(aCursor);
|
|
|
|
} else {
|
|
|
|
Services.DOMRequest.fireSuccess(aCursor, aResult);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2013-02-23 11:41:41 +00:00
|
|
|
_pushArray: function(aArr1, aArr2) {
|
|
|
|
aArr1.push.apply(aArr1, aArr2);
|
|
|
|
},
|
|
|
|
|
2012-02-28 22:01:48 +00:00
|
|
|
receiveMessage: function(aMessage) {
|
2013-02-03 12:05:51 +00:00
|
|
|
if (DEBUG) debug("receiveMessage: " + aMessage.name);
|
2012-02-28 22:01:48 +00:00
|
|
|
let msg = aMessage.json;
|
|
|
|
let contacts = msg.contacts;
|
|
|
|
|
2012-08-31 13:54:48 +00:00
|
|
|
let req;
|
2012-02-28 22:01:48 +00:00
|
|
|
switch (aMessage.name) {
|
|
|
|
case "Contacts:Find:Return:OK":
|
2012-08-31 13:54:48 +00:00
|
|
|
req = this.getRequest(msg.requestID);
|
2012-02-28 22:01:48 +00:00
|
|
|
if (req) {
|
2013-02-03 12:05:51 +00:00
|
|
|
let result = this._convertContacts(contacts);
|
2012-05-08 18:42:41 +00:00
|
|
|
Services.DOMRequest.fireSuccess(req.request, result);
|
2012-02-28 22:01:48 +00:00
|
|
|
} else {
|
2012-08-22 21:34:57 +00:00
|
|
|
if (DEBUG) debug("no request stored!" + msg.requestID);
|
2012-02-28 22:01:48 +00:00
|
|
|
}
|
|
|
|
break;
|
2013-02-03 12:05:51 +00:00
|
|
|
case "Contacts:GetAll:Next":
|
2013-04-18 17:44:38 +00:00
|
|
|
let data = this.getRequest(msg.cursorId);
|
|
|
|
if (!data) {
|
|
|
|
break;
|
|
|
|
}
|
2013-02-23 11:41:41 +00:00
|
|
|
let result = contacts ? this._convertContacts(contacts) : [null];
|
2013-02-25 03:53:55 +00:00
|
|
|
if (data.waitingForNext) {
|
|
|
|
if (DEBUG) debug("cursor waiting for contact, sending");
|
|
|
|
data.waitingForNext = false;
|
2013-02-23 11:41:41 +00:00
|
|
|
let contact = result.shift();
|
|
|
|
this._pushArray(data.cachedContacts, result);
|
2013-03-16 03:40:03 +00:00
|
|
|
this.nextTick(this._fireSuccessOrDone.bind(this, data.cursor, contact));
|
2013-05-03 16:15:55 +00:00
|
|
|
if (!contact) {
|
|
|
|
this.removeRequest(msg.cursorId);
|
|
|
|
}
|
2013-02-03 12:05:51 +00:00
|
|
|
} else {
|
2013-02-25 03:53:55 +00:00
|
|
|
if (DEBUG) debug("cursor not waiting, saving");
|
2013-02-23 11:41:41 +00:00
|
|
|
this._pushArray(data.cachedContacts, result);
|
2013-02-03 12:05:51 +00:00
|
|
|
}
|
|
|
|
break;
|
2012-02-28 22:01:48 +00:00
|
|
|
case "Contact:Save:Return:OK":
|
2013-07-18 22:01:00 +00:00
|
|
|
// If a cached contact was saved and a new contact ID was returned, update the contact's ID
|
|
|
|
if (this._cachedContacts[msg.requestID]) {
|
|
|
|
if (msg.contactID) {
|
|
|
|
this._cachedContacts[msg.requestID].id = msg.contactID;
|
|
|
|
}
|
|
|
|
delete this._cachedContacts[msg.requestID];
|
|
|
|
}
|
2012-02-28 22:01:48 +00:00
|
|
|
case "Contacts:Clear:Return:OK":
|
|
|
|
case "Contact:Remove:Return:OK":
|
|
|
|
req = this.getRequest(msg.requestID);
|
|
|
|
if (req)
|
2012-05-08 18:42:41 +00:00
|
|
|
Services.DOMRequest.fireSuccess(req.request, null);
|
2012-02-28 22:01:48 +00:00
|
|
|
break;
|
|
|
|
case "Contacts:Find:Return:KO":
|
|
|
|
case "Contact:Save:Return:KO":
|
|
|
|
case "Contact:Remove:Return:KO":
|
|
|
|
case "Contacts:Clear:Return:KO":
|
2013-07-15 17:16:33 +00:00
|
|
|
case "Contacts:GetRevision:Return:KO":
|
|
|
|
case "Contacts:Count:Return:KO":
|
2012-02-28 22:01:48 +00:00
|
|
|
req = this.getRequest(msg.requestID);
|
2013-07-18 22:01:00 +00:00
|
|
|
if (req) {
|
|
|
|
if (req.request) {
|
|
|
|
req = req.request;
|
|
|
|
}
|
|
|
|
Services.DOMRequest.fireError(req, msg.errorMsg);
|
|
|
|
}
|
2012-02-28 22:01:48 +00:00
|
|
|
break;
|
2013-08-22 19:05:01 +00:00
|
|
|
case "Contacts:GetAll:Return:KO":
|
|
|
|
req = this.getRequest(msg.requestID);
|
|
|
|
if (req) {
|
|
|
|
Services.DOMRequest.fireError(req.cursor, msg.errorMsg);
|
|
|
|
}
|
|
|
|
break;
|
2012-08-09 18:34:57 +00:00
|
|
|
case "PermissionPromptHelper:AskPermission:OK":
|
2012-08-22 21:34:57 +00:00
|
|
|
if (DEBUG) debug("id: " + msg.requestID);
|
2012-08-09 18:34:57 +00:00
|
|
|
req = this.getRequest(msg.requestID);
|
|
|
|
if (!req) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (msg.result == Ci.nsIPermissionManager.ALLOW_ACTION) {
|
|
|
|
req.allow();
|
|
|
|
} else {
|
|
|
|
req.cancel();
|
|
|
|
}
|
|
|
|
break;
|
2013-02-01 20:44:55 +00:00
|
|
|
case "Contact:Changed":
|
|
|
|
// Fire oncontactchange event
|
|
|
|
if (DEBUG) debug("Contacts:ContactChanged: " + msg.contactID + ", " + msg.reason);
|
2013-10-17 21:29:56 +00:00
|
|
|
let event = new this._window.MozContactChangeEvent("contactchange", {
|
|
|
|
contactID: msg.contactID,
|
|
|
|
reason: msg.reason
|
|
|
|
});
|
|
|
|
this.dispatchEvent(event);
|
2013-02-01 20:44:55 +00:00
|
|
|
break;
|
2013-04-25 17:15:47 +00:00
|
|
|
case "Contacts:Revision":
|
|
|
|
if (DEBUG) debug("new revision: " + msg.revision);
|
|
|
|
req = this.getRequest(msg.requestID);
|
|
|
|
if (req) {
|
2013-08-22 19:05:01 +00:00
|
|
|
Services.DOMRequest.fireSuccess(req.request, msg.revision);
|
2013-04-25 17:15:47 +00:00
|
|
|
}
|
|
|
|
break;
|
2013-06-04 03:45:10 +00:00
|
|
|
case "Contacts:Count":
|
|
|
|
if (DEBUG) debug("count: " + msg.count);
|
|
|
|
req = this.getRequest(msg.requestID);
|
|
|
|
if (req) {
|
2013-08-22 19:05:01 +00:00
|
|
|
Services.DOMRequest.fireSuccess(req.request, msg.count);
|
2013-06-04 03:45:10 +00:00
|
|
|
}
|
|
|
|
break;
|
2013-02-01 20:44:55 +00:00
|
|
|
default:
|
2012-08-22 21:34:57 +00:00
|
|
|
if (DEBUG) debug("Wrong message: " + aMessage.name);
|
2012-02-28 22:01:48 +00:00
|
|
|
}
|
|
|
|
this.removeRequest(msg.requestID);
|
|
|
|
},
|
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
dispatchEvent: function(event) {
|
|
|
|
if (this.hasListenPermission) {
|
|
|
|
this.__DOM_IMPL__.dispatchEvent(event);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2012-10-13 18:57:59 +00:00
|
|
|
askPermission: function (aAccess, aRequest, aAllowCallback, aCancelCallback) {
|
2012-08-22 21:34:57 +00:00
|
|
|
if (DEBUG) debug("askPermission for contacts");
|
2012-11-01 00:26:05 +00:00
|
|
|
let access;
|
|
|
|
switch(aAccess) {
|
|
|
|
case "create":
|
|
|
|
access = "create";
|
|
|
|
break;
|
|
|
|
case "update":
|
|
|
|
case "remove":
|
|
|
|
access = "write";
|
|
|
|
break;
|
|
|
|
case "find":
|
|
|
|
case "listen":
|
2013-04-25 17:15:47 +00:00
|
|
|
case "revision":
|
2013-06-04 03:45:10 +00:00
|
|
|
case "count":
|
2012-11-01 00:26:05 +00:00
|
|
|
access = "read";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
access = "unknown";
|
|
|
|
}
|
2013-02-03 12:05:51 +00:00
|
|
|
|
2013-04-17 11:51:51 +00:00
|
|
|
// Shortcut for ALLOW_ACTION so we avoid a parent roundtrip
|
|
|
|
let type = "contacts-" + access;
|
|
|
|
let permValue =
|
2013-09-30 20:04:37 +00:00
|
|
|
Services.perms.testExactPermissionFromPrincipal(this._window.document.nodePrincipal, type);
|
2013-04-17 11:51:51 +00:00
|
|
|
if (permValue == Ci.nsIPermissionManager.ALLOW_ACTION) {
|
|
|
|
aAllowCallback();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-08-09 18:34:57 +00:00
|
|
|
let requestID = this.getRequestId({
|
2012-10-13 18:57:59 +00:00
|
|
|
request: aRequest,
|
2012-08-09 18:34:57 +00:00
|
|
|
allow: function() {
|
|
|
|
aAllowCallback();
|
|
|
|
}.bind(this),
|
|
|
|
cancel : function() {
|
|
|
|
if (aCancelCallback) {
|
|
|
|
aCancelCallback()
|
2012-10-13 18:57:59 +00:00
|
|
|
} else if (aRequest) {
|
|
|
|
Services.DOMRequest.fireError(aRequest, "Not Allowed");
|
2012-08-09 18:34:57 +00:00
|
|
|
}
|
|
|
|
}.bind(this)
|
|
|
|
});
|
|
|
|
|
|
|
|
let principal = this._window.document.nodePrincipal;
|
|
|
|
cpmm.sendAsyncMessage("PermissionPromptHelper:AskPermission", {
|
|
|
|
type: "contacts",
|
2012-11-01 00:26:05 +00:00
|
|
|
access: access,
|
2012-08-09 18:34:57 +00:00
|
|
|
requestID: requestID,
|
|
|
|
origin: principal.origin,
|
|
|
|
appID: principal.appId,
|
2013-07-10 19:47:18 +00:00
|
|
|
browserFlag: principal.isInBrowserElement,
|
|
|
|
windowID: this._window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).outerWindowID
|
2012-08-09 18:34:57 +00:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
save: function save(aContact) {
|
2013-10-17 21:29:56 +00:00
|
|
|
// We have to do a deep copy of the contact manually here because
|
|
|
|
// nsFrameMessageManager doesn't know how to create a structured clone of a
|
|
|
|
// mozContact object.
|
|
|
|
let newContact = {properties: {}};
|
|
|
|
|
|
|
|
for (let field of PROPERTIES) {
|
|
|
|
if (aContact[field]) {
|
|
|
|
newContact.properties[field] = aContact[field];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (let prop of ADDRESS_PROPERTIES) {
|
|
|
|
if (aContact[prop]) {
|
|
|
|
newContact.properties[prop] = [];
|
|
|
|
for (let i of aContact[prop]) {
|
|
|
|
if (i) {
|
2013-10-17 21:29:56 +00:00
|
|
|
let json = ContactAddressImpl.prototype.toJSON.apply(i, [true]);
|
2013-10-17 21:29:56 +00:00
|
|
|
newContact.properties[prop].push(json);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-08-09 18:34:57 +00:00
|
|
|
}
|
2013-10-17 21:29:56 +00:00
|
|
|
|
|
|
|
for (let prop of FIELD_PROPERTIES) {
|
|
|
|
if (aContact[prop]) {
|
|
|
|
newContact.properties[prop] = [];
|
|
|
|
for (let i of aContact[prop]) {
|
|
|
|
if (i) {
|
2013-10-17 21:29:56 +00:00
|
|
|
let json = ContactFieldImpl.prototype.toJSON.apply(i, [true]);
|
2013-10-17 21:29:56 +00:00
|
|
|
newContact.properties[prop].push(json);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (let prop of TELFIELD_PROPERTIES) {
|
|
|
|
if (aContact[prop]) {
|
|
|
|
newContact.properties[prop] = [];
|
|
|
|
for (let i of aContact[prop]) {
|
|
|
|
if (i) {
|
2013-10-17 21:29:56 +00:00
|
|
|
let json = ContactTelFieldImpl.prototype.toJSON.apply(i, [true]);
|
2013-10-17 21:29:56 +00:00
|
|
|
newContact.properties[prop].push(json);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-18 22:01:00 +00:00
|
|
|
let request = this.createRequest();
|
|
|
|
let requestID = this.getRequestId({request: request, reason: reason});
|
2012-08-09 18:34:57 +00:00
|
|
|
|
|
|
|
let reason;
|
|
|
|
if (aContact.id == "undefined") {
|
|
|
|
// for example {25c00f01-90e5-c545-b4d4-21E2ddbab9e0} becomes
|
|
|
|
// 25c00f0190e5c545b4d421E2ddbab9e0
|
2013-10-17 21:29:56 +00:00
|
|
|
aContact.id = this._getRandomId().replace(/[{}-]/g, "");
|
2013-07-18 22:01:00 +00:00
|
|
|
// Cache the contact so that its ID may be updated later if necessary
|
|
|
|
this._cachedContacts[requestID] = aContact;
|
2012-08-09 18:34:57 +00:00
|
|
|
reason = "create";
|
2012-02-28 22:01:48 +00:00
|
|
|
} else {
|
2012-08-09 18:34:57 +00:00
|
|
|
reason = "update";
|
2012-02-28 22:01:48 +00:00
|
|
|
}
|
2012-08-09 18:34:57 +00:00
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
newContact.id = aContact.id;
|
|
|
|
newContact.published = aContact.published;
|
|
|
|
newContact.updated = aContact.updated;
|
|
|
|
|
2012-08-22 21:34:57 +00:00
|
|
|
if (DEBUG) debug("send: " + JSON.stringify(newContact));
|
2013-10-17 21:29:56 +00:00
|
|
|
|
2012-11-01 00:26:05 +00:00
|
|
|
let options = { contact: newContact, reason: reason };
|
2012-08-09 18:34:57 +00:00
|
|
|
let allowCallback = function() {
|
2013-07-18 22:01:00 +00:00
|
|
|
cpmm.sendAsyncMessage("Contact:Save", {requestID: requestID, options: options});
|
2012-08-09 18:34:57 +00:00
|
|
|
}.bind(this)
|
|
|
|
this.askPermission(reason, request, allowCallback);
|
|
|
|
return request;
|
|
|
|
},
|
|
|
|
|
|
|
|
find: function(aOptions) {
|
2012-08-22 21:34:57 +00:00
|
|
|
if (DEBUG) debug("find! " + JSON.stringify(aOptions));
|
2013-02-03 12:05:51 +00:00
|
|
|
let request = this.createRequest();
|
2012-08-09 18:34:57 +00:00
|
|
|
let options = { findOptions: aOptions };
|
|
|
|
let allowCallback = function() {
|
|
|
|
cpmm.sendAsyncMessage("Contacts:Find", {requestID: this.getRequestId({request: request, reason: "find"}), options: options});
|
|
|
|
}.bind(this)
|
|
|
|
this.askPermission("find", request, allowCallback);
|
|
|
|
return request;
|
|
|
|
},
|
|
|
|
|
2013-02-03 12:05:51 +00:00
|
|
|
createCursor: function CM_createCursor(aRequest) {
|
2013-02-25 03:53:55 +00:00
|
|
|
let data = {
|
|
|
|
cursor: Services.DOMRequest.createCursor(this._window, function() {
|
|
|
|
this.handleContinue(id);
|
|
|
|
}.bind(this)),
|
|
|
|
cachedContacts: [],
|
|
|
|
waitingForNext: true,
|
|
|
|
};
|
2013-04-18 17:44:38 +00:00
|
|
|
let id = this.getRequestId(data);
|
2013-02-03 12:05:51 +00:00
|
|
|
if (DEBUG) debug("saved cursor id: " + id);
|
2013-02-25 03:53:55 +00:00
|
|
|
return [id, data.cursor];
|
2013-02-03 12:05:51 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
getAll: function CM_getAll(aOptions) {
|
|
|
|
if (DEBUG) debug("getAll: " + JSON.stringify(aOptions));
|
|
|
|
let [cursorId, cursor] = this.createCursor();
|
|
|
|
let allowCallback = function() {
|
|
|
|
cpmm.sendAsyncMessage("Contacts:GetAll", {
|
|
|
|
cursorId: cursorId, findOptions: aOptions});
|
|
|
|
}.bind(this);
|
|
|
|
this.askPermission("find", cursor, allowCallback);
|
|
|
|
return cursor;
|
|
|
|
},
|
|
|
|
|
2013-03-16 03:40:03 +00:00
|
|
|
nextTick: function nextTick(aCallback) {
|
|
|
|
Services.tm.currentThread.dispatch(aCallback, Ci.nsIThread.DISPATCH_NORMAL);
|
|
|
|
},
|
|
|
|
|
2013-02-03 12:05:51 +00:00
|
|
|
handleContinue: function CM_handleContinue(aCursorId) {
|
|
|
|
if (DEBUG) debug("handleContinue: " + aCursorId);
|
2013-04-18 17:44:38 +00:00
|
|
|
let data = this.getRequest(aCursorId);
|
2013-02-25 03:53:55 +00:00
|
|
|
if (data.cachedContacts.length > 0) {
|
|
|
|
if (DEBUG) debug("contact in cache");
|
2013-02-23 11:41:41 +00:00
|
|
|
let contact = data.cachedContacts.shift();
|
2013-03-16 03:40:03 +00:00
|
|
|
this.nextTick(this._fireSuccessOrDone.bind(this, data.cursor, contact));
|
2013-05-03 16:15:55 +00:00
|
|
|
if (!contact) {
|
|
|
|
this.removeRequest(aCursorId);
|
|
|
|
} else if (data.cachedContacts.length === CONTACTS_SENDMORE_MINIMUM) {
|
2013-03-27 22:24:15 +00:00
|
|
|
cpmm.sendAsyncMessage("Contacts:GetAll:SendNow", { cursorId: aCursorId });
|
|
|
|
}
|
2013-02-25 03:53:55 +00:00
|
|
|
} else {
|
|
|
|
if (DEBUG) debug("waiting for contact");
|
|
|
|
data.waitingForNext = true;
|
|
|
|
}
|
2013-02-03 12:05:51 +00:00
|
|
|
},
|
|
|
|
|
2012-08-09 18:34:57 +00:00
|
|
|
remove: function removeContact(aRecord) {
|
2013-08-22 19:05:01 +00:00
|
|
|
let request = this.createRequest();
|
|
|
|
if (!aRecord || !aRecord.id) {
|
|
|
|
Services.DOMRequest.fireErrorAsync(request, true);
|
|
|
|
return request;
|
|
|
|
}
|
|
|
|
|
2012-08-09 18:34:57 +00:00
|
|
|
let options = { id: aRecord.id };
|
|
|
|
let allowCallback = function() {
|
|
|
|
cpmm.sendAsyncMessage("Contact:Remove", {requestID: this.getRequestId({request: request, reason: "remove"}), options: options});
|
2013-10-17 21:29:56 +00:00
|
|
|
}.bind(this);
|
2012-08-09 18:34:57 +00:00
|
|
|
this.askPermission("remove", request, allowCallback);
|
|
|
|
return request;
|
2012-02-28 22:01:48 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
clear: function() {
|
2012-08-22 21:34:57 +00:00
|
|
|
if (DEBUG) debug("clear");
|
2013-10-17 21:29:56 +00:00
|
|
|
let request = this.createRequest();
|
2012-08-09 18:34:57 +00:00
|
|
|
let options = {};
|
|
|
|
let allowCallback = function() {
|
|
|
|
cpmm.sendAsyncMessage("Contacts:Clear", {requestID: this.getRequestId({request: request, reason: "remove"}), options: options});
|
2013-10-17 21:29:56 +00:00
|
|
|
}.bind(this);
|
2012-08-09 18:34:57 +00:00
|
|
|
this.askPermission("remove", request, allowCallback);
|
|
|
|
return request;
|
2012-02-28 22:01:48 +00:00
|
|
|
},
|
|
|
|
|
2013-04-25 17:15:47 +00:00
|
|
|
getRevision: function() {
|
|
|
|
let request = this.createRequest();
|
|
|
|
|
|
|
|
let allowCallback = function() {
|
|
|
|
cpmm.sendAsyncMessage("Contacts:GetRevision", {
|
2013-08-22 19:05:01 +00:00
|
|
|
requestID: this.getRequestId({ request: request })
|
2013-04-25 17:15:47 +00:00
|
|
|
});
|
|
|
|
}.bind(this);
|
|
|
|
|
|
|
|
let cancelCallback = function() {
|
|
|
|
Services.DOMRequest.fireError(request);
|
|
|
|
};
|
|
|
|
|
|
|
|
this.askPermission("revision", request, allowCallback, cancelCallback);
|
|
|
|
return request;
|
|
|
|
},
|
|
|
|
|
2013-06-04 03:45:10 +00:00
|
|
|
getCount: function() {
|
|
|
|
let request = this.createRequest();
|
|
|
|
|
|
|
|
let allowCallback = function() {
|
|
|
|
cpmm.sendAsyncMessage("Contacts:GetCount", {
|
2013-08-22 19:05:01 +00:00
|
|
|
requestID: this.getRequestId({ request: request })
|
2013-06-04 03:45:10 +00:00
|
|
|
});
|
|
|
|
}.bind(this);
|
|
|
|
|
|
|
|
let cancelCallback = function() {
|
|
|
|
Services.DOMRequest.fireError(request);
|
|
|
|
};
|
|
|
|
|
|
|
|
this.askPermission("count", request, allowCallback, cancelCallback);
|
|
|
|
return request;
|
|
|
|
},
|
|
|
|
|
2012-02-28 22:01:48 +00:00
|
|
|
init: function(aWindow) {
|
2013-10-17 21:29:56 +00:00
|
|
|
// DOMRequestIpcHelper.initHelper sets this._window
|
2013-07-08 21:55:42 +00:00
|
|
|
this.initDOMRequestHelper(aWindow, ["Contacts:Find:Return:OK", "Contacts:Find:Return:KO",
|
2012-05-11 04:51:48 +00:00
|
|
|
"Contacts:Clear:Return:OK", "Contacts:Clear:Return:KO",
|
|
|
|
"Contact:Save:Return:OK", "Contact:Save:Return:KO",
|
2012-08-09 18:34:57 +00:00
|
|
|
"Contact:Remove:Return:OK", "Contact:Remove:Return:KO",
|
2013-02-01 20:44:55 +00:00
|
|
|
"Contact:Changed",
|
2013-02-03 12:05:51 +00:00
|
|
|
"PermissionPromptHelper:AskPermission:OK",
|
2013-08-22 19:05:01 +00:00
|
|
|
"Contacts:GetAll:Next", "Contacts:GetAll:Return:KO",
|
|
|
|
"Contacts:Count",
|
2013-07-18 22:01:00 +00:00
|
|
|
"Contacts:Revision", "Contacts:GetRevision:Return:KO",]);
|
2012-02-28 22:01:48 +00:00
|
|
|
|
2012-05-08 18:42:41 +00:00
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
let allowCallback = function() {
|
|
|
|
cpmm.sendAsyncMessage("Contacts:RegisterForMessages");
|
|
|
|
this.hasListenPermission = true;
|
|
|
|
}.bind(this);
|
2012-02-28 22:01:48 +00:00
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
this.askPermission("listen", null, allowCallback);
|
|
|
|
},
|
|
|
|
|
|
|
|
classID: Components.ID("{8beb3a66-d70a-4111-b216-b8e995ad3aff}"),
|
|
|
|
contractID: "@mozilla.org/contactManager;1",
|
|
|
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference,
|
2013-11-20 05:33:10 +00:00
|
|
|
Ci.nsIObserver,
|
2013-10-17 21:29:56 +00:00
|
|
|
Ci.nsIDOMGlobalPropertyInitializer]),
|
|
|
|
};
|
2012-02-28 22:01:48 +00:00
|
|
|
|
2013-10-17 21:29:56 +00:00
|
|
|
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([
|
2013-10-17 21:29:56 +00:00
|
|
|
Contact, ContactManager, ContactFieldImpl, ContactAddressImpl, ContactTelFieldImpl
|
2013-10-17 21:29:56 +00:00
|
|
|
]);
|