diff --git a/toolkit/mozapps/extensions/content/extensions.js b/toolkit/mozapps/extensions/content/extensions.js index 2892b61f6411..288f3f972d35 100644 --- a/toolkit/mozapps/extensions/content/extensions.js +++ b/toolkit/mozapps/extensions/content/extensions.js @@ -51,7 +51,7 @@ const UPDATES_RELEASENOTES_TRANSFORMFILE = "chrome://mozapps/content/extensions/ const XMLURI_PARSE_ERROR = "http://www.mozilla.org/newlayout/xml/parsererror.xml" -const VIEW_DEFAULT = "addons://discover/"; +var gViewDefault = "addons://discover/"; var gStrings = {}; XPCOMUtils.defineLazyServiceGetter(gStrings, "bundleSvc", @@ -124,6 +124,10 @@ function initialize(event) { gHeader.onKeyPress(event); }); + if (!isDiscoverEnabled()) { + gViewDefault = "addons://list/extension"; + } + gViewController.initialize(); gCategories.initialize(); gHeader.initialize(); @@ -641,12 +645,12 @@ var gViewController = { if (gHistory.canGoBack) gHistory.back(); else - gViewController.replaceView(VIEW_DEFAULT); + gViewController.replaceView(gViewDefault); } else { if (gHistory.canGoForward) gHistory.forward(); else - gViewController.replaceView(VIEW_DEFAULT); + gViewController.replaceView(gViewDefault); } } }, @@ -1673,7 +1677,7 @@ var gCategories = { // then the list will default to selecting the search category and we never // want to show that as the first view so switch to the default category if (!this.node.selectedItem || this.node.selectedItem == this._search) - this.node.value = VIEW_DEFAULT; + this.node.value = gViewDefault; var self = this; this.node.addEventListener("select", function node_onSelected() { @@ -1741,7 +1745,7 @@ var gCategories = { // If this category is currently selected then switch to the default view if (this.node.selectedItem == category) - gViewController.replaceView(VIEW_DEFAULT); + gViewController.replaceView(gViewDefault); this.node.removeChild(category); }, @@ -1772,7 +1776,7 @@ var gCategories = { // Don't load view that is becoming hidden if (hidden && aViewId == gViewController.currentViewId) - gViewController.loadView(VIEW_DEFAULT); + gViewController.loadView(gViewDefault); item.hidden = hidden; Services.prefs.setBoolPref(prefName, hidden); @@ -3011,7 +3015,7 @@ var gDetailView = { // This might happen due to session restore restoring us back to an // add-on that doesn't exist but otherwise shouldn't normally happen. // Either way just revert to the default view. - gViewController.replaceView(VIEW_DEFAULT); + gViewController.replaceView(gViewDefault); }); }); }, diff --git a/toolkit/mozapps/extensions/test/browser/browser_discovery.js b/toolkit/mozapps/extensions/test/browser/browser_discovery.js index b19219ed072e..70793f739ab0 100644 --- a/toolkit/mozapps/extensions/test/browser/browser_discovery.js +++ b/toolkit/mozapps/extensions/test/browser/browser_discovery.js @@ -620,3 +620,18 @@ add_test(function() { Services.prefs.setBoolPref(PREF_XPI_ENABLED, true); bug_601442_test_elements(true); }); + +// Test for Bug 1132971 - if extensions.getAddons.showPane is false, +// the extensions pane should show by default +add_test(function() { + Services.prefs.clearUserPref(PREF_UI_LASTCATEGORY); + Services.prefs.setBoolPref(PREF_DISCOVER_ENABLED, false); + + open_manager(null, function(aWindow) { + gManagerWindow = aWindow; + gCategoryUtilities = new CategoryUtilities(gManagerWindow); + is(gCategoryUtilities.selectedCategory, "extension", "Should be showing the extension view"); + close_manager(gManagerWindow, run_next_test); + Services.prefs.clearUserPref(PREF_DISCOVER_ENABLED); + }); +}); diff --git a/toolkit/mozapps/extensions/test/browser/head.js b/toolkit/mozapps/extensions/test/browser/head.js index 0fc9f4310cd7..c0c2205fc271 100644 --- a/toolkit/mozapps/extensions/test/browser/head.js +++ b/toolkit/mozapps/extensions/test/browser/head.js @@ -33,6 +33,7 @@ const PREF_XPI_ENABLED = "xpinstall.enabled"; const PREF_UPDATEURL = "extensions.update.url"; const PREF_GETADDONS_CACHE_ENABLED = "extensions.getAddons.cache.enabled"; const PREF_CUSTOM_XPINSTALL_CONFIRMATION_UI = "xpinstall.customConfirmationUI"; +const PREF_UI_LASTCATEGORY = "extensions.ui.lastCategory"; const MANAGER_URI = "about:addons"; const INSTALL_URI = "chrome://mozapps/content/xpinstall/xpinstallConfirm.xul";