diff --git a/browser/base/content/test/tabview/browser_tabview_rtl.js b/browser/base/content/test/tabview/browser_tabview_rtl.js index fa568ba6c7aa..50afbacb85eb 100644 --- a/browser/base/content/test/tabview/browser_tabview_rtl.js +++ b/browser/base/content/test/tabview/browser_tabview_rtl.js @@ -1,8 +1,6 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -let tabViewShownCount = 0; - // ---------- function test() { waitForExplicitFinish(); @@ -10,20 +8,12 @@ function test() { // verify initial state ok(!TabView.isVisible(), "Tab View starts hidden"); - // use the Tab View button to launch it for the first time - window.addEventListener("tabviewshown", onTabViewLoadedAndShown("ltr"), false); - toggleTabView(); -} - -function toggleTabView() { - let tabViewCommand = document.getElementById("Browser:ToggleTabView"); - tabViewCommand.doCommand(); + showTabView(onTabViewLoadedAndShown("ltr")); } // ---------- function onTabViewLoadedAndShown(dir) { return function() { - window.removeEventListener("tabviewshown", arguments.callee, false); ok(TabView.isVisible(), "Tab View is visible."); let contentWindow = document.getElementById("tab-view").contentWindow; @@ -32,24 +22,20 @@ function onTabViewLoadedAndShown(dir) { "The direction should be set to " + dir.toUpperCase()); // kick off the series - window.addEventListener("tabviewhidden", onTabViewHidden(dir), false); - TabView.toggle(); + hideTabView(onTabViewHidden(dir)); }; } // ---------- function onTabViewHidden(dir) { return function() { - window.removeEventListener("tabviewhidden", arguments.callee, false); ok(!TabView.isVisible(), "Tab View is hidden."); if (dir == "ltr") { // Switch to RTL mode Services.prefs.setCharPref("intl.uidirection.en-US", "rtl"); - // use the Tab View button to launch it for the second time - window.addEventListener("tabviewshown", onTabViewLoadedAndShown("rtl"), false); - toggleTabView(); + showTabView(onTabViewLoadedAndShown("rtl")); } else { // Switch to LTR mode Services.prefs.clearUserPref("intl.uidirection.en-US"); @@ -58,4 +44,3 @@ function onTabViewHidden(dir) { } }; } -