browser/metro/base/tests/mochitest/browser_private_browsing.js

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

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

mercurial