|
1 var tab; |
|
2 |
|
3 function test() { |
|
4 waitForExplicitFinish(); |
|
5 |
|
6 tab = gBrowser.addTab(); |
|
7 isnot(tab.getAttribute("fadein"), "true", "newly opened tab is yet to fade in"); |
|
8 |
|
9 // Try to remove the tab right before the opening animation's first frame |
|
10 window.mozRequestAnimationFrame(checkAnimationState); |
|
11 } |
|
12 |
|
13 function checkAnimationState() { |
|
14 is(tab.getAttribute("fadein"), "true", "tab opening animation initiated"); |
|
15 |
|
16 info(window.getComputedStyle(tab).maxWidth); |
|
17 gBrowser.removeTab(tab, { animate: true }); |
|
18 if (!tab.parentNode) { |
|
19 ok(true, "tab removed synchronously since the opening animation hasn't moved yet"); |
|
20 finish(); |
|
21 return; |
|
22 } |
|
23 |
|
24 info("tab didn't close immediately, so the tab opening animation must have started moving"); |
|
25 info("waiting for the tab to close asynchronously"); |
|
26 tab.addEventListener("transitionend", function (event) { |
|
27 if (event.propertyName == "max-width") { |
|
28 tab.removeEventListener("transitionend", arguments.callee, false); |
|
29 executeSoon(function () { |
|
30 ok(!tab.parentNode, "tab removed asynchronously"); |
|
31 finish(); |
|
32 }); |
|
33 } |
|
34 }, false); |
|
35 } |