Bug 904616 - Ensure that sizes for preload browsers are applied correctly; r=jaws
authorTim Taubert <ttaubert@mozilla.com>
Wed, 14 Aug 2013 06:59:49 +0200
changeset 142510 cb1b1f0d16ff1e1011b08a82de53b81c306ce929
parent 142476 d8c750a414decf653c012158426a744fe7675e8d
child 142511 f8fe45a1f17a6454310b38349fb210258a58a9ba
push id25100
push usercbook@mozilla.com
push dateWed, 14 Aug 2013 12:29:49 +0000
treeherdermozilla-central@172a054523cc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs904616
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 904616 - Ensure that sizes for preload browsers are applied correctly; r=jaws
browser/modules/BrowserNewTabPreloader.jsm
--- a/browser/modules/BrowserNewTabPreloader.jsm
+++ b/browser/modules/BrowserNewTabPreloader.jsm
@@ -338,36 +338,40 @@ HiddenBrowser.prototype = {
   observe: function () {
     this._timer = null;
 
     // Start pre-loading the new tab page.
     this._createBrowser();
   },
 
   resize: function (width, height) {
-    if (this._browser) {
-      this._browser.style.width = width + "px";
-      this._browser.style.height = height + "px";
-    } else {
-      this._width = width;
-      this._height = height;
-    }
+    this._width = width;
+    this._height = height;
+    this._applySize();
   },
 
   destroy: function () {
     this._removeBrowser();
     this._timer = clearTimer(this._timer);
   },
 
+  _applySize: function () {
+    if (this._browser) {
+      this._browser.style.width = this._width + "px";
+      this._browser.style.height = this._height + "px";
+    }
+  },
+
   _createBrowser: function () {
     HostFrame.get().then(aFrame => {
       let doc = aFrame.document;
       this._browser = doc.createElementNS(XUL_NS, "browser");
       this._browser.setAttribute("type", "content");
       this._browser.setAttribute("src", NEWTAB_URL);
+      this._applySize();
       doc.getElementById("win").appendChild(this._browser);
     });
   },
 
   _removeBrowser: function () {
     if (this._browser) {
       this._browser.remove();
       this._browser = null;