Bug 465556: Fennec does not create extensions.rdf file. r=robstrong, a1.9.1=beltzner
authorDave Townsend <dtownsend@oxymoronical.com>
Fri, 28 Nov 2008 16:20:10 -0600
changeset 22109 18ecd1a5fd1d4e03f78934434c1d331fc53d4148
parent 22108 a07d428bd7073ef8d8da4c4c47197602f115db21
child 22110 30adfe786ffaf746040facfc35f1220f7e221415
push id3801
push usersdwilsh@shawnwilsher.com
push dateFri, 28 Nov 2008 23:36:09 +0000
treeherdermozilla-central@aadde428c8ce [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrobstrong
bugs465556
milestone1.9.1b3pre
Bug 465556: Fennec does not create extensions.rdf file. r=robstrong, a1.9.1=beltzner
toolkit/mozapps/extensions/src/nsExtensionManager.js.in
--- a/toolkit/mozapps/extensions/src/nsExtensionManager.js.in
+++ b/toolkit/mozapps/extensions/src/nsExtensionManager.js.in
@@ -2675,19 +2675,21 @@ ExtensionManager.prototype = {
         ERROR("Error flushing caches: " + e);
       }
     }
 
     gOS.removeObserver(this, "xpcom-shutdown");
 
     // Release strongly held services.
     gOS = null;
-    if (this._ptr && gRDF) {
+    if (this._ds) {
       gRDF.UnregisterDataSource(this._ptr);
       this._ptr = null;
+      this._ds.shutdown();
+      this._ds = null;
     }
     gRDF = null;
     if (gPref) {
       gPref.removeObserver("extensions.", this);
       gPref.removeObserver(PREF_MATCH_OS_LOCALE, this);
       gPref.removeObserver(PREF_SELECTED_LOCALE, this);
     }
     gPref = null;
@@ -5932,17 +5934,17 @@ ExtensionManager.prototype = {
     }
   },
 
   /**
    * See nsIExtensionManager.idl
    */
   get datasource() {
     this._ensureDS();
-    return this._ds.QueryInterface(Ci.nsIRDFDataSource);
+    return this._ds;
   },
 
   // nsIClassInfo
   flags: Ci.nsIClassInfo.SINGLETON,
   implementationLanguage: Ci.nsIProgrammingLanguage.JAVASCRIPT,
   getHelperForLanguage: function(language) null,
   getInterfaces: function(count) {
     var interfaces = [Ci.nsIExtensionManager, Ci.nsIObserver];
@@ -7115,16 +7117,27 @@ function ExtensionsDataSource(em) {
 }
 ExtensionsDataSource.prototype = {
   _inner    : null,
   _em       : null,
   _itemRoot     : null,
   _defaultTheme : null,
 
   /**
+   * Called during application shutdown to clear any references held.
+   * The ExtensionsDataSource is unusable after calling this.
+   */
+  shutdown: function EMDS_shutdown() {
+    this._inner = null;
+    this._em = null;
+    this._itemRoot = null;
+    this._defaultTheme = null;
+  },
+
+  /**
    * Determines if an item's dependencies are satisfied. An item's dependencies
    * are satisifed when all items specified in the item's em:requires arc are
    * installed, enabled, and the version is compatible based on the em:requires
    * minVersion and maxVersion.
    * @param   id
    *          The ID of the item
    * @returns true if the item's dependencies are satisfied.
    *          false if the item's dependencies are not satisfied.
@@ -8877,16 +8890,23 @@ ExtensionsDataSource.prototype = {
     }
     if (this._inner instanceof Ci.nsIRDFRemoteDataSource)
       this._inner.Flush();
   },
 
   FlushTo: function EMDS_FlushTo(uri) {
   },
 
+  classDescription: "Extension Manager Data Source",
+  contractID: "@mozilla.org/rdf/datasource;1?name=extensions",
+  classID: Components.ID("{69BB8313-2D4F-45EC-97E0-D39DA58ECCE9}"),
+  _xpcom_factory: {
+    createInstance: function() Cc[ExtensionManager.prototype.contractID].
+                               getService(Ci.nsIExtensionManager).datasource
+  },
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIRDFDataSource,
                                          Ci.nsIRDFRemoteDataSource])
 };
 
 function UpdateItem () {}
 UpdateItem.prototype = {
   /**
    * See nsIUpdateService.idl
@@ -8947,30 +8967,18 @@ UpdateItem.prototype = {
   },
 
   classDescription: "Update Item",
   contractID: "@mozilla.org/updates/item;1",
   classID: Components.ID("{F3294B1C-89F4-46F8-98A0-44E1EAE92518}"),
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIUpdateItem])
 };
 
-function DatasourceModule() {}
-DatasourceModule.prototype = {
-  classDescription: "Extension Manager Data Source",
-  contractID: "@mozilla.org/rdf/datasource;1?name=extensions",
-  classID: Components.ID("{69BB8313-2D4F-45EC-97E0-D39DA58ECCE9}"),
-  _xpcom_factory: {
-    createInstance: function() Cc[ExtensionManager.prototype.contractID].
-                               getService(Ci.nsIExtensionManager).datasource
-  }
-};
-
-
 function NSGetModule(compMgr, fileSpec)
-  XPCOMUtils.generateModule([ExtensionManager, DatasourceModule, UpdateItem]);
+  XPCOMUtils.generateModule([ExtensionManager, ExtensionsDataSource, UpdateItem]);
 
 #if 0
 /**
  * Logs a message and stack trace to the console.
  * @param   string
  *          The string to write to the console.
  */
 function STACK(string) {