Bug 486299: 'Back' button should be dimmed after clearing cache, r=gavin

This commit is contained in:
Mark Finkle 2009-04-22 20:47:02 -04:00
Родитель 9293c04a97
Коммит 60c59cb6f4
2 изменённых файлов: 27 добавлений и 0 удалений

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

@ -159,6 +159,7 @@ var Browser = {
var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
os.addObserver(gXPInstallObserver, "xpinstall-install-blocked", false);
os.addObserver(gXPInstallObserver, "xpinstall-download-started", false);
os.addObserver(gSessionHistoryObserver, "browser:purge-session-history", false);
// XXX hook up memory-pressure notification to clear out tab browsers
//os.addObserver(function(subject, topic, data) self.destroyEarliestBrowser(), "memory-pressure", false);
@ -231,6 +232,13 @@ var Browser = {
}
},
shutdown: function() {
var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
os.removeObserver(gXPInstallObserver, "xpinstall-install-blocked");
os.removeObserver(gXPInstallObserver, "xpinstall-download-started");
os.removeObserver(gSessionHistoryObserver, "browser:purge-session-history");
},
updateViewportSize: function() {
var [w, h] = this._canvasBrowser._effectiveContentAreaDimensions.map(Math.ceil);
@ -1009,6 +1017,24 @@ const gXPInstallObserver = {
}
};
const gSessionHistoryObserver = {
observe: function sho_observe(subject, topic, data) {
if (topic != "browser:purge-session-history")
return;
let back = document.getElementById("cmd_back");
back.setAttribute("disabled", "true");
let forward = document.getElementById("cmd_forward");
forward.setAttribute("disabled", "true");
let urlbar = document.getElementById("urlbar-edit");
if (urlbar) {
// Clear undo history of the URL bar
urlbar.editor.transactionManager.clear()
}
}
};
function getNotificationBox(aWindow) {
return Browser.getNotificationBox();
}

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

@ -53,6 +53,7 @@
<window id="main-window"
onload="Browser.startup();"
onunload="Browser.shutdown();"
windowtype="navigator:browser"
title="&brandShortName;"
titlemodifier="&brandShortName;"