browser/base/content/test/general/browser_tab_dragdrop2.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial