mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-26 23:23:33 +00:00
Bug 618502: about:addons can display an empty add-on page after uninstall/restart. r=Unfocused, a=blocks-final
This commit is contained in:
parent
f1a2e58fc6
commit
c141b61178
@ -548,6 +548,19 @@ var gViewController = {
|
|||||||
this.loadViewInternal(aViewId, this.currentViewId);
|
this.loadViewInternal(aViewId, this.currentViewId);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Replaces the existing view with a new one, rewriting the current history
|
||||||
|
// entry to match.
|
||||||
|
replaceView: function(aViewId) {
|
||||||
|
if (aViewId == this.currentViewId)
|
||||||
|
return;
|
||||||
|
|
||||||
|
gHistory.replaceState({
|
||||||
|
view: aViewId,
|
||||||
|
previousView: null
|
||||||
|
}, document.title);
|
||||||
|
this.loadViewInternal(aViewId, null);
|
||||||
|
},
|
||||||
|
|
||||||
loadInitialView: function(aViewId) {
|
loadInitialView: function(aViewId) {
|
||||||
gHistory.replaceState({
|
gHistory.replaceState({
|
||||||
view: aViewId,
|
view: aViewId,
|
||||||
@ -1364,9 +1377,13 @@ var gCategories = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
get selected() {
|
||||||
|
return this.node.selectedItem ? this.node.selectedItem.value : null;
|
||||||
|
},
|
||||||
|
|
||||||
select: function(aId, aPreviousView) {
|
select: function(aId, aPreviousView) {
|
||||||
var view = gViewController.parseViewId(aId);
|
var view = gViewController.parseViewId(aId);
|
||||||
if (view.type == "detail") {
|
if (view.type == "detail" && aPreviousView) {
|
||||||
aId = aPreviousView;
|
aId = aPreviousView;
|
||||||
view = gViewController.parseViewId(aPreviousView);
|
view = gViewController.parseViewId(aPreviousView);
|
||||||
}
|
}
|
||||||
@ -2183,6 +2200,11 @@ var gDetailView = {
|
|||||||
|
|
||||||
this.node.setAttribute("type", aAddon.type);
|
this.node.setAttribute("type", aAddon.type);
|
||||||
|
|
||||||
|
// If the search category isn't selected then make sure to select the
|
||||||
|
// correct category
|
||||||
|
if (gCategories.selected != "addons://search/")
|
||||||
|
gCategories.select("addons://list/" + aAddon.type);
|
||||||
|
|
||||||
document.getElementById("detail-name").textContent = aAddon.name;
|
document.getElementById("detail-name").textContent = aAddon.name;
|
||||||
var icon = aAddon.icon64URL ? aAddon.icon64URL : aAddon.iconURL;
|
var icon = aAddon.icon64URL ? aAddon.icon64URL : aAddon.iconURL;
|
||||||
document.getElementById("detail-icon").src = icon ? icon : null;
|
document.getElementById("detail-icon").src = icon ? icon : null;
|
||||||
@ -2352,7 +2374,10 @@ var gDetailView = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This case should never happen in normal operation
|
// 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);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -2360,9 +2385,11 @@ var gDetailView = {
|
|||||||
hide: function() {
|
hide: function() {
|
||||||
this._updatePrefs.removeObserver("", this);
|
this._updatePrefs.removeObserver("", this);
|
||||||
this.clearLoading();
|
this.clearLoading();
|
||||||
gEventManager.unregisterAddonListener(this, this._addon.id);
|
if (this._addon) {
|
||||||
gEventManager.unregisterInstallListener(this);
|
gEventManager.unregisterAddonListener(this, this._addon.id);
|
||||||
this._addon = null;
|
gEventManager.unregisterInstallListener(this);
|
||||||
|
this._addon = null;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
updateState: function() {
|
updateState: function() {
|
||||||
|
@ -63,6 +63,7 @@ _MAIN_TEST_FILES = \
|
|||||||
browser_bug596336.js \
|
browser_bug596336.js \
|
||||||
browser_bug608316.js \
|
browser_bug608316.js \
|
||||||
browser_bug610764.js \
|
browser_bug610764.js \
|
||||||
|
browser_bug618502.js \
|
||||||
browser_details.js \
|
browser_details.js \
|
||||||
browser_discovery.js \
|
browser_discovery.js \
|
||||||
browser_dragdrop.js \
|
browser_dragdrop.js \
|
||||||
|
46
toolkit/mozapps/extensions/test/browser/browser_bug618502.js
Normal file
46
toolkit/mozapps/extensions/test/browser/browser_bug618502.js
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
|
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Bug 608316 - Test that opening the manager to an add-on that doesn't exist
|
||||||
|
// just loads the default view
|
||||||
|
|
||||||
|
var gCategoryUtilities;
|
||||||
|
|
||||||
|
function test() {
|
||||||
|
waitForExplicitFinish();
|
||||||
|
|
||||||
|
run_next_test();
|
||||||
|
}
|
||||||
|
|
||||||
|
function end_test() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
add_test(function() {
|
||||||
|
open_manager("addons://detail/foo", function(aManager) {
|
||||||
|
gCategoryUtilities = new CategoryUtilities(aManager);
|
||||||
|
is(gCategoryUtilities.selectedCategory, "discover", "Should fall back to the discovery pane");
|
||||||
|
|
||||||
|
close_manager(aManager, run_next_test);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Also test that opening directly to an add-on that does exist doesn't break
|
||||||
|
// and selects the right category
|
||||||
|
add_test(function() {
|
||||||
|
gProvider = new MockProvider();
|
||||||
|
|
||||||
|
gProvider.createAddons([{
|
||||||
|
id: "addon1@tests.mozilla.org",
|
||||||
|
name: "addon 1",
|
||||||
|
version: "1.0"
|
||||||
|
}]);
|
||||||
|
|
||||||
|
open_manager("addons://detail/addon1@tests.mozilla.org", function(aManager) {
|
||||||
|
gCategoryUtilities = new CategoryUtilities(aManager);
|
||||||
|
is(gCategoryUtilities.selectedCategory, "extension", "Should have selected the right category");
|
||||||
|
|
||||||
|
close_manager(aManager, run_next_test);
|
||||||
|
});
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user