Bug 302111. Fix regression for broken back and forward buttons in help, r+a=mconnor

This commit is contained in:
aaronleventhal%moonset.net 2005-07-26 22:27:29 +00:00
parent 99eb50b061
commit 84da97d9f1

View File

@ -173,6 +173,16 @@ function init() {
getWebNavigation().sessionHistory =
Components.classes["@mozilla.org/browser/shistory;1"]
.createInstance(Components.interfaces.nsISHistory);
window.XULBrowserWindow = new nsHelpStatusHandler();
//Start the status handler.
window.XULBrowserWindow.init();
// Hook up UI through Progress Listener
const interfaceRequestor = helpBrowser.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor);
const webProgress = interfaceRequestor.getInterface(Components.interfaces.nsIWebProgress);
webProgress.addProgressListener(window.XULBrowserWindow, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
gClickSelectsAll = getBoolPref("browser.urlbar.clickSelectsAll", true);
@ -502,6 +512,39 @@ function gotoHistoryIndex(aEvent) {
return true;
}
function nsHelpStatusHandler() {
this.init();
}
nsHelpStatusHandler.prototype = {
onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus) {},
onProgressChange : function(aWebProgress, aRequest, aCurSelfProgress,
aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress) {},
onStatusChange : function(aWebProgress, aRequest, aStatus, aMessage) {},
onSecurityChange : function(aWebProgress, aRequest, state) {},
onLocationChange : function(aWebProgress, aRequest, aLocation) {
UpdateBackForwardButtons();
},
QueryInterface : function(aIID) {
if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
aIID.equals(Components.interfaces.nsIXULBrowserWindow) ||
aIID.equals(Components.interfaces.nsISupports)) {
return this;
}
throw Components.results.NS_NOINTERFACE;
},
init : function() {},
destroy : function() {},
setJSStatus : function(status) {},
setJSDefaultStatus : function(status) {},
setOverLink : function(link) {}
}
function UpdateBackForwardButtons() {
var backBroadcaster = document.getElementById("canGoBack");
var forwardBroadcaster = document.getElementById("canGoForward");