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.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 let newWin;
5 function test() {
6 let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
8 requestLongerTimeout(2);
9 waitForExplicitFinish();
11 // open a new window and setup the window state.
12 newWin = openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no", "about:blank");
13 newWin.addEventListener("load", function onLoad(event) {
14 this.removeEventListener("load", onLoad, false);
16 let newState = {
17 windows: [{
18 tabs: [{
19 entries: [{ "url": "about:blank" }],
20 hidden: true,
21 attributes: {},
22 extData: {
23 "tabview-tab":
24 '{"bounds":{"left":20,"top":35,"width":280,"height":210},' +
25 '"userSize":null,"url":"about:blank","groupID":1,' +
26 '"imageData":null,"title":null}'
27 }
28 },{
29 entries: [{ url: "about:blank" }],
30 index: 1,
31 hidden: false,
32 attributes: {},
33 extData: {
34 "tabview-tab":
35 '{"bounds":{"left":375,"top":35,"width":280,"height":210},' +
36 '"userSize":null,"url":"about:blank","groupID":2,' +
37 '"imageData":null,"title":null}'
38 }
39 }],
40 selected:2,
41 _closedTabs: [],
42 extData: {
43 "tabview-groups": '{"nextID":3,"activeGroupId":2}',
44 "tabview-group":
45 '{"1":{"bounds":{"left":15,"top":10,"width":320,"height":375},' +
46 '"userSize":null,"title":"","id":1},' +
47 '"2":{"bounds":{"left":380,"top":5,"width":320,"height":375},' +
48 '"userSize":null,"title":"","id":2}}',
49 "tabview-ui": '{"pageBounds":{"left":0,"top":0,"width":875,"height":650}}'
50 }, sizemode:"normal"
51 }]
52 };
53 ss.setWindowState(newWin, JSON.stringify(newState), true);
55 // add a new tab.
56 newWin.gBrowser.addTab();
57 is(newWin.gBrowser.tabs.length, 3, "There are 3 browser tabs");
59 let onTabViewShow = function() {
60 newWin.removeEventListener("tabviewshown", onTabViewShow, false);
62 let contentWindow = newWin.TabView.getContentWindow();
63 is(contentWindow.GroupItems.groupItems.length, 2, "Has two group items");
65 // clean up and finish
66 newWin.close();
68 finish();
69 }
70 newWin.addEventListener("tabviewshown", onTabViewShow, false);
71 waitForFocus(function() { newWin.TabView.toggle(); });
72 }, false);
73 }