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/components/uitour/test/browser_UITour_private_browsing.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 'browser/components/uitour/test/browser_UITour_private_browsing.js')
-rw-r--r-- | browser/components/uitour/test/browser_UITour_private_browsing.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/browser/components/uitour/test/browser_UITour_private_browsing.js b/browser/components/uitour/test/browser_UITour_private_browsing.js new file mode 100644 index 0000000000..0c5a52f667 --- /dev/null +++ b/browser/components/uitour/test/browser_UITour_private_browsing.js @@ -0,0 +1,38 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +/** + * Tests that UITour will work in private browsing windows with + * tabs pointed at sites that have the uitour permission set to + * allowed. + */ +add_task(async function test_privatebrowsing_window() { + // These two constants point to origins that have a default + // uitour allow entry in browser/app/permissions. The expectation is + // that these defaults are special, in that they'll apply for both + // private and non-private contexts. + const ABOUT_ORIGIN_WITH_UITOUR_DEFAULT = "about:newtab"; + const HTTPS_ORIGIN_WITH_UITOUR_DEFAULT = "https://www.mozilla.org"; + + let win = await BrowserTestUtils.openNewBrowserWindow({ private: true }); + let browser = win.gBrowser.selectedBrowser; + + for (let uri of [ + ABOUT_ORIGIN_WITH_UITOUR_DEFAULT, + HTTPS_ORIGIN_WITH_UITOUR_DEFAULT, + ]) { + BrowserTestUtils.startLoadingURIString(browser, uri); + await BrowserTestUtils.browserLoaded(browser); + + await SpecialPowers.spawn(browser, [], async () => { + let actor = content.windowGlobalChild.getActor("UITour"); + Assert.ok( + actor.ensureTrustedOrigin(), + "Page should be considered trusted for UITour." + ); + }); + } + await BrowserTestUtils.closeWindow(win); +}); |