Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | function test() { |
michael@0 | 5 | waitForExplicitFinish(); |
michael@0 | 6 | |
michael@0 | 7 | window.addEventListener("tabviewshown", onTabViewWindowLoaded, false); |
michael@0 | 8 | TabView.toggle(); |
michael@0 | 9 | } |
michael@0 | 10 | |
michael@0 | 11 | let moves = 0; |
michael@0 | 12 | let contentWindow = null; |
michael@0 | 13 | let newTabs = []; |
michael@0 | 14 | let originalTab = null; |
michael@0 | 15 | |
michael@0 | 16 | function onTabMove(e) { |
michael@0 | 17 | let tab = e.target; |
michael@0 | 18 | moves++; |
michael@0 | 19 | } |
michael@0 | 20 | |
michael@0 | 21 | function onTabViewWindowLoaded() { |
michael@0 | 22 | window.removeEventListener("tabviewshown", onTabViewWindowLoaded, false); |
michael@0 | 23 | |
michael@0 | 24 | contentWindow = document.getElementById("tab-view").contentWindow; |
michael@0 | 25 | |
michael@0 | 26 | originalTab = gBrowser.selectedTab; |
michael@0 | 27 | newTabs = [gBrowser.addTab("about:rights"), gBrowser.addTab("about:mozilla"), gBrowser.addTab("about:license")]; |
michael@0 | 28 | |
michael@0 | 29 | is(originalTab._tPos, 0, "Original tab is in position 0"); |
michael@0 | 30 | is(newTabs[0]._tPos, 1, "Rights is in position 1"); |
michael@0 | 31 | is(newTabs[1]._tPos, 2, "Mozilla is in position 2"); |
michael@0 | 32 | is(newTabs[2]._tPos, 3, "License is in position 3"); |
michael@0 | 33 | |
michael@0 | 34 | gBrowser.tabContainer.addEventListener("TabMove", onTabMove, false); |
michael@0 | 35 | |
michael@0 | 36 | let groupItem = contentWindow.GroupItems.getActiveGroupItem(); |
michael@0 | 37 | |
michael@0 | 38 | // move 3 > 0 (and therefore 0 > 1, 1 > 2, 2 > 3) |
michael@0 | 39 | groupItem._children.splice(0, 0, groupItem._children.splice(3, 1)[0]); |
michael@0 | 40 | groupItem.arrange(); |
michael@0 | 41 | |
michael@0 | 42 | window.addEventListener("tabviewhidden", onTabViewWindowHidden, false); |
michael@0 | 43 | TabView.toggle(); |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | function onTabViewWindowHidden() { |
michael@0 | 47 | window.removeEventListener("tabviewhidden", onTabViewWindowHidden, false); |
michael@0 | 48 | gBrowser.tabContainer.removeEventListener("TabMove", onTabMove, false); |
michael@0 | 49 | |
michael@0 | 50 | is(moves, 1, "Only one move should be necessary for this basic move."); |
michael@0 | 51 | |
michael@0 | 52 | is(newTabs[2]._tPos, 0, "License is in position 0"); |
michael@0 | 53 | is(originalTab._tPos, 1, "Original tab is in position 1"); |
michael@0 | 54 | is(newTabs[0]._tPos, 2, "Rights is in position 2"); |
michael@0 | 55 | is(newTabs[1]._tPos, 3, "Mozilla is in position 3"); |
michael@0 | 56 | |
michael@0 | 57 | gBrowser.removeTab(newTabs[0]); |
michael@0 | 58 | gBrowser.removeTab(newTabs[1]); |
michael@0 | 59 | gBrowser.removeTab(newTabs[2]); |
michael@0 | 60 | finish(); |
michael@0 | 61 | } |