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 function test()
2 {
3 waitForExplicitFinish();
5 var level1 = false;
6 var level2 = false;
7 function test1() {
8 // Load the following URI (which runs some child popup tests) in a new window (B),
9 // then add a blank tab to B and call replaceTabWithWindow to detach the URI tab
10 // into yet a new window (C), then close B.
11 // Now run the tests again and then close C.
12 // The test results does not matter, all this is just to exercise some code to
13 // catch assertions or crashes.
14 var chromeroot = getRootDirectory(gTestPath);
15 var uri = chromeroot + "browser_tab_dragdrop2_frame1.xul";
16 let window_B = openDialog(location, "_blank", "chrome,all,dialog=no,left=200,top=200,width=200,height=200", uri);
17 window_B.addEventListener("load", function(aEvent) {
18 window_B.removeEventListener("load", arguments.callee, false);
19 if (level1) return; level1=true;
20 executeSoon(function () {
21 window_B.gBrowser.addEventListener("load", function(aEvent) {
22 window_B.removeEventListener("load", arguments.callee, true);
23 if (level2) return; level2=true;
24 is(window_B.gBrowser.getBrowserForTab(window_B.gBrowser.tabs[0]).contentWindow.location, uri, "sanity check");
25 //alert("1:"+window_B.gBrowser.getBrowserForTab(window_B.gBrowser.tabs[0]).contentWindow.location);
26 var windowB_tab2 = window_B.gBrowser.addTab("about:blank", {skipAnimation: true});
27 setTimeout(function () {
28 //alert("2:"+window_B.gBrowser.getBrowserForTab(window_B.gBrowser.tabs[0]).contentWindow.location);
29 window_B.gBrowser.addEventListener("pagehide", function(aEvent) {
30 window_B.gBrowser.removeEventListener("pagehide", arguments.callee, true);
31 executeSoon(function () {
32 // alert("closing window_B which has "+ window_B.gBrowser.tabs.length+" tabs\n"+
33 // window_B.gBrowser.getBrowserForTab(window_B.gBrowser.tabs[0]).contentWindow.location);
34 window_B.close();
36 var doc = window_C.gBrowser.getBrowserForTab(window_C.gBrowser.tabs[0])
37 .docShell.contentViewer.DOMDocument;
38 var calls = doc.defaultView.test_panels();
39 window_C.close();
40 finish();
41 });
42 }, true);
43 window_B.gBrowser.selectedTab = window_B.gBrowser.tabs[0];
44 var window_C = window_B.gBrowser.replaceTabWithWindow(window_B.gBrowser.tabs[0]);
45 }, 1000); // 1 second to allow the tests to create the popups
46 }, true);
47 });
48 }, false);
49 }
51 test1();
52 }