170006 Fix theme/extension uninstallation

git-svn-id: svn://10.0.0.236/trunk@156064 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ben%bengoodger.com
2004-05-07 01:45:35 +00:00
parent f66ea0fcc3
commit a0a97b97ff

View File

@@ -1320,11 +1320,17 @@ nsExtensionManager.prototype = {
{
if (!this._extUninstaller)
this._extUninstaller = new nsExtensionUninstaller(this._ds);
this._extUninstaller.uninstall(aExtensionID,
this._ds.isProfileItem(aExtensionID));
var isProfile = this._ds.isProfileItem(aExtensionID);
this._extUninstaller.uninstall(aExtensionID, isProfile);
// Update the Defaults Manifest
this._writeDefaults();
// Do this LAST since inferences are made about an item based on
// what container it's in.
this._ds.removeItemFromContainer(aExtensionID,
nsIUpdateItem.TYPE_EXTENSION,
isProfile);
},
uninstallExtension: function (aExtensionID)
@@ -1902,6 +1908,19 @@ nsExtensionsDataSource.prototype = {
this._flush(aIsProfile);
},
removeItemFromContainer: function (aItemID, aItemType, aIsProfile)
{
var targetDS = aIsProfile ? this._profileExtensions : this._appExtensions;
var ctr = Components.classes["@mozilla.org/rdf/container;1"]
.createInstance(Components.interfaces.nsIRDFContainer);
ctr.Init(targetDS, this._rdf.GetResource(getItemRoot(aItemType)));
var item = this._rdf.GetResource(getItemPrefix(aItemType) + aItemID);
ctr.RemoveElement(item, true);
this._flush(aIsProfile);
},
addItemMetadata: function (aItemID, aItemType, aSourceDS, aIsProfile)
{
@@ -2000,13 +2019,6 @@ nsExtensionsDataSource.prototype = {
// extension's resource, otherwise we'll think it's a global extension.
var isProfile = this.isProfileItem(aExtensionID);
var ctr = Components.classes["@mozilla.org/rdf/container;1"]
.createInstance(Components.interfaces.nsIRDFContainer);
ctr.Init(this, this._rdf.GetResource(ROOT_EXTENSION));
var extension = this._rdf.GetResource(PREFIX_EXTENSION + aExtensionID);
ctr.RemoveElement(extension, true);
// Clean the extension resource
this.removeItemMetadata(aExtensionID, nsIUpdateItem.TYPE_EXTENSION);
@@ -2024,7 +2036,7 @@ nsExtensionsDataSource.prototype = {
var iconURLArc = this._emR("iconURL");
var iconURL = this.GetTarget(theme, iconURLArc, true);
for (var i = 0; i < this._observers.length; ++i)
this._observers.onAssert(this, theme, iconURLArc, iconURL);
this._observers[i].onAssert(this, theme, iconURLArc, iconURL);
},
uninstallTheme: function (aThemeID)
@@ -2032,21 +2044,16 @@ nsExtensionsDataSource.prototype = {
// We have to do this check BEFORE we unhook all the metadata from this
// extension's resource, otherwise we'll think it's a global extension.
var isProfile = this.isProfileItem(aThemeID);
var ctr = Components.classes["@mozilla.org/rdf/container;1"]
.createInstance(Components.interfaces.nsIRDFContainer);
ctr.Init(this, this._rdf.GetResource(ROOT_THEME));
var theme = this._rdf.GetResource(PREFIX_THEME + aThemeID);
ctr.RemoveElement(theme, true);
// Clean the extension resource
this.removeItemMetadata(aThemeID, nsIUpdateItem.TYPE_EXTENSION);
this.removeItemMetadata(aThemeID, nsIUpdateItem.TYPE_THEME);
var uninstaller = new nsThemeUninstaller(this);
uninstaller.uninstall(aThemeID, isProfile);
this._flush(isProfile);
// Do this LAST since inferences are made about an item based on
// what container it's in.
this.removeItemFromContainer(aThemeID, nsIUpdateItem.TYPE_THEME, isProfile);
},
removeItemMetadata: function (aItemID, aItemType)