diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-06-22 12:55:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-22 12:55:34 +0200 |
commit | 4b65237d5d6e6f84a69571435e7b9fa5b36f444f (patch) | |
tree | 2e64ef05d542aca638ea2970d620c987d113e2d5 /application/palemoon/base/content/browser.js | |
parent | e6f765a27070a6b922742e61d0a14dcc2c18baba (diff) | |
parent | 576124e629862cd75769074d572dbf4ee8149945 (diff) | |
download | UXP-4b65237d5d6e6f84a69571435e7b9fa5b36f444f.tar UXP-4b65237d5d6e6f84a69571435e7b9fa5b36f444f.tar.gz UXP-4b65237d5d6e6f84a69571435e7b9fa5b36f444f.tar.lz UXP-4b65237d5d6e6f84a69571435e7b9fa5b36f444f.tar.xz UXP-4b65237d5d6e6f84a69571435e7b9fa5b36f444f.zip |
Merge pull request #525 from MoonchildProductions/newtab-page-work
Newtab page work
Diffstat (limited to 'application/palemoon/base/content/browser.js')
-rw-r--r-- | application/palemoon/base/content/browser.js | 29 |
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); + } + } /** |