From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../browser/browser_privatebrowsing_theming.js | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 browser/components/privatebrowsing/test/browser/browser_privatebrowsing_theming.js (limited to 'browser/components/privatebrowsing/test/browser/browser_privatebrowsing_theming.js') diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_theming.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_theming.js new file mode 100644 index 0000000000..18b398e961 --- /dev/null +++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_theming.js @@ -0,0 +1,46 @@ +/* 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/. */ + +// This test makes sure that privatebrowsingmode attribute of the window is correctly +// adjusted based on whether the window is a private window. + +var windowsToClose = []; +function testOnWindow(options, callback) { + var win = OpenBrowserWindow(options); + win.addEventListener( + "load", + function () { + windowsToClose.push(win); + executeSoon(() => callback(win)); + }, + { once: true } + ); +} + +registerCleanupFunction(function () { + windowsToClose.forEach(function (win) { + win.close(); + }); +}); + +function test() { + // initialization + waitForExplicitFinish(); + + ok( + !document.documentElement.hasAttribute("privatebrowsingmode"), + "privatebrowsingmode should not be present in normal mode" + ); + + // open a private window + testOnWindow({ private: true }, function (win) { + is( + win.document.documentElement.getAttribute("privatebrowsingmode"), + "temporary", + 'privatebrowsingmode should be "temporary" inside the private browsing mode' + ); + + finish(); + }); +} -- cgit v1.2.3