mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Back out changeset 26adf71d5c61 (bug 734018) due to oranges.
This commit is contained in:
parent
89af98f875
commit
67ee95d3b8
@ -15,6 +15,14 @@ let EXPORTED_SYMBOLS = ["DOMRequestIpcHelper"];
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(Services, "rs", function() {
|
||||
return Cc["@mozilla.org/dom/dom-request-service;1"].getService(Ci.nsIDOMRequestService);
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "cpmm", function() {
|
||||
return Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
});
|
||||
|
||||
function DOMRequestIpcHelper() {
|
||||
}
|
||||
|
||||
@ -54,7 +62,7 @@ DOMRequestIpcHelper.prototype = {
|
||||
this._requests = [];
|
||||
this._window = null;
|
||||
this._messages.forEach((function(msgName) {
|
||||
Services.cpmm.removeMessageListener(msgName, this);
|
||||
cpmm.removeMessageListener(msgName, this);
|
||||
}).bind(this));
|
||||
if(this.uninit)
|
||||
this.uninit();
|
||||
@ -70,11 +78,11 @@ DOMRequestIpcHelper.prototype = {
|
||||
this._id = this._getRandomId();
|
||||
Services.obs.addObserver(this, "inner-window-destroyed", false);
|
||||
this._messages.forEach((function(msgName) {
|
||||
Services.cpmm.addMessageListener(msgName, this);
|
||||
cpmm.addMessageListener(msgName, this);
|
||||
}).bind(this));
|
||||
},
|
||||
|
||||
createRequest: function() {
|
||||
return Services.DOMRequest.createRequest(this._window);
|
||||
return Services.rs.createRequest(this._window);
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,14 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(Services, "rs", function() {
|
||||
return Cc["@mozilla.org/dom/dom-request-service;1"].getService(Ci.nsIDOMRequestService);
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "cpmm", function() {
|
||||
return Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
});
|
||||
|
||||
function convertAppsArray(aApps, aWindow) {
|
||||
let apps = new Array();
|
||||
for (let i = 0; i < aApps.length; i++) {
|
||||
@ -56,27 +64,27 @@ WebappsRegistry.prototype = {
|
||||
let app = msg.app;
|
||||
switch (aMessage.name) {
|
||||
case "Webapps:Install:Return:OK":
|
||||
Services.DOMRequest.fireSuccess(req, new WebappsApplication(this._window, app.origin, app.manifest, app.manifestURL, app.receipts,
|
||||
Services.rs.fireSuccess(req, new WebappsApplication(this._window, app.origin, app.manifest, app.manifestURL, app.receipts,
|
||||
app.installOrigin, app.installTime));
|
||||
break;
|
||||
case "Webapps:Install:Return:KO":
|
||||
Services.DOMRequest.fireError(req, "DENIED");
|
||||
Services.rs.fireError(req, "DENIED");
|
||||
break;
|
||||
case "Webapps:GetSelf:Return:OK":
|
||||
if (msg.apps.length) {
|
||||
app = msg.apps[0];
|
||||
Services.DOMRequest.fireSuccess(req, new WebappsApplication(this._window, app.origin, app.manifest, app.manifestURL, app.receipts,
|
||||
Services.rs.fireSuccess(req, new WebappsApplication(this._window, app.origin, app.manifest, app.manifestURL, app.receipts,
|
||||
app.installOrigin, app.installTime));
|
||||
} else {
|
||||
Services.DOMRequest.fireSuccess(req, null);
|
||||
Services.rs.fireSuccess(req, null);
|
||||
}
|
||||
break;
|
||||
case "Webapps:GetInstalled:Return:OK":
|
||||
Services.DOMRequest.fireSuccess(req, convertAppsArray(msg.apps, this._window));
|
||||
Services.rs.fireSuccess(req, convertAppsArray(msg.apps, this._window));
|
||||
break;
|
||||
case "Webapps:GetSelf:Return:KO":
|
||||
case "Webapps:GetInstalled:Return:KO":
|
||||
Services.DOMRequest.fireError(req, "ERROR");
|
||||
Services.rs.fireError(req, "ERROR");
|
||||
break;
|
||||
}
|
||||
this.removeRequest(msg.requestID);
|
||||
@ -101,10 +109,10 @@ WebappsRegistry.prototype = {
|
||||
let installOrigin = this._getOrigin(this._window.location.href);
|
||||
let manifest = JSON.parse(xhr.responseText, installOrigin);
|
||||
if (!this.checkManifest(manifest, installOrigin)) {
|
||||
Services.DOMRequest.fireError(request, "INVALID_MANIFEST");
|
||||
Services.rs.fireError(request, "INVALID_MANIFEST");
|
||||
} else {
|
||||
let receipts = (aParams && aParams.receipts && Array.isArray(aParams.receipts)) ? aParams.receipts : [];
|
||||
Services.cpmm.sendAsyncMessage("Webapps:Install", { app: { installOrigin: installOrigin,
|
||||
cpmm.sendAsyncMessage("Webapps:Install", { app: { installOrigin: installOrigin,
|
||||
origin: this._getOrigin(aURL),
|
||||
manifestURL: aURL,
|
||||
manifest: manifest,
|
||||
@ -114,16 +122,16 @@ WebappsRegistry.prototype = {
|
||||
requestID: requestID });
|
||||
}
|
||||
} catch(e) {
|
||||
Services.DOMRequest.fireError(request, "MANIFEST_PARSE_ERROR");
|
||||
Services.rs.fireError(request, "MANIFEST_PARSE_ERROR");
|
||||
}
|
||||
}
|
||||
else {
|
||||
Services.DOMRequest.fireError(request, "MANIFEST_URL_ERROR");
|
||||
Services.rs.fireError(request, "MANIFEST_URL_ERROR");
|
||||
}
|
||||
}).bind(this), false);
|
||||
|
||||
xhr.addEventListener("error", (function() {
|
||||
Services.DOMRequest.fireError(request, "NETWORK_ERROR");
|
||||
Services.rs.fireError(request, "NETWORK_ERROR");
|
||||
}).bind(this), false);
|
||||
|
||||
xhr.send(null);
|
||||
@ -132,7 +140,7 @@ WebappsRegistry.prototype = {
|
||||
|
||||
getSelf: function() {
|
||||
let request = this.createRequest();
|
||||
Services.cpmm.sendAsyncMessage("Webapps:GetSelf", { origin: this._getOrigin(this._window.location.href),
|
||||
cpmm.sendAsyncMessage("Webapps:GetSelf", { origin: this._getOrigin(this._window.location.href),
|
||||
oid: this._id,
|
||||
requestID: this.getRequestId(request) });
|
||||
return request;
|
||||
@ -140,7 +148,7 @@ WebappsRegistry.prototype = {
|
||||
|
||||
getInstalled: function() {
|
||||
let request = this.createRequest();
|
||||
Services.cpmm.sendAsyncMessage("Webapps:GetInstalled", { origin: this._getOrigin(this._window.location.href),
|
||||
cpmm.sendAsyncMessage("Webapps:GetInstalled", { origin: this._getOrigin(this._window.location.href),
|
||||
oid: this._id,
|
||||
requestID: this.getRequestId(request) });
|
||||
return request;
|
||||
@ -227,7 +235,7 @@ WebappsApplication.prototype = {
|
||||
|
||||
launch: function(aStartPoint) {
|
||||
let request = this.createRequest();
|
||||
Services.cpmm.sendAsyncMessage("Webapps:Launch", { origin: this._origin,
|
||||
cpmm.sendAsyncMessage("Webapps:Launch", { origin: this._origin,
|
||||
startPoint: aStartPoint,
|
||||
oid: this._id,
|
||||
requestID: this.getRequestId(request) });
|
||||
@ -236,7 +244,7 @@ WebappsApplication.prototype = {
|
||||
|
||||
uninstall: function() {
|
||||
let request = this.createRequest();
|
||||
Services.cpmm.sendAsyncMessage("Webapps:Uninstall", { origin: this._origin,
|
||||
cpmm.sendAsyncMessage("Webapps:Uninstall", { origin: this._origin,
|
||||
oid: this._id,
|
||||
requestID: this.getRequestId(request) });
|
||||
return request;
|
||||
@ -249,10 +257,10 @@ WebappsApplication.prototype = {
|
||||
return;
|
||||
switch (aMessage.name) {
|
||||
case "Webapps:Uninstall:Return:OK":
|
||||
Services.DOMRequest.fireSuccess(req, msg.origin);
|
||||
Services.rs.fireSuccess(req, msg.origin);
|
||||
break;
|
||||
case "Webapps:Uninstall:Return:KO":
|
||||
Services.DOMRequest.fireError(req, msg.origin);
|
||||
Services.rs.fireError(req, msg.origin);
|
||||
break;
|
||||
}
|
||||
this.removeRequest(msg.requestID);
|
||||
@ -300,7 +308,7 @@ WebappsApplicationMgmt.prototype = {
|
||||
|
||||
getAll: function() {
|
||||
let request = this.createRequest();
|
||||
Services.cpmm.sendAsyncMessage("Webapps:GetAll", { oid: this._id,
|
||||
cpmm.sendAsyncMessage("Webapps:GetAll", { oid: this._id,
|
||||
requestID: this.getRequestId(request),
|
||||
hasPrivileges: this.hasPrivileges });
|
||||
return request;
|
||||
@ -338,10 +346,10 @@ WebappsApplicationMgmt.prototype = {
|
||||
return;
|
||||
switch (aMessage.name) {
|
||||
case "Webapps:GetAll:Return:OK":
|
||||
Services.DOMRequest.fireSuccess(req, convertAppsArray(msg.apps, this._window));
|
||||
Services.rs.fireSuccess(req, convertAppsArray(msg.apps, this._window));
|
||||
break;
|
||||
case "Webapps:GetAll:Return:KO":
|
||||
Services.DOMRequest.fireError(req, "DENIED");
|
||||
Services.rs.fireError(req, "DENIED");
|
||||
break;
|
||||
case "Webapps:Install:Return:OK":
|
||||
if (this._oninstall) {
|
||||
|
@ -17,6 +17,10 @@ XPCOMUtils.defineLazyGetter(this, "NetUtil", function() {
|
||||
return NetUtil;
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "ppmm", function() {
|
||||
return Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
});
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
const DIRECTORY_NAME = "webappsDir";
|
||||
#else
|
||||
@ -33,7 +37,7 @@ let DOMApplicationRegistry = {
|
||||
"Webapps:Launch", "Webapps:GetAll"];
|
||||
|
||||
this.messages.forEach((function(msgName) {
|
||||
Services.ppmm.addMessageListener(msgName, this);
|
||||
ppmm.addMessageListener(msgName, this);
|
||||
}).bind(this));
|
||||
|
||||
Services.obs.addObserver(this, "xpcom-shutdown", false);
|
||||
@ -58,9 +62,10 @@ let DOMApplicationRegistry = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
if (aTopic == "xpcom-shutdown") {
|
||||
this.messages.forEach((function(msgName) {
|
||||
Services.ppmm.removeMessageListener(msgName, this);
|
||||
ppmm.removeMessageListener(msgName, this);
|
||||
}).bind(this));
|
||||
Services.obs.removeObserver(this, "xpcom-shutdown");
|
||||
ppmm = null;
|
||||
}
|
||||
},
|
||||
|
||||
@ -120,7 +125,7 @@ let DOMApplicationRegistry = {
|
||||
if (msg.hasPrivileges)
|
||||
this.getAll(msg);
|
||||
else
|
||||
Services.ppmm.sendAsyncMessage("Webapps:GetAll:Return:KO", msg);
|
||||
ppmm.sendAsyncMessage("Webapps:GetAll:Return:KO", msg);
|
||||
break;
|
||||
}
|
||||
},
|
||||
@ -154,7 +159,7 @@ let DOMApplicationRegistry = {
|
||||
},
|
||||
|
||||
denyInstall: function(aData) {
|
||||
Services.ppmm.sendAsyncMessage("Webapps:Install:Return:KO", aData);
|
||||
ppmm.sendAsyncMessage("Webapps:Install:Return:KO", aData);
|
||||
},
|
||||
|
||||
confirmInstall: function(aData, aFromSync) {
|
||||
@ -187,7 +192,7 @@ let DOMApplicationRegistry = {
|
||||
|
||||
if (!aFromSync)
|
||||
this._saveApps((function() {
|
||||
Services.ppmm.sendAsyncMessage("Webapps:Install:Return:OK", aData);
|
||||
ppmm.sendAsyncMessage("Webapps:Install:Return:OK", aData);
|
||||
Services.obs.notifyObservers(this, "webapps-sync-install", id);
|
||||
}).bind(this));
|
||||
},
|
||||
@ -241,13 +246,13 @@ let DOMApplicationRegistry = {
|
||||
} catch (e) {
|
||||
}
|
||||
this._saveApps((function() {
|
||||
Services.ppmm.sendAsyncMessage("Webapps:Uninstall:Return:OK", aData);
|
||||
ppmm.sendAsyncMessage("Webapps:Uninstall:Return:OK", aData);
|
||||
Services.obs.notifyObservers(this, "webapps-sync-uninstall", id);
|
||||
}).bind(this));
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
Services.ppmm.sendAsyncMessage("Webapps:Uninstall:Return:KO", aData);
|
||||
ppmm.sendAsyncMessage("Webapps:Uninstall:Return:KO", aData);
|
||||
},
|
||||
|
||||
getSelf: function(aData) {
|
||||
@ -264,7 +269,7 @@ let DOMApplicationRegistry = {
|
||||
this._readManifests(tmp, (function(aResult) {
|
||||
for (let i = 0; i < aResult.length; i++)
|
||||
aData.apps[i].manifest = aResult[i].manifest;
|
||||
Services.ppmm.sendAsyncMessage("Webapps:GetSelf:Return:OK", aData);
|
||||
ppmm.sendAsyncMessage("Webapps:GetSelf:Return:OK", aData);
|
||||
}).bind(this));
|
||||
},
|
||||
|
||||
@ -283,7 +288,7 @@ let DOMApplicationRegistry = {
|
||||
this._readManifests(tmp, (function(aResult) {
|
||||
for (let i = 0; i < aResult.length; i++)
|
||||
aData.apps[i].manifest = aResult[i].manifest;
|
||||
Services.ppmm.sendAsyncMessage("Webapps:GetInstalled:Return:OK", aData);
|
||||
ppmm.sendAsyncMessage("Webapps:GetInstalled:Return:OK", aData);
|
||||
}).bind(this));
|
||||
},
|
||||
|
||||
@ -300,7 +305,7 @@ let DOMApplicationRegistry = {
|
||||
this._readManifests(tmp, (function(aResult) {
|
||||
for (let i = 0; i < aResult.length; i++)
|
||||
aData.apps[i].manifest = aResult[i].manifest;
|
||||
Services.ppmm.sendAsyncMessage("Webapps:GetAll:Return:OK", aData);
|
||||
ppmm.sendAsyncMessage("Webapps:GetAll:Return:OK", aData);
|
||||
}).bind(this));
|
||||
},
|
||||
|
||||
@ -346,7 +351,7 @@ let DOMApplicationRegistry = {
|
||||
dir.remove(true);
|
||||
} catch (e) {
|
||||
}
|
||||
Services.ppmm.sendAsyncMessage("Webapps:Uninstall:Return:OK", { origin: origin });
|
||||
ppmm.sendAsyncMessage("Webapps:Uninstall:Return:OK", { origin: origin });
|
||||
} else {
|
||||
if (!!this.webapps[record.id]) {
|
||||
this.webapps[record.id] = record.value;
|
||||
@ -355,7 +360,7 @@ let DOMApplicationRegistry = {
|
||||
else {
|
||||
let data = { app: record.value };
|
||||
this.confirmInstall(data, true);
|
||||
Services.ppmm.sendAsyncMessage("Webapps:Install:Return:OK", data);
|
||||
ppmm.sendAsyncMessage("Webapps:Install:Return:OK", data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,14 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(Services, "DOMRequest", function() {
|
||||
return Cc["@mozilla.org/dom/dom-request-service;1"].getService(Ci.nsIDOMRequestService);
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "cpmm", function() {
|
||||
return Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
});
|
||||
|
||||
const nsIClassInfo = Ci.nsIClassInfo;
|
||||
const CONTACTPROPERTIES_CID = Components.ID("{53ed7c20-ceda-11e0-9572-0800200c9a66}");
|
||||
const nsIDOMContactProperties = Ci.nsIDOMContactProperties;
|
||||
@ -217,8 +225,7 @@ ContactManager.prototype = {
|
||||
this._setMetaData(newContact, aContact);
|
||||
debug("send: " + JSON.stringify(newContact));
|
||||
request = this.createRequest();
|
||||
Services.cpmm.sendAsyncMessage("Contact:Save",
|
||||
{contact: newContact,
|
||||
cpmm.sendAsyncMessage("Contact:Save", {contact: newContact,
|
||||
requestID: this.getRequestId(request)});
|
||||
return request;
|
||||
} else {
|
||||
@ -230,8 +237,7 @@ ContactManager.prototype = {
|
||||
let request;
|
||||
if (this.hasPrivileges) {
|
||||
request = this.createRequest();
|
||||
Services.cpmm.sendAsyncMessage("Contact:Remove",
|
||||
{id: aRecord.id,
|
||||
cpmm.sendAsyncMessage("Contact:Remove", {id: aRecord.id,
|
||||
requestID: this.getRequestId(request)});
|
||||
return request;
|
||||
} else {
|
||||
@ -297,8 +303,7 @@ ContactManager.prototype = {
|
||||
let request;
|
||||
if (this.hasPrivileges) {
|
||||
request = this.createRequest();
|
||||
Services.cpmm.sendAsyncMessage("Contacts:Find",
|
||||
{findOptions: aOptions,
|
||||
cpmm.sendAsyncMessage("Contacts:Find", {findOptions: aOptions,
|
||||
requestID: this.getRequestId(request)});
|
||||
return request;
|
||||
} else {
|
||||
@ -311,8 +316,7 @@ ContactManager.prototype = {
|
||||
let request;
|
||||
if (this.hasPrivileges) {
|
||||
request = this.createRequest();
|
||||
Services.cpmm.sendAsyncMessage("Contacts:Clear",
|
||||
{requestID: this.getRequestId(request)});
|
||||
cpmm.sendAsyncMessage("Contacts:Clear", {requestID: this.getRequestId(request)});
|
||||
return request;
|
||||
} else {
|
||||
debug("clear not allowed");
|
||||
|
@ -16,9 +16,14 @@ const Ci = Components.interfaces;
|
||||
|
||||
let EXPORTED_SYMBOLS = ["DOMContactManager"];
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/ContactDB.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "ppmm", function() {
|
||||
return Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
});
|
||||
|
||||
let myGlobal = this;
|
||||
|
||||
let DOMContactManager = {
|
||||
@ -26,7 +31,7 @@ let DOMContactManager = {
|
||||
debug("Init");
|
||||
this._messages = ["Contacts:Find", "Contacts:Clear", "Contact:Save", "Contact:Remove"];
|
||||
this._messages.forEach((function(msgName) {
|
||||
Services.ppmm.addMessageListener(msgName, this);
|
||||
ppmm.addMessageListener(msgName, this);
|
||||
}).bind(this));
|
||||
|
||||
var idbManager = Components.classes["@mozilla.org/dom/indexeddb/manager;1"].getService(Ci.nsIIndexedDatabaseManager);
|
||||
@ -49,9 +54,10 @@ let DOMContactManager = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
myGlobal = null;
|
||||
this._messages.forEach((function(msgName) {
|
||||
Services.ppmm.removeMessageListener(msgName, this);
|
||||
ppmm.removeMessageListener(msgName, this);
|
||||
}).bind(this));
|
||||
Services.obs.removeObserver(this, "profile-before-change");
|
||||
ppmm = null;
|
||||
this._messages = null;
|
||||
if (this._db)
|
||||
this._db.close();
|
||||
@ -85,23 +91,23 @@ let DOMContactManager = {
|
||||
}
|
||||
|
||||
debug("result:" + JSON.stringify(result));
|
||||
Services.ppmm.sendAsyncMessage("Contacts:Find:Return:OK", {requestID: msg.requestID, contacts: result});
|
||||
ppmm.sendAsyncMessage("Contacts:Find:Return:OK", {requestID: msg.requestID, contacts: result});
|
||||
}.bind(this),
|
||||
function(aErrorMsg) { Services.ppmm.sendAsyncMessage("Contacts:Find:Return:KO", { requestID: msg.requestID, errorMsg: aErrorMsg }) }.bind(this),
|
||||
function(aErrorMsg) { ppmm.sendAsyncMessage("Contacts:Find:Return:KO", { requestID: msg.requestID, errorMsg: aErrorMsg }) }.bind(this),
|
||||
msg.findOptions);
|
||||
break;
|
||||
case "Contact:Save":
|
||||
this._db.saveContact(msg.contact, function() { Services.ppmm.sendAsyncMessage("Contact:Save:Return:OK", { requestID: msg.requestID }); }.bind(this),
|
||||
function(aErrorMsg) { Services.ppmm.sendAsyncMessage("Contact:Save:Return:KO", { requestID: msg.requestID, errorMsg: aErrorMsg }); }.bind(this));
|
||||
this._db.saveContact(msg.contact, function() { ppmm.sendAsyncMessage("Contact:Save:Return:OK", { requestID: msg.requestID }); }.bind(this),
|
||||
function(aErrorMsg) { ppmm.sendAsyncMessage("Contact:Save:Return:KO", { requestID: msg.requestID, errorMsg: aErrorMsg }); }.bind(this));
|
||||
break;
|
||||
case "Contact:Remove":
|
||||
this._db.removeContact(msg.id,
|
||||
function() { Services.ppmm.sendAsyncMessage("Contact:Remove:Return:OK", { requestID: msg.requestID }); }.bind(this),
|
||||
function(aErrorMsg) { Services.ppmm.sendAsyncMessage("Contact:Remove:Return:KO", { requestID: msg.requestID, errorMsg: aErrorMsg }); }.bind(this));
|
||||
function() { ppmm.sendAsyncMessage("Contact:Remove:Return:OK", { requestID: msg.requestID }); }.bind(this),
|
||||
function(aErrorMsg) { ppmm.sendAsyncMessage("Contact:Remove:Return:KO", { requestID: msg.requestID, errorMsg: aErrorMsg }); }.bind(this));
|
||||
break;
|
||||
case "Contacts:Clear":
|
||||
this._db.clear(function() { Services.ppmm.sendAsyncMessage("Contacts:Clear:Return:OK", { requestID: msg.requestID }); }.bind(this),
|
||||
function(aErrorMsg) { Services.ppmm.sendAsyncMessage("Contacts:Clear:Return:KO", { requestID: msg.requestID, errorMsg: aErrorMsg }); }.bind(this));
|
||||
this._db.clear(function() { ppmm.sendAsyncMessage("Contacts:Clear:Return:OK", { requestID: msg.requestID }); }.bind(this),
|
||||
function(aErrorMsg) { ppmm.sendAsyncMessage("Contacts:Clear:Return:KO", { requestID: msg.requestID, errorMsg: aErrorMsg }); }.bind(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -114,6 +114,10 @@ const Cu = Components.utils;
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(Services, "DOMRequest", function() {
|
||||
return Cc["@mozilla.org/dom/dom-request-service;1"].getService(Ci.nsIDOMRequestService);
|
||||
});
|
||||
|
||||
const nsIClassInfo = Ci.nsIClassInfo;
|
||||
const SETTINGSLOCK_CONTRACTID = "@mozilla.org/settingsLock;1";
|
||||
const SETTINGSLOCK_CID = Components.ID("{ef95ddd0-6308-11e1-b86c-0800200c9a66}");
|
||||
|
@ -93,9 +93,7 @@ let initTable = [
|
||||
["startup", "@mozilla.org/toolkit/app-startup;1", "nsIAppStartup"],
|
||||
["sysinfo", "@mozilla.org/system-info;1", "nsIPropertyBag2"],
|
||||
["clipboard", "@mozilla.org/widget/clipboard;1", "nsIClipboard"],
|
||||
["DOMRequest", "@mozilla.org/dom/dom-request-service;1", "nsIDOMRequestService"],
|
||||
["cpmm", "@mozilla.org/childprocessmessagemanager;1", "nsIFrameMessageManager"],
|
||||
["ppmm", "@mozilla.org/parentprocessmessagemanager;1", "nsIFrameMessageManager"],
|
||||
["DOMRequest", "@mozilla.org/dom/dom-request-service;1", "nsIDOMRequestService"]
|
||||
];
|
||||
|
||||
initTable.forEach(function ([name, contract, intf])
|
||||
|
Loading…
Reference in New Issue
Block a user