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