summaryrefslogtreecommitdiffstats
path: root/application/palemoon/base/content/browser.js
diff options
context:
space:
mode:
Diffstat (limited to 'application/palemoon/base/content/browser.js')
-rw-r--r--application/palemoon/base/content/browser.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/application/palemoon/base/content/browser.js b/application/palemoon/base/content/browser.js
index 6df6488b1..386bd418b 100644
--- a/application/palemoon/base/content/browser.js
+++ b/application/palemoon/base/content/browser.js
@@ -2400,6 +2400,9 @@ function PageProxyClickHandler(aEvent)
* to the DOM for unprivileged pages.
*/
function BrowserOnAboutPageLoad(doc) {
+
+ /* === about:home === */
+
if (doc.documentURI.toLowerCase() == "about:home") {
let ss = Components.classes["@mozilla.org/browser/sessionstore;1"].
getService(Components.interfaces.nsISessionStore);
@@ -2438,6 +2441,32 @@ function BrowserOnAboutPageLoad(doc) {
Services.obs.removeObserver(updateSearchEngine, "browser-search-engine-modified");
}, false);
}
+
+ /* === about:newtab === */
+
+ if (doc.documentURI.toLowerCase() == "about:newtab") {
+
+ let docElt = doc.documentElement;
+
+ function updateSearchEngine() {
+ let engine = AboutHomeUtils.defaultSearchEngine;
+ docElt.setAttribute("searchEngineName", engine.name);
+ docElt.setAttribute("searchEnginePostData", engine.postDataString || "");
+ docElt.setAttribute("searchEngineURL", engine.searchURL);
+ }
+ updateSearchEngine();
+
+ // Listen for the event that's triggered when the user changes search engine.
+ // At this point we simply reload about:newtab to reflect the change.
+ Services.obs.addObserver(updateSearchEngine, "browser-search-engine-modified", false);
+
+ // Remove the observer when the page is reloaded or closed.
+ doc.defaultView.addEventListener("pagehide", function removeObserver() {
+ doc.defaultView.removeEventListener("pagehide", removeObserver);
+ Services.obs.removeObserver(updateSearchEngine, "browser-search-engine-modified");
+ }, false);
+ }
+
}
/**