diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml index 66a525d69c2..1d99d06ec8f 100644 --- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -1454,17 +1454,18 @@ } if (animate) { - this.tabContainer._handleTabTelemetryStart(t, aURI); + mozRequestAnimationFrame(function () { + this.tabContainer._handleTabTelemetryStart(t, aURI); - // kick the animation off - t.clientTop; - t.setAttribute("fadein", "true"); + // kick the animation off + t.setAttribute("fadein", "true"); - // This call to adjustTabstrip is redundant but needed so that - // when opening a second tab, the first tab's close buttons - // appears immediately rather than when the transition ends. - if (this.tabContainer.childNodes.length == 2) - this.tabContainer.adjustTabstrip(); + // This call to adjustTabstrip is redundant but needed so that + // when opening a second tab, the first tab's close buttons + // appears immediately rather than when the transition ends. + if (this.tabContainer.childNodes.length == 2) + this.tabContainer.adjustTabstrip(); + }.bind(this)); } return t; diff --git a/browser/base/content/test/browser_bug585785.js b/browser/base/content/test/browser_bug585785.js index f8e97d2d335..adbb5a47e21 100644 --- a/browser/base/content/test/browser_bug585785.js +++ b/browser/base/content/test/browser_bug585785.js @@ -4,13 +4,15 @@ function test() { waitForExplicitFinish(); tab = gBrowser.addTab(); - is(tab.getAttribute("fadein"), "true", "tab opening animation initiated"); + isnot(tab.getAttribute("fadein"), "true", "newly opened tab is yet to fade in"); // Try to remove the tab right before the opening animation's first frame window.mozRequestAnimationFrame(checkAnimationState); } function checkAnimationState() { + is(tab.getAttribute("fadein"), "true", "tab opening animation initiated"); + info(window.getComputedStyle(tab).maxWidth); gBrowser.removeTab(tab, { animate: true }); if (!tab.parentNode) {