1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/base/content/test/general/browser_tab_dragdrop2.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,52 @@ 1.4 +function test() 1.5 +{ 1.6 + waitForExplicitFinish(); 1.7 + 1.8 + var level1 = false; 1.9 + var level2 = false; 1.10 + function test1() { 1.11 + // Load the following URI (which runs some child popup tests) in a new window (B), 1.12 + // then add a blank tab to B and call replaceTabWithWindow to detach the URI tab 1.13 + // into yet a new window (C), then close B. 1.14 + // Now run the tests again and then close C. 1.15 + // The test results does not matter, all this is just to exercise some code to 1.16 + // catch assertions or crashes. 1.17 + var chromeroot = getRootDirectory(gTestPath); 1.18 + var uri = chromeroot + "browser_tab_dragdrop2_frame1.xul"; 1.19 + let window_B = openDialog(location, "_blank", "chrome,all,dialog=no,left=200,top=200,width=200,height=200", uri); 1.20 + window_B.addEventListener("load", function(aEvent) { 1.21 + window_B.removeEventListener("load", arguments.callee, false); 1.22 + if (level1) return; level1=true; 1.23 + executeSoon(function () { 1.24 + window_B.gBrowser.addEventListener("load", function(aEvent) { 1.25 + window_B.removeEventListener("load", arguments.callee, true); 1.26 + if (level2) return; level2=true; 1.27 + is(window_B.gBrowser.getBrowserForTab(window_B.gBrowser.tabs[0]).contentWindow.location, uri, "sanity check"); 1.28 + //alert("1:"+window_B.gBrowser.getBrowserForTab(window_B.gBrowser.tabs[0]).contentWindow.location); 1.29 + var windowB_tab2 = window_B.gBrowser.addTab("about:blank", {skipAnimation: true}); 1.30 + setTimeout(function () { 1.31 + //alert("2:"+window_B.gBrowser.getBrowserForTab(window_B.gBrowser.tabs[0]).contentWindow.location); 1.32 + window_B.gBrowser.addEventListener("pagehide", function(aEvent) { 1.33 + window_B.gBrowser.removeEventListener("pagehide", arguments.callee, true); 1.34 + executeSoon(function () { 1.35 + // alert("closing window_B which has "+ window_B.gBrowser.tabs.length+" tabs\n"+ 1.36 + // window_B.gBrowser.getBrowserForTab(window_B.gBrowser.tabs[0]).contentWindow.location); 1.37 + window_B.close(); 1.38 + 1.39 + var doc = window_C.gBrowser.getBrowserForTab(window_C.gBrowser.tabs[0]) 1.40 + .docShell.contentViewer.DOMDocument; 1.41 + var calls = doc.defaultView.test_panels(); 1.42 + window_C.close(); 1.43 + finish(); 1.44 + }); 1.45 + }, true); 1.46 + window_B.gBrowser.selectedTab = window_B.gBrowser.tabs[0]; 1.47 + var window_C = window_B.gBrowser.replaceTabWithWindow(window_B.gBrowser.tabs[0]); 1.48 + }, 1000); // 1 second to allow the tests to create the popups 1.49 + }, true); 1.50 + }); 1.51 + }, false); 1.52 + } 1.53 + 1.54 + test1(); 1.55 +}