247667 - 404 errors on install should display an error

This commit is contained in:
ben%bengoodger.com 2004-07-13 08:08:20 +00:00
Родитель d4f1c5654a
Коммит 100b3b86b5
3 изменённых файлов: 22 добавлений и 7 удалений

Просмотреть файл

@ -274,7 +274,21 @@ XPInstallDownloadManager.prototype = {
catch (e) {
msg = xpinstallStrings.getFormattedString("unknown.error", [aValue]);
}
element.setAttribute("error", msg);
var sbs = Components.classes["@mozilla.org/intl/stringbundle;1"]
.getService(Components.interfaces.nsIStringBundleService);
var extensionStrings = sbs.createBundle("chrome://mozapps/locale/extensions/extensions.properties");
var title = extensionStrings.GetStringFromName("errorInstallTitle");
var brandStrings = sbs.createBundle("chrome://global/locale/brand.properties");
var brandShortName = brandStrings.GetStringFromName("brandShortName");
var params = [brandShortName, aURL, msg];
var message = extensionStrings.formatStringFromName("errorInstallMessage", params, params.length);
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
ps.alert(window, title, message);
element.setAttribute("status", msg);
}
// Remove the dummy, since we installed successfully
var type = gWindowState == "extensions" ? nsIUpdateItem.TYPE_EXTENSION

Просмотреть файл

@ -56,6 +56,9 @@ malformedRegistrationDetailsButton=View Details
invalidVersionMessage=%S could not install "%S" because its version information ("%S") is invalid. Please contact the author about this problem.
invalidVersionTitle=Invalid Version
errorInstallTitle=Error
errorInstallMessage=%S could not download the file at \n\n%S\n\nbecause: %S
# The following are used by Thunderbird only in order to provide a way to load
# extension and JAR files.

Просмотреть файл

@ -1921,7 +1921,7 @@ nsExtensionManager.prototype = {
for (var i = 0; i < items.length; ++i) {
// Now disable the extension so it won't hurt anything.
var itemType = getItemType(this._ds._getResourceForItem(items[i].id).Value);
if (itemType & nsIUpdateItem.TYPE_EXTENSION)
if (itemType != -1 && itemType & nsIUpdateItem.TYPE_EXTENSION)
this.disableExtension(items[i].id);
else if (itemType & nsIUpdateItem.TYPE_THEME) {
var cr = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
@ -2363,8 +2363,6 @@ nsExtensionManager.prototype = {
{
this._ensureDS();
dump("*** installTheme\n");
var isProfile = aFlags & nsIExtensionManager.FLAG_INSTALL_PROFILE;
var installer = new nsThemeInstaller(this._ds, this);
installer.install(aJARFile, isProfile);
@ -3535,7 +3533,7 @@ nsExtensionsDataSource.prototype = {
if (aProperty.EqualsNode(this._emR("iconURL"))) {
var itemType = getItemType(aSource.Value);
if (itemType & nsIUpdateItem.TYPE_EXTENSION) {
if (itemType != -1 && itemType & nsIUpdateItem.TYPE_EXTENSION) {
var hasIconURL = this._composite.hasArcOut(aSource, aProperty);
// If the download entry doesn't have a IconURL property, use a
// generic icon URL instead.
@ -3558,7 +3556,7 @@ nsExtensionsDataSource.prototype = {
}
}
}
else if (itemType & nsIUpdateItem.TYPE_THEME) {
else if (itemType != -1 && itemType & nsIUpdateItem.TYPE_THEME) {
var res = this._getThemeJARURL(aSource, "icon.png", "chrome://mozapps/skin/extensions/themeGeneric.png");
if (res)
return res;
@ -3566,7 +3564,7 @@ nsExtensionsDataSource.prototype = {
}
else if (aProperty.EqualsNode(this._emR("previewImage"))) {
var itemType = getItemType(aSource.Value);
if (itemType & nsIUpdateItem.TYPE_THEME) {
if (itemType != -1 && itemType & nsIUpdateItem.TYPE_THEME) {
var res = this._getThemeJARURL(aSource, "preview.png", null);
if (res)
return res;