1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/base/content/test/general/browser_bug491431.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,34 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +let testPage = "data:text/plain,test bug 491431 Page"; 1.9 + 1.10 +function test() { 1.11 + waitForExplicitFinish(); 1.12 + 1.13 + let newWin, tabA, tabB; 1.14 + 1.15 + // test normal close 1.16 + tabA = gBrowser.addTab(testPage); 1.17 + gBrowser.tabContainer.addEventListener("TabClose", function(aEvent) { 1.18 + gBrowser.tabContainer.removeEventListener("TabClose", arguments.callee, true); 1.19 + ok(!aEvent.detail, "This was a normal tab close"); 1.20 + 1.21 + // test tab close by moving 1.22 + tabB = gBrowser.addTab(testPage); 1.23 + gBrowser.tabContainer.addEventListener("TabClose", function(aEvent) { 1.24 + gBrowser.tabContainer.removeEventListener("TabClose", arguments.callee, true); 1.25 + executeSoon(function() { 1.26 + ok(aEvent.detail, "This was a tab closed by moving"); 1.27 + 1.28 + // cleanup 1.29 + newWin.close(); 1.30 + executeSoon(finish); 1.31 + }); 1.32 + }, true); 1.33 + newWin = gBrowser.replaceTabWithWindow(tabB); 1.34 + }, true); 1.35 + gBrowser.removeTab(tabA); 1.36 +} 1.37 +