From 1ee90090b9a7f7e65ab0a952d9814872fab088f5 Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Tue, 13 Mar 2012 03:03:46 +0100 Subject: [PATCH] Bug 722263 - New Tab Page: changing browser.newtab.url require restart; r=dao --- browser/base/content/utilityOverlay.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/browser/base/content/utilityOverlay.js b/browser/base/content/utilityOverlay.js index b7c67afe598..ab404a0c4d1 100644 --- a/browser/base/content/utilityOverlay.js +++ b/browser/base/content/utilityOverlay.js @@ -44,7 +44,23 @@ Components.utils.import("resource://gre/modules/Services.jsm"); Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); XPCOMUtils.defineLazyGetter(this, "BROWSER_NEW_TAB_URL", function () { - return Services.prefs.getCharPref("browser.newtab.url") || "about:blank"; + const PREF = "browser.newtab.url"; + + function getNewTabPageURL() { + return Services.prefs.getCharPref(PREF) || "about:blank"; + } + + function update() { + BROWSER_NEW_TAB_URL = getNewTabPageURL(); + } + + Services.prefs.addObserver(PREF, update, false); + addEventListener("unload", function onUnload() { + removeEventListener("unload", onUnload); + Services.prefs.removeObserver(PREF, update); + }); + + return getNewTabPageURL(); }); var TAB_DROP_TYPE = "application/x-moz-tabbrowser-tab";