|
1 /* vim: set ts=2 et sw=2 tw=80: */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 "use strict"; |
|
7 |
|
8 function test() { |
|
9 runTests(); |
|
10 } |
|
11 |
|
12 gTests.push({ |
|
13 desc: "Private tab sanity check", |
|
14 run: function() { |
|
15 let tab = Browser.addTab("about:mozilla"); |
|
16 is(tab.isPrivate, false, "Tabs are not private by default"); |
|
17 is(tab.chromeTab.hasAttribute("private"), false, |
|
18 "non-private tab has no private attribute"); |
|
19 |
|
20 let child = Browser.addTab("about:mozilla", false, tab); |
|
21 is(child.isPrivate, false, "Child of a non-private tab is not private"); |
|
22 |
|
23 Browser.closeTab(child, { forceClose: true }); |
|
24 Browser.closeTab(tab, { forceClose: true }); |
|
25 |
|
26 tab = Browser.addTab("about:mozilla", false, null, { private: true }); |
|
27 is(tab.isPrivate, true, "Create a private tab"); |
|
28 is(tab.chromeTab.getAttribute("private"), "true", |
|
29 "private tab has private attribute"); |
|
30 |
|
31 child = Browser.addTab("about:mozilla", false, tab); |
|
32 is(child.isPrivate, true, "Child of a private tab is private"); |
|
33 |
|
34 Browser.closeTab(child, { forceClose: true }); |
|
35 Browser.closeTab(tab, { forceClose: true }); |
|
36 } |
|
37 }); |