michael@0: var tab; michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: tab = gBrowser.addTab(); michael@0: isnot(tab.getAttribute("fadein"), "true", "newly opened tab is yet to fade in"); michael@0: michael@0: // Try to remove the tab right before the opening animation's first frame michael@0: window.mozRequestAnimationFrame(checkAnimationState); michael@0: } michael@0: michael@0: function checkAnimationState() { michael@0: is(tab.getAttribute("fadein"), "true", "tab opening animation initiated"); michael@0: michael@0: info(window.getComputedStyle(tab).maxWidth); michael@0: gBrowser.removeTab(tab, { animate: true }); michael@0: if (!tab.parentNode) { michael@0: ok(true, "tab removed synchronously since the opening animation hasn't moved yet"); michael@0: finish(); michael@0: return; michael@0: } michael@0: michael@0: info("tab didn't close immediately, so the tab opening animation must have started moving"); michael@0: info("waiting for the tab to close asynchronously"); michael@0: tab.addEventListener("transitionend", function (event) { michael@0: if (event.propertyName == "max-width") { michael@0: tab.removeEventListener("transitionend", arguments.callee, false); michael@0: executeSoon(function () { michael@0: ok(!tab.parentNode, "tab removed asynchronously"); michael@0: finish(); michael@0: }); michael@0: } michael@0: }, false); michael@0: }