Bug 563135: Add-ons manager should expose outdated plugins. r=Unfocused, a=blocking-b6

This commit is contained in:
Dave Townsend 2010-09-01 09:58:42 -07:00
Родитель a29c57459f
Коммит 8fea742a3e
5 изменённых файлов: 171 добавлений и 2 удалений

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

@ -23,6 +23,9 @@ notification.blocked.link=More Information
#LOCALIZATION NOTE (notification.softblocked) %1$S is the add-on name
notification.softblocked=%1$S is known to cause security or stability issues.
notification.softblocked.link=More Information
#LOCALIZATION NOTE (notification.outdated) %1$S is the add-on name
notification.outdated=An important update is available for %1$S.
notification.outdated.link=Update Now
#LOCALIZATION NOTE (notification.enable) %1$S is the add-on name, %2$S is brand name
notification.enable=%1$S will be enabled after you restart %2$S.
#LOCALIZATION NOTE (notification.disable) %1$S is the add-on name, %2$S is brand name
@ -55,6 +58,9 @@ details.notification.blocked.link=More Information
#LOCALIZATION NOTE (details.notification.softblocked) %1$S is the add-on name
details.notification.softblocked=%1$S is known to cause security or stability issues.
details.notification.softblocked.link=More Information
#LOCALIZATION NOTE (details.notification.outdated) %1$S is the add-on name
details.notification.outdated=An important update is available for %1$S.
details.notification.outdated.link=Update Now
#LOCALIZATION NOTE (details.notification.enable) %1$S is the add-on name, %2$S is brand name
details.notification.enable=%1$S will be enabled after you restart %2$S.
#LOCALIZATION NOTE (details.notification.disable) %1$S is the add-on name, %2$S is brand name

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

@ -1823,6 +1823,16 @@ var gDetailView = {
warningLink.value = gStrings.ext.GetStringFromName("details.notification.softblocked.link");
warningLink.href = Services.urlFormatter.formatURLPref("extensions.blocklist.detailsURL");
warningLink.hidden = false;
} else if (this._addon.blocklistState == Ci.nsIBlocklistService.STATE_OUTDATED) {
this.node.setAttribute("notification", "warning");
document.getElementById("detail-warning").textContent = gStrings.ext.formatStringFromName(
"details.notification.outdated",
[this._addon.name], 1
);
var warningLink = document.getElementById("detail-warning-link");
warningLink.value = gStrings.ext.GetStringFromName("details.notification.outdated.link");
warningLink.href = Services.urlFormatter.formatURLPref("plugins.update.url");
warningLink.hidden = false;
} else {
this.node.removeAttribute("notification");
}

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

@ -1081,6 +1081,15 @@
this._warningLink.value = gStrings.ext.GetStringFromName("notification.softblocked.link");
this._warningLink.href = Services.urlFormatter.formatURLPref("extensions.blocklist.detailsURL");
this._warningLink.hidden = false;
} else if (this.mAddon.blocklistState == Ci.nsIBlocklistService.STATE_OUTDATED) {
this.setAttribute("notification", "warning");
this._warning.textContent = gStrings.ext.formatStringFromName(
"notification.outdated",
[this.mAddon.name], 1
);
this._warningLink.value = gStrings.ext.GetStringFromName("notification.outdated.link");
this._warningLink.href = Services.urlFormatter.formatURLPref("plugins.update.url");
this._warningLink.hidden = false;
} else {
this.removeAttribute("notification");
}

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

@ -13,6 +13,7 @@ var gCategoryUtilities;
var gApp = document.getElementById("bundle_brand").getString("brandShortName");
var gVersion = Services.appinfo.version;
var gBlocklistURL = Services.urlFormatter.formatURLPref("extensions.blocklist.detailsURL");
var gPluginURL = Services.urlFormatter.formatURLPref("plugins.update.url");
var gDate = new Date(2010, 7, 1);
function open_details(aId, aType, aCallback) {
@ -111,6 +112,10 @@ function test() {
name: "Test add-on 7",
_userDisabled: true,
isActive: false
}, {
id: "addon8@tests.mozilla.org",
name: "Test add-on 8",
blocklistState: Ci.nsIBlocklistService.STATE_OUTDATED
}]);
open_manager(null, function(aWindow) {
@ -540,3 +545,71 @@ add_test(function() {
});
});
});
// Opens and tests the details view for add-on 8
add_test(function() {
open_details("addon8@tests.mozilla.org", "extension", function() {
is(get("detail-name").value, "Test add-on 8", "Name should be correct");
is_element_hidden(get("detail-prefs"), "Preferences button should be hidden");
is_element_hidden(get("detail-enable"), "Enable button should be hidden");
is_element_visible(get("detail-disable"), "Disable button should be visible");
is_element_visible(get("detail-uninstall"), "Remove button should be visible");
is_element_visible(get("detail-warning"), "Warning message should be visible");
is(get("detail-warning").textContent, "An important update is available for Test add-on 8.", "Warning message should be correct");
is_element_visible(get("detail-warning-link"), "Warning link should be visible");
is(get("detail-warning-link").value, "Update Now", "Warning link text should be correct");
is(get("detail-warning-link").href, gPluginURL, "Warning link should be correct");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-error-link"), "Error link should be hidden");
is_element_hidden(get("detail-pending"), "Pending message should be hidden");
// Disable it
EventUtils.synthesizeMouse(get("detail-disable"), 2, 2, {}, gManagerWindow);
is_element_hidden(get("detail-prefs"), "Preferences button should be hidden");
is_element_visible(get("detail-enable"), "Enable button should be visible");
is_element_hidden(get("detail-disable"), "Disable button should be hidden");
is_element_visible(get("detail-uninstall"), "Remove button should be visible");
is_element_hidden(get("detail-warning"), "Warning message should be hidden");
is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-error-link"), "Error link should be hidden");
is_element_visible(get("detail-pending"), "Pending message should be visible");
is(get("detail-pending").textContent, "Test add-on 8 will be disabled after you restart " + gApp + ".", "Pending message should be correct");
// Reopen it
open_details("addon8@tests.mozilla.org", "extension", function() {
is_element_hidden(get("detail-prefs"), "Preferences button should be hidden");
is_element_visible(get("detail-enable"), "Enable button should be visible");
is_element_hidden(get("detail-disable"), "Disable button should be hidden");
is_element_visible(get("detail-uninstall"), "Remove button should be visible");
is_element_hidden(get("detail-warning"), "Warning message should be hidden");
is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-error-link"), "Error link should be hidden");
is_element_visible(get("detail-pending"), "Pending message should be visible");
is(get("detail-pending").textContent, "Test add-on 8 will be disabled after you restart " + gApp + ".", "Pending message should be correct");
// Undo disabling
EventUtils.synthesizeMouse(get("detail-undo"), 2, 2, {}, gManagerWindow);
is_element_hidden(get("detail-prefs"), "Preferences button should be hidden");
is_element_hidden(get("detail-enable"), "Enable button should be hidden");
is_element_visible(get("detail-disable"), "Disable button should be visible");
is_element_visible(get("detail-uninstall"), "Remove button should be visible");
is_element_visible(get("detail-warning"), "Warning message should be visible");
is(get("detail-warning").textContent, "An important update is available for Test add-on 8.", "Warning message should be correct");
is_element_visible(get("detail-warning-link"), "Warning link should be visible");
is(get("detail-warning-link").value, "Update Now", "Warning link text should be correct");
is(get("detail-warning-link").href, gPluginURL, "Warning link should be correct");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-error-link"), "Error link should be hidden");
is_element_hidden(get("detail-pending"), "Pending message should be hidden");
run_next_test();
});
});
});

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

@ -11,6 +11,7 @@ var gCategoryUtilities;
var gApp = document.getElementById("bundle_brand").getString("brandShortName");
var gVersion = Services.appinfo.version;
var gBlocklistURL = Services.urlFormatter.formatURLPref("extensions.blocklist.detailsURL");
var gPluginURL = Services.urlFormatter.formatURLPref("plugins.update.url");
var gDate = new Date(2010, 7, 16);
function test() {
@ -58,6 +59,10 @@ function test() {
id: "addon6@tests.mozilla.org",
name: "Test add-on 6",
operationsRequiringRestart: AddonManager.OP_NEEDS_RESTART_NONE
}, {
id: "addon7@tests.mozilla.org",
name: "Test add-on 7",
blocklistState: Ci.nsIBlocklistService.STATE_OUTDATED,
}]);
open_manager(null, function(aWindow) {
@ -101,7 +106,7 @@ function get_class_node(parent, cls) {
add_test(function() {
gCategoryUtilities.openType("extension", function() {
let items = get_test_items();
is(items.length, 6, "Should be six add-ons installed");
is(items.length, 7, "Should be seven add-ons installed");
info("Addon 1");
let addon = items[0];
@ -280,6 +285,39 @@ add_test(function() {
is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
is_element_hidden(get_node(addon, "pending"), "Pending message should be hidden");
info("Addon 7");
addon = items[6];
addon.parentNode.ensureElementIsVisible(addon);
is(get_node(addon, "name").value, "Test add-on 7", "Name should be correct");
is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
is_element_hidden(get_node(addon, "enable-btn"), "Enable button should be hidden");
is_element_visible(get_node(addon, "disable-btn"), "Disable button should be visible");
is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
is_element_visible(get_node(addon, "warning"), "Warning message should be hidden");
is(get_node(addon, "warning").textContent, "An important update is available for Test add-on 7.", "Warning message should be correct");
is_element_visible(get_node(addon, "warning-link"), "Warning link should be visible");
is(get_node(addon, "warning-link").value, "Update Now", "Warning link text should be correct");
is(get_node(addon, "warning-link").href, gPluginURL, "Warning link should be correct");
is_element_hidden(get_node(addon, "error"), "Error message should be hidden");
is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
is_element_hidden(get_node(addon, "pending"), "Pending message should be hidden");
info("Disabling");
EventUtils.synthesizeMouse(get_node(addon, "disable-btn"), 2, 2, {}, gManagerWindow);
is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
is_element_visible(get_node(addon, "enable-btn"), "Enable button should be visible");
is_element_hidden(get_node(addon, "disable-btn"), "Disable button should be hidden");
is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
is_element_hidden(get_node(addon, "warning"), "Warning message should be visible");
is_element_hidden(get_node(addon, "warning-link"), "Warning link should be hidden");
is_element_hidden(get_node(addon, "error"), "Error message should be hidden");
is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
is_element_visible(get_node(addon, "pending"), "Pending message should be visible");
is(get_node(addon, "pending").textContent, "Test add-on 7 will be disabled after you restart " + gApp + ".", "Pending message should be correct");
run_next_test();
});
});
@ -305,7 +343,7 @@ add_test(function() {
gCategoryUtilities.openType("plugin", function() {
gCategoryUtilities.openType("extension", function() {
let items = get_test_items();
is(items.length, 6, "Should be six add-ons installed");
is(items.length, 7, "Should be seven add-ons installed");
info("Addon 1");
let addon = items[0];
@ -447,6 +485,39 @@ add_test(function() {
is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
is_element_hidden(get_node(addon, "pending"), "Pending message should be hidden");
info("Addon 7");
addon = items[6];
addon.parentNode.ensureElementIsVisible(addon);
is(get_node(addon, "name").value, "Test add-on 7", "Name should be correct");
is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
is_element_visible(get_node(addon, "enable-btn"), "Enable button should be visible");
is_element_hidden(get_node(addon, "disable-btn"), "Disable button should be hidden");
is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
is_element_hidden(get_node(addon, "warning"), "Warning message should be visible");
is_element_hidden(get_node(addon, "warning-link"), "Warning link should be hidden");
is_element_hidden(get_node(addon, "error"), "Error message should be hidden");
is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
is_element_visible(get_node(addon, "pending"), "Pending message should be visible");
is(get_node(addon, "pending").textContent, "Test add-on 7 will be disabled after you restart " + gApp + ".", "Pending message should be correct");
info("Undoing");
EventUtils.synthesizeMouse(get_node(addon, "undo"), 2, 2, {}, gManagerWindow);
is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
is_element_hidden(get_node(addon, "enable-btn"), "Enable button should be hidden");
is_element_visible(get_node(addon, "disable-btn"), "Disable button should be visible");
is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
is_element_visible(get_node(addon, "warning"), "Warning message should be hidden");
is(get_node(addon, "warning").textContent, "An important update is available for Test add-on 7.", "Warning message should be correct");
is_element_visible(get_node(addon, "warning-link"), "Warning link should be visible");
is(get_node(addon, "warning-link").value, "Update Now", "Warning link text should be correct");
is(get_node(addon, "warning-link").href, gPluginURL, "Warning link should be correct");
is_element_hidden(get_node(addon, "error"), "Error message should be hidden");
is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
is_element_hidden(get_node(addon, "pending"), "Pending message should be hidden");
run_next_test();
});
});