|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 let testPage = "data:text/plain,test bug 491431 Page"; |
|
6 |
|
7 function test() { |
|
8 waitForExplicitFinish(); |
|
9 |
|
10 let newWin, tabA, tabB; |
|
11 |
|
12 // test normal close |
|
13 tabA = gBrowser.addTab(testPage); |
|
14 gBrowser.tabContainer.addEventListener("TabClose", function(aEvent) { |
|
15 gBrowser.tabContainer.removeEventListener("TabClose", arguments.callee, true); |
|
16 ok(!aEvent.detail, "This was a normal tab close"); |
|
17 |
|
18 // test tab close by moving |
|
19 tabB = gBrowser.addTab(testPage); |
|
20 gBrowser.tabContainer.addEventListener("TabClose", function(aEvent) { |
|
21 gBrowser.tabContainer.removeEventListener("TabClose", arguments.callee, true); |
|
22 executeSoon(function() { |
|
23 ok(aEvent.detail, "This was a tab closed by moving"); |
|
24 |
|
25 // cleanup |
|
26 newWin.close(); |
|
27 executeSoon(finish); |
|
28 }); |
|
29 }, true); |
|
30 newWin = gBrowser.replaceTabWithWindow(tabB); |
|
31 }, true); |
|
32 gBrowser.removeTab(tabA); |
|
33 } |
|
34 |