From 84da97d9f1394eed87fda26272f3195376ea48af Mon Sep 17 00:00:00 2001 From: "aaronleventhal%moonset.net" Date: Tue, 26 Jul 2005 22:27:29 +0000 Subject: [PATCH] Bug 302111. Fix regression for broken back and forward buttons in help, r+a=mconnor --- toolkit/components/help/content/help.js | 43 +++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/toolkit/components/help/content/help.js b/toolkit/components/help/content/help.js index d01c64c4ac90..b86d3af3270a 100644 --- a/toolkit/components/help/content/help.js +++ b/toolkit/components/help/content/help.js @@ -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");