Bug 1256165 - fit to width again after the restore session button is added, r?felipe draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Mon, 04 Apr 2016 12:55:15 +0100
changeset 347288 22a1359e0bdc63c477f917f73c515f14751277be
parent 347287 6fc436f9db859d961581a5f27bbb69731679f593
child 517587 252b13478a78c9e478a12a49ca6702d9f29215a2
push id14535
push usergijskruitbosch@gmail.com
push dateMon, 04 Apr 2016 11:55:36 +0000
reviewersfelipe
bugs1256165
milestone48.0a1
Bug 1256165 - fit to width again after the restore session button is added, r?felipe MozReview-Commit-ID: 8suUhHQTRmz
browser/base/content/abouthome/aboutHome.js
--- a/browser/base/content/abouthome/aboutHome.js
+++ b/browser/base/content/abouthome/aboutHome.js
@@ -22,30 +22,35 @@ const DATABASE_VERSION = 1;
 const DATABASE_STORAGE = "persistent";
 const SNIPPETS_OBJECTSTORE_NAME = "snippets";
 var searchText;
 
 // This global tracks if the page has been set up before, to prevent double inits
 var gInitialized = false;
 var gObserver = new MutationObserver(function (mutations) {
   for (let mutation of mutations) {
+    // The addition of the restore session button changes our width:
+    if (mutation.attributeName == "session") {
+      fitToWidth();
+    }
     if (mutation.attributeName == "snippetsVersion") {
       if (!gInitialized) {
         ensureSnippetsMapThen(loadSnippets);
         gInitialized = true;
       }
       return;
     }
   }
 });
 
 window.addEventListener("pageshow", function () {
   // Delay search engine setup, cause browser.js::BrowserOnAboutPageLoad runs
   // later and may use asynchronous getters.
   window.gObserver.observe(document.documentElement, { attributes: true });
+  window.gObserver.observe(document.getElementById("launcher"), { attributes: true });
   fitToWidth();
   setupSearch();
   window.addEventListener("resize", fitToWidth);
 
   // Ask chrome to update snippets.
   var event = new CustomEvent("AboutHomeLoad", {bubbles:true});
   document.dispatchEvent(event);
 });