diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /browser/base/content/test/pageinfo/browser_pageinfo_separate_private.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | browser/base/content/test/pageinfo/browser_pageinfo_separate_private.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/browser/base/content/test/pageinfo/browser_pageinfo_separate_private.js b/browser/base/content/test/pageinfo/browser_pageinfo_separate_private.js new file mode 100644 index 0000000000..ac93b7ddb2 --- /dev/null +++ b/browser/base/content/test/pageinfo/browser_pageinfo_separate_private.js @@ -0,0 +1,49 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + **/ + +add_task(async function () { + let tab = await BrowserTestUtils.openNewForegroundTab( + gBrowser, + "https://example.com" + ); + let browser = tab.linkedBrowser; + let pageInfo = BrowserPageInfo(browser.currentURI.spec); + await BrowserTestUtils.waitForEvent(pageInfo, "page-info-init"); + Assert.strictEqual( + pageInfo.docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing, + false, + "non-private window opened private page info window" + ); + + let privateWindow = await BrowserTestUtils.openNewBrowserWindow({ + private: true, + }); + let privateTab = await BrowserTestUtils.openNewForegroundTab( + privateWindow.gBrowser, + "https://example.com" + ); + let privateBrowser = privateTab.linkedBrowser; + let privatePageInfo = privateWindow.BrowserPageInfo( + privateBrowser.currentURI.spec + ); + await BrowserTestUtils.waitForEvent(privatePageInfo, "page-info-init"); + Assert.strictEqual( + privatePageInfo.docShell.QueryInterface(Ci.nsILoadContext) + .usePrivateBrowsing, + true, + "private window opened non-private page info window" + ); + + Assert.notEqual( + pageInfo, + privatePageInfo, + "private and non-private windows shouldn't have shared the same page info window" + ); + pageInfo.close(); + privatePageInfo.close(); + BrowserTestUtils.removeTab(tab); + BrowserTestUtils.removeTab(privateTab); + await BrowserTestUtils.closeWindow(privateWindow); +}); |