michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: let testPage = "data:text/plain,test bug 491431 Page"; michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: let newWin, tabA, tabB; michael@0: michael@0: // test normal close michael@0: tabA = gBrowser.addTab(testPage); michael@0: gBrowser.tabContainer.addEventListener("TabClose", function(aEvent) { michael@0: gBrowser.tabContainer.removeEventListener("TabClose", arguments.callee, true); michael@0: ok(!aEvent.detail, "This was a normal tab close"); michael@0: michael@0: // test tab close by moving michael@0: tabB = gBrowser.addTab(testPage); michael@0: gBrowser.tabContainer.addEventListener("TabClose", function(aEvent) { michael@0: gBrowser.tabContainer.removeEventListener("TabClose", arguments.callee, true); michael@0: executeSoon(function() { michael@0: ok(aEvent.detail, "This was a tab closed by moving"); michael@0: michael@0: // cleanup michael@0: newWin.close(); michael@0: executeSoon(finish); michael@0: }); michael@0: }, true); michael@0: newWin = gBrowser.replaceTabWithWindow(tabB); michael@0: }, true); michael@0: gBrowser.removeTab(tabA); michael@0: } michael@0: