browser_bug585785.js (1147B)
1 var tab; 2 3 function test() { 4 waitForExplicitFinish(); 5 6 // Force-enable tab animations 7 gReduceMotionOverride = false; 8 9 tab = BrowserTestUtils.addTab(gBrowser); 10 isnot( 11 tab.getAttribute("fadein"), 12 "true", 13 "newly opened tab is yet to fade in" 14 ); 15 16 // Try to remove the tab right before the opening animation's first frame 17 window.requestAnimationFrame(checkAnimationState); 18 } 19 20 function checkAnimationState() { 21 is(tab.getAttribute("fadein"), "true", "tab opening animation initiated"); 22 23 info(window.getComputedStyle(tab).maxWidth); 24 gBrowser.removeTab(tab, { animate: true }); 25 if (!tab.parentNode) { 26 ok( 27 true, 28 "tab removed synchronously since the opening animation hasn't moved yet" 29 ); 30 finish(); 31 return; 32 } 33 34 info( 35 "tab didn't close immediately, so the tab opening animation must have started moving" 36 ); 37 info("waiting for the tab to close asynchronously"); 38 tab.addEventListener( 39 "TabAnimationEnd", 40 function listener() { 41 executeSoon(function () { 42 ok(!tab.parentNode, "tab removed asynchronously"); 43 finish(); 44 }); 45 }, 46 { once: true } 47 ); 48 }