fx-compat: XPCOMUtilsComponentUtils for generateNSGetFactory

This commit is contained in:
Dan Stillman 2022-05-03 04:57:32 -04:00
parent f4675c02df
commit 9e9ecc7dcf
3 changed files with 7 additions and 15 deletions

View file

@ -23,15 +23,13 @@
***** END LICENSE BLOCK *****
*/
const ZOTERO_AC_CONTRACTID = '@mozilla.org/autocomplete/search;1?name=zotero';
const ZOTERO_AC_CLASSNAME = 'Zotero AutoComplete';
const ZOTERO_AC_CID = Components.ID('{06a2ed11-d0a4-4ff0-a56f-a44545eee6ea}');
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/ComponentUtils.jsm");
var Zotero = Components.classes["@zotero.org/Zotero;1"]
.getService(Components.interfaces.nsISupports)
@ -353,12 +351,10 @@ ZoteroAutoComplete.prototype.stopSearch = function(){
// XPCOM goop
//
ZoteroAutoComplete.prototype.classDescription = ZOTERO_AC_CLASSNAME;
ZoteroAutoComplete.prototype.classID = ZOTERO_AC_CID;
ZoteroAutoComplete.prototype.contractID = ZOTERO_AC_CONTRACTID;
ZoteroAutoComplete.prototype.QueryInterface = ChromeUtils.generateQI([
Components.interfaces.nsIAutoCompleteSearch,
Components.interfaces.nsIAutoCompleteObserver
]);
var NSGetFactory = XPCOMUtils.generateNSGetFactory([ZoteroAutoComplete]);
var NSGetFactory = ComponentUtils.generateNSGetFactory([ZoteroAutoComplete]);

View file

@ -33,7 +33,7 @@ const ZOTERO_PROTOCOL_CONTRACTID = "@mozilla.org/network/protocol;1?name=" + ZOT
const ZOTERO_PROTOCOL_NAME = "Zotero Chrome Extension Protocol";
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/ComponentUtils.jsm");
Components.utils.import("resource://gre/modules/osfile.jsm")
const { NetUtil } = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
@ -1529,4 +1529,4 @@ AsyncChannel.prototype = {
};
var NSGetFactory = XPCOMUtils.generateNSGetFactory([ZoteroProtocolHandler]);
var NSGetFactory = ComponentUtils.generateNSGetFactory([ZoteroProtocolHandler]);

View file

@ -152,8 +152,8 @@ const xpcomFilesLocal = [
'connector/server_connectorIntegration',
];
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/ComponentUtils.jsm");
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var instanceID = (new Date()).getTime();
var isFirstLoadThisSession = true;
@ -439,8 +439,6 @@ function ZoteroService() {
}
}
ZoteroService.prototype = {
contractID: '@zotero.org/Zotero;1',
classDescription: 'Zotero',
classID: Components.ID('{e4c61080-ec2d-11da-8ad9-0800200c9a66}'),
QueryInterface: ChromeUtils.generateQI([])
}
@ -658,12 +656,10 @@ ZoteroCommandLineHandler.prototype = {
}
},
contractID: "@mozilla.org/commandlinehandler/general-startup;1?type=zotero",
classDescription: "Zotero Command Line Handler",
classID: Components.ID("{531828f8-a16c-46be-b9aa-14845c3b010f}"),
service: true,
_xpcom_categories: [{category:"command-line-handler", entry:"m-zotero"}],
QueryInterface: ChromeUtils.generateQI([Components.interfaces.nsICommandLineHandler])
};
var NSGetFactory = XPCOMUtils.generateNSGetFactory([ZoteroService, ZoteroCommandLineHandler]);
var NSGetFactory = ComponentUtils.generateNSGetFactory([ZoteroService, ZoteroCommandLineHandler]);