fune/browser/base/content/test/general/browser_bug491431.js
Kris Maglione 1937bcbcae Bug 1244496: Add more detail to TabOpen/TabClose events for tabs moved between windows. r=Gijs
MozReview-Commit-ID: 9YHaVlMW0T6

--HG--
extra : rebase_source : 711c8a60e334fc3619ab9c915f7735c3729e7782
extra : histedit_source : 0399daf10a516f1595bdd5cc9a6964b5d4220117
2016-02-10 17:52:53 -08:00

34 lines
1.1 KiB
JavaScript

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