browser/base/content/test/general/browser_bug585785.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial