Bug 734018 - Don't patch DOMRequestService into Services.jsm. r=gavin,fabrice

This commit is contained in:
Philipp von Weitershausen 2012-04-11 13:55:54 +08:00
parent 5c1bf40ab5
commit 269a26647e
3 changed files with 15 additions and 27 deletions

View File

@ -15,10 +15,6 @@ 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);
});
@ -83,6 +79,6 @@ DOMRequestIpcHelper.prototype = {
},
createRequest: function() {
return Services.rs.createRequest(this._window);
return Services.DOMRequest.createRequest(this._window);
}
}

View File

@ -11,10 +11,6 @@ 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);
});
@ -64,27 +60,27 @@ WebappsRegistry.prototype = {
let app = msg.app;
switch (aMessage.name) {
case "Webapps:Install:Return:OK":
Services.rs.fireSuccess(req, new WebappsApplication(this._window, app.origin, app.manifest, app.manifestURL, app.receipts,
Services.DOMRequest.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.rs.fireError(req, "DENIED");
Services.DOMRequest.fireError(req, "DENIED");
break;
case "Webapps:GetSelf:Return:OK":
if (msg.apps.length) {
app = msg.apps[0];
Services.rs.fireSuccess(req, new WebappsApplication(this._window, app.origin, app.manifest, app.manifestURL, app.receipts,
Services.DOMRequest.fireSuccess(req, new WebappsApplication(this._window, app.origin, app.manifest, app.manifestURL, app.receipts,
app.installOrigin, app.installTime));
} else {
Services.rs.fireSuccess(req, null);
Services.DOMRequest.fireSuccess(req, null);
}
break;
case "Webapps:GetInstalled:Return:OK":
Services.rs.fireSuccess(req, convertAppsArray(msg.apps, this._window));
Services.DOMRequest.fireSuccess(req, convertAppsArray(msg.apps, this._window));
break;
case "Webapps:GetSelf:Return:KO":
case "Webapps:GetInstalled:Return:KO":
Services.rs.fireError(req, "ERROR");
Services.DOMRequest.fireError(req, "ERROR");
break;
}
this.removeRequest(msg.requestID);
@ -109,7 +105,7 @@ WebappsRegistry.prototype = {
let installOrigin = this._getOrigin(this._window.location.href);
let manifest = JSON.parse(xhr.responseText, installOrigin);
if (!this.checkManifest(manifest, installOrigin)) {
Services.rs.fireError(request, "INVALID_MANIFEST");
Services.DOMRequest.fireError(request, "INVALID_MANIFEST");
} else {
let receipts = (aParams && aParams.receipts && Array.isArray(aParams.receipts)) ? aParams.receipts : [];
cpmm.sendAsyncMessage("Webapps:Install", { app: { installOrigin: installOrigin,
@ -122,16 +118,16 @@ WebappsRegistry.prototype = {
requestID: requestID });
}
} catch(e) {
Services.rs.fireError(request, "MANIFEST_PARSE_ERROR");
Services.DOMRequest.fireError(request, "MANIFEST_PARSE_ERROR");
}
}
else {
Services.rs.fireError(request, "MANIFEST_URL_ERROR");
Services.DOMRequest.fireError(request, "MANIFEST_URL_ERROR");
}
}).bind(this), false);
xhr.addEventListener("error", (function() {
Services.rs.fireError(request, "NETWORK_ERROR");
Services.DOMRequest.fireError(request, "NETWORK_ERROR");
}).bind(this), false);
xhr.send(null);
@ -257,10 +253,10 @@ WebappsApplication.prototype = {
return;
switch (aMessage.name) {
case "Webapps:Uninstall:Return:OK":
Services.rs.fireSuccess(req, msg.origin);
Services.DOMRequest.fireSuccess(req, msg.origin);
break;
case "Webapps:Uninstall:Return:KO":
Services.rs.fireError(req, msg.origin);
Services.DOMRequest.fireError(req, msg.origin);
break;
}
this.removeRequest(msg.requestID);
@ -346,10 +342,10 @@ WebappsApplicationMgmt.prototype = {
return;
switch (aMessage.name) {
case "Webapps:GetAll:Return:OK":
Services.rs.fireSuccess(req, convertAppsArray(msg.apps, this._window));
Services.DOMRequest.fireSuccess(req, convertAppsArray(msg.apps, this._window));
break;
case "Webapps:GetAll:Return:KO":
Services.rs.fireError(req, "DENIED");
Services.DOMRequest.fireError(req, "DENIED");
break;
case "Webapps:Install:Return:OK":
if (this._oninstall) {

View File

@ -114,10 +114,6 @@ 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}");