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 | let state1 = { |
michael@0 | 5 | windows: [{ |
michael@0 | 6 | tabs: [{ |
michael@0 | 7 | entries: [{ url: "about:blank#1" }], |
michael@0 | 8 | hidden: true, |
michael@0 | 9 | extData: {"tabview-tab": '{"url":"about:blank#1","groupID":1,"bounds":{"left":120,"top":20,"width":20,"height":20}}'} |
michael@0 | 10 | },{ |
michael@0 | 11 | entries: [{ url: "about:blank#2" }], |
michael@0 | 12 | hidden: false, |
michael@0 | 13 | extData: {"tabview-tab": '{"url":"about:blank#2","groupID":2,"bounds":{"left":20,"top":20,"width":20,"height":20}}'}, |
michael@0 | 14 | }], |
michael@0 | 15 | selected: 2, |
michael@0 | 16 | extData: { |
michael@0 | 17 | "tabview-groups": '{"nextID":3,"activeGroupId":2, "totalNumber":2}', |
michael@0 | 18 | "tabview-group": |
michael@0 | 19 | '{"1":{"bounds":{"left":15,"top":5,"width":280,"height":232},"id":1},' + |
michael@0 | 20 | '"2":{"bounds":{"left":309,"top":5,"width":267,"height":226},"id":2}}' |
michael@0 | 21 | } |
michael@0 | 22 | }] |
michael@0 | 23 | }; |
michael@0 | 24 | |
michael@0 | 25 | let state2 = { |
michael@0 | 26 | windows: [{ |
michael@0 | 27 | tabs: [{entries: [{ url: "about:blank#1" }], hidden: true}, |
michael@0 | 28 | {entries: [{ url: "about:blank#2" }], hidden: false}], |
michael@0 | 29 | selected: 2 |
michael@0 | 30 | }] |
michael@0 | 31 | }; |
michael@0 | 32 | |
michael@0 | 33 | let ss = Cc["@mozilla.org/browser/sessionstore;1"] |
michael@0 | 34 | .getService(Ci.nsISessionStore); |
michael@0 | 35 | |
michael@0 | 36 | function test() { |
michael@0 | 37 | waitForExplicitFinish(); |
michael@0 | 38 | |
michael@0 | 39 | newWindowWithState(state1, function (win) { |
michael@0 | 40 | registerCleanupFunction(function () win.close()); |
michael@0 | 41 | |
michael@0 | 42 | showTabView(function () { |
michael@0 | 43 | let cw = win.TabView.getContentWindow(); |
michael@0 | 44 | let [group1, group2] = cw.GroupItems.groupItems; |
michael@0 | 45 | let [tab1, tab2] = win.gBrowser.tabs; |
michael@0 | 46 | |
michael@0 | 47 | checkUrl(group1.getChild(0), "about:blank#1", "tab1 is in first group"); |
michael@0 | 48 | checkUrl(group2.getChild(0), "about:blank#2", "tab2 is in second group"); |
michael@0 | 49 | |
michael@0 | 50 | whenWindowStateReady(win, function () { |
michael@0 | 51 | let groups = cw.GroupItems.groupItems; |
michael@0 | 52 | is(groups.length, 1, "one groupItem"); |
michael@0 | 53 | is(groups[0].getChildren().length, 2, "single groupItem has two children"); |
michael@0 | 54 | |
michael@0 | 55 | finish(); |
michael@0 | 56 | }); |
michael@0 | 57 | |
michael@0 | 58 | ss.setWindowState(win, JSON.stringify(state2), true); |
michael@0 | 59 | }, win); |
michael@0 | 60 | }); |
michael@0 | 61 | } |
michael@0 | 62 | |
michael@0 | 63 | function checkUrl(aTabItem, aUrl, aMsg) { |
michael@0 | 64 | is(aTabItem.tab.linkedBrowser.currentURI.spec, aUrl, aMsg); |
michael@0 | 65 | } |