Bug 43714 Tooltip for the 'Home' button not updated when setting page via prefs

r=biesi, sr=bzbarsky
Register a pref callback in navigator.js.
This commit is contained in:
kyle.yuan%sun.com 2002-08-30 09:37:15 +00:00
parent 3745f63a12
commit 6fd77937f3
2 changed files with 17 additions and 1 deletions

View File

@ -114,6 +114,21 @@ const gTabStripPrefListener =
}
};
const gHomepagePrefListener =
{
domain: "browser.startup.homepage",
observe: function(subject, topic, prefName)
{
// verify that we're changing the home page pref
if (topic != "nsPref:changed")
return;
var homePage = getHomePage();
if (homePage)
setTooltipText("home-button", homePage);
}
};
/**
* Pref listener handler functions.
* Both functions assume that observer.domain is set to
@ -361,6 +376,7 @@ function Startup()
addPrefListener(gButtonPrefListener);
addPrefListener(gTabStripPrefListener);
addPrefListener(gHomepagePrefListener);
window.browserContentListener =
new nsBrowserContentListener(window, getBrowser());
@ -558,6 +574,7 @@ function Shutdown()
// unregister us as a pref listener
removePrefListener(gButtonPrefListener);
removePrefListener(gTabStripPrefListener);
removePrefListener(gHomepagePrefListener);
window.browserContentListener.close();
// Close the app core.

View File

@ -154,7 +154,6 @@ function openHomeDialog(aURL)
if (pressedVal == 0) {
nsPreferences.setUnicharPref("browser.startup.homepage", aURL);
setTooltipText("home-button", aURL);
}
}