2010-10-25 03:06:45 -07:00
|
|
|
var tab;
|
|
|
|
|
2010-10-21 23:29:17 -07:00
|
|
|
function test() {
|
|
|
|
waitForExplicitFinish();
|
2010-10-25 00:59:42 -07:00
|
|
|
|
2010-10-25 03:06:45 -07:00
|
|
|
tab = gBrowser.addTab();
|
2013-04-03 07:05:56 -07:00
|
|
|
isnot(tab.getAttribute("fadein"), "true", "newly opened tab is yet to fade in");
|
2010-10-25 00:59:42 -07:00
|
|
|
|
2010-10-26 05:23:40 -07:00
|
|
|
// Try to remove the tab right before the opening animation's first frame
|
2010-10-25 03:06:45 -07:00
|
|
|
window.mozRequestAnimationFrame(checkAnimationState);
|
|
|
|
}
|
|
|
|
|
|
|
|
function checkAnimationState() {
|
2013-04-03 07:05:56 -07:00
|
|
|
is(tab.getAttribute("fadein"), "true", "tab opening animation initiated");
|
|
|
|
|
2010-10-25 03:06:45 -07:00
|
|
|
info(window.getComputedStyle(tab).maxWidth);
|
2010-10-26 05:23:40 -07:00
|
|
|
gBrowser.removeTab(tab, { animate: true });
|
|
|
|
if (!tab.parentNode) {
|
|
|
|
ok(true, "tab removed synchronously since the opening animation hasn't moved yet");
|
|
|
|
finish();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
info("tab didn't close immediately, so the tab opening animation must have started moving");
|
|
|
|
info("waiting for the tab to close asynchronously");
|
|
|
|
tab.addEventListener("transitionend", function (event) {
|
2011-06-07 07:45:26 -07:00
|
|
|
if (event.propertyName == "max-width") {
|
|
|
|
tab.removeEventListener("transitionend", arguments.callee, false);
|
2010-10-26 05:23:40 -07:00
|
|
|
executeSoon(function () {
|
|
|
|
ok(!tab.parentNode, "tab removed asynchronously");
|
|
|
|
finish();
|
|
|
|
});
|
2011-06-07 07:45:26 -07:00
|
|
|
}
|
2010-10-26 05:23:40 -07:00
|
|
|
}, false);
|
2010-10-21 23:29:17 -07:00
|
|
|
}
|