зеркало из https://github.com/mozilla/gecko-dev.git
Bug 441636 - Store and retrieve DBus handler apps correctly r=biesi
This commit is contained in:
Родитель
2529daf9db
Коммит
4ab5f71126
|
@ -96,6 +96,17 @@ const NC_PATH = NC_NS + "path";
|
||||||
// nsIWebHandlerApp::uriTemplate
|
// nsIWebHandlerApp::uriTemplate
|
||||||
const NC_URI_TEMPLATE = NC_NS + "uriTemplate";
|
const NC_URI_TEMPLATE = NC_NS + "uriTemplate";
|
||||||
|
|
||||||
|
// nsIDBusHandlerApp::service
|
||||||
|
const NC_SERVICE = NC_NS + "service";
|
||||||
|
|
||||||
|
// nsIDBusHandlerApp::method
|
||||||
|
const NC_METHOD = NC_NS + "method";
|
||||||
|
|
||||||
|
// nsIDBusHandlerApp::objectPath
|
||||||
|
const NC_OBJPATH = NC_NS + "objectPath";
|
||||||
|
|
||||||
|
// nsIDBusHandlerApp::dbusInterface
|
||||||
|
const NC_INTERFACE = NC_NS + "dBusInterface";
|
||||||
|
|
||||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
|
|
||||||
|
@ -566,6 +577,31 @@ HandlerService.prototype = {
|
||||||
createInstance(Ci.nsIWebHandlerApp);
|
createInstance(Ci.nsIWebHandlerApp);
|
||||||
handlerApp.uriTemplate = uriTemplate;
|
handlerApp.uriTemplate = uriTemplate;
|
||||||
}
|
}
|
||||||
|
else if (this._hasValue(aHandlerAppID, NC_SERVICE)) {
|
||||||
|
let service = this._getValue(aHandlerAppID, NC_SERVICE);
|
||||||
|
if (!service)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
let method = this._getValue(aHandlerAppID, NC_METHOD);
|
||||||
|
if (!method)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
let objpath = this._getValue(aHandlerAppID, NC_OBJPATH);
|
||||||
|
if (!objpath)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
let interface = this._getValue(aHandlerAppID, NC_INTERFACE);
|
||||||
|
if (!interface)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
handlerApp = Cc["@mozilla.org/uriloader/dbus-handler-app;1"].
|
||||||
|
createInstance(Ci.nsIDBusHandlerApp);
|
||||||
|
handlerApp.service = service;
|
||||||
|
handlerApp.method = method;
|
||||||
|
handlerApp.objectPath = objpath;
|
||||||
|
handlerApp.dBusInterface = interface;
|
||||||
|
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
@ -771,15 +807,28 @@ HandlerService.prototype = {
|
||||||
if (aHandlerApp instanceof Ci.nsILocalHandlerApp) {
|
if (aHandlerApp instanceof Ci.nsILocalHandlerApp) {
|
||||||
this._setLiteral(aHandlerAppID, NC_PATH, aHandlerApp.executable.path);
|
this._setLiteral(aHandlerAppID, NC_PATH, aHandlerApp.executable.path);
|
||||||
this._removeTarget(aHandlerAppID, NC_URI_TEMPLATE);
|
this._removeTarget(aHandlerAppID, NC_URI_TEMPLATE);
|
||||||
|
this._removeTarget(aHandlerAppID, NC_METHOD);
|
||||||
|
this._removeTarget(aHandlerAppID, NC_SERVICE);
|
||||||
|
this._removeTarget(aHandlerAppID, NC_OBJPATH);
|
||||||
|
this._removeTarget(aHandlerAppID, NC_INTERFACE);
|
||||||
}
|
}
|
||||||
else if(aHandlerApp instanceof Ci.nsIWebHandlerApp){
|
else if(aHandlerApp instanceof Ci.nsIWebHandlerApp){
|
||||||
aHandlerApp.QueryInterface(Ci.nsIWebHandlerApp);
|
aHandlerApp.QueryInterface(Ci.nsIWebHandlerApp);
|
||||||
this._setLiteral(aHandlerAppID, NC_URI_TEMPLATE, aHandlerApp.uriTemplate);
|
this._setLiteral(aHandlerAppID, NC_URI_TEMPLATE, aHandlerApp.uriTemplate);
|
||||||
this._removeTarget(aHandlerAppID, NC_PATH);
|
this._removeTarget(aHandlerAppID, NC_PATH);
|
||||||
|
this._removeTarget(aHandlerAppID, NC_METHOD);
|
||||||
|
this._removeTarget(aHandlerAppID, NC_SERVICE);
|
||||||
|
this._removeTarget(aHandlerAppID, NC_OBJPATH);
|
||||||
|
this._removeTarget(aHandlerAppID, NC_INTERFACE);
|
||||||
}
|
}
|
||||||
else if(aHandlerApp instanceof Ci.nsIDBusHandlerApp){
|
else if(aHandlerApp instanceof Ci.nsIDBusHandlerApp){
|
||||||
aHandlerApp.QueryInterface(Ci.nsIDBusHandlerApp);
|
aHandlerApp.QueryInterface(Ci.nsIDBusHandlerApp);
|
||||||
|
this._setLiteral(aHandlerAppID, NC_SERVICE, aHandlerApp.service);
|
||||||
|
this._setLiteral(aHandlerAppID, NC_METHOD, aHandlerApp.method);
|
||||||
|
this._setLiteral(aHandlerAppID, NC_OBJPATH, aHandlerApp.objectPath);
|
||||||
|
this._setLiteral(aHandlerAppID, NC_INTERFACE, aHandlerApp.dBusInterface);
|
||||||
|
this._removeTarget(aHandlerAppID, NC_PATH);
|
||||||
|
this._removeTarget(aHandlerAppID, NC_URI_TEMPLATE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw "unknown handler type";
|
throw "unknown handler type";
|
||||||
|
|
Загрузка…
Ссылка в новой задаче