Fix XULRunner build to use a manifest for nsXULAppInstall.js, followup to bug 568691.
authorBenjamin Smedberg <benjamin@smedbergs.us>
Fri, 25 Jun 2010 11:37:23 -0400
changeset 47053 779da8849db32987bc4e8fdbb20877b9e3d32955
parent 47052 58a1cdb7f8f56b824d2bf866c59ad4007150cdd8
child 47054 8334b2c1afb9eb3fee2ee430b2b5c531040c4f50
child 47055 9e908e1d355a540d5b3df48ede5b54bd0aaafbe0
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
bugs568691
milestone1.9.3a6pre
Fix XULRunner build to use a manifest for nsXULAppInstall.js, followup to bug 568691.
xulrunner/setup/Makefile.in
xulrunner/setup/nsXULAppInstall.js
xulrunner/setup/nsXULAppInstall.manifest
--- a/xulrunner/setup/Makefile.in
+++ b/xulrunner/setup/Makefile.in
@@ -44,13 +44,14 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE = xulrunner
 XPIDL_MODULE = xulapp_setup
 
 XPIDLSRCS = \
 	nsIXULAppInstall.idl \
 	$(NULL)
 
+EXTRA_COMPONENTS = nsXULAppInstall.manifest
 EXTRA_PP_COMPONENTS = nsXULAppInstall.js
 
 DEFINES = -DBIN_SUFFIX=$(BIN_SUFFIX)
 
 include $(topsrcdir)/config/rules.mk
--- a/xulrunner/setup/nsXULAppInstall.js
+++ b/xulrunner/setup/nsXULAppInstall.js
@@ -34,16 +34,18 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #endif
 
+Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+
 const nsIFile             = Components.interfaces.nsIFile;
 const nsIINIParser        = Components.interfaces.nsIINIParser;
 const nsIINIParserFactory = Components.interfaces.nsIINIParserFactory;
 const nsILocalFile        = Components.interfaces.nsILocalFile;
 const nsISupports         = Components.interfaces.nsISupports;
 const nsIXULAppInstall    = Components.interfaces.nsIXULAppInstall;
 const nsIZipReader        = Components.interfaces.nsIZipReader;
 
@@ -200,26 +202,24 @@ zipExtractor.prototype = {
 
 function createExtractor(aFile) {
   if (aFile.isDirectory())
     return new directoryExtractor(aFile);
 
   return new zipExtractor(aFile);
 }
 
-const AppInstall = {
+function AppInstall() {
+}
+
+AppInstall.prototype = {
+  classID: Components.ID("{00790a19-27e2-4d9a-bef0-244080feabfd}"),
 
   /* nsISupports */
-  QueryInterface : function ai_QI(iid) {
-    if (iid.equals(nsIXULAppInstall) ||
-        iid.equals(nsISupports))
-      return this;
-
-    throw Components.results.NS_ERROR_NO_INTERFACE;
-  },
+  QueryInterface : XPCOMUtils.generateQI([nsIXULAppInstall]),
 
   /* nsIXULAppInstall */
   installApplication : function ai_IA(aAppFile, aDirectory, aLeafName) {
     var extractor = createExtractor(aAppFile);
     var iniParser = extractor.iniParser;
 
     var appName = iniParser.getString("App", "Name");
 
@@ -343,75 +343,9 @@ const AppInstall = {
     var xulrunnerBinary = getDirectoryKey("GreD");
     xulrunnerBinary.append("xulrunner-stub@BIN_SUFFIX@");
 
     xulrunnerBinary.copyTo(aDirectory, appName.toLowerCase() + "@BIN_SUFFIX@");
 #endif
   }
 };
 
-const AppInstallFactory = {
-  /* nsISupports */
-  QueryInterface : function aif_QI(iid) {
-    if (iid.equals(Components.interfaces.nsIFactory) ||
-        iid.equals(nsISupports))
-      return this;
-
-    throw Components.results.NS_ERROR_NO_INTERFACE;
-  },
-
-  /* nsIFactory */
-  createInstance : function aif_CI(aOuter, aIID) {
-    if (aOuter)
-      throw Components.results.NS_ERROR_NO_AGGREGATION;
-
-    return AppInstall.QueryInterface(aIID);
-  },
-
-  lockFactory : function aif_lock(aLock) { }
-};
-
-const AppInstallContractID = "@mozilla.org/xulrunner/app-install-service;1";
-const AppInstallCID = Components.ID("{00790a19-27e2-4d9a-bef0-244080feabfd}");
-
-const AppInstallModule = {
-  /* nsISupports */
-  QueryInterface : function mod_QI(iid) {
-    if (iid.equals(Components.interfaces.nsIModule) ||
-        iid.equals(nsISupports))
-      return this;
-
-    throw Components.results.NS_ERROR_NO_INTERFACE;
-  },
-
-  /* nsIModule */
-  getClassObject : function mod_gco(aCompMgr, aClass, aIID) {
-    if (aClass.equals(AppInstallCID))
-      return AppInstallFactory.QueryInterface(aIID);
-
-    return Components.results.NS_ERROR_FACTORY_NOT_REGISTERED;
-  },
-
-  registerSelf : function mod_regself(aCompMgr, aLocation,
-                                      aLoaderStr, aType) {
-    var reg = aCompMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
-    reg.registerFactoryLocation(AppInstallCID,
-                                "nsXULAppInstall",
-                                AppInstallContractID,
-                                aLocation,
-                                aLoaderStr,
-                                aType);
-  },
-
-  unregisterSelf : function mod_unreg(aCompMgr, aLocation, aLoaderStr) {
-    var reg = aCompMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
-    reg.unregisterFactoryLocation(AppInstallCID,
-                                  aLocation);
-  },
-
-  canUnload : function mod_unload(aCompMgr) {
-    return true;
-  }
-};
-
-function NSGetModule(compMgr, fileSpec) {
-  return AppInstallModule;
-}
+const NSGetFactory = XPCOMUtils.generateNSGetFactory([AppInstall]);
new file mode 100644
--- /dev/null
+++ b/xulrunner/setup/nsXULAppInstall.manifest
@@ -0,0 +1,2 @@
+component {00790a19-27e2-4d9a-bef0-244080feabfd} nsXULAppInstall.js
+contract @mozilla.org/xulrunner/app-install-service;1 {00790a19-27e2-4d9a-bef0-244080feabfd}