diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /dom/quota/test/browser/browser_permissionsCrossOrigin.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream/115.8.0esr.tar.xz firefox-esr-upstream/115.8.0esr.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/quota/test/browser/browser_permissionsCrossOrigin.js')
-rw-r--r-- | dom/quota/test/browser/browser_permissionsCrossOrigin.js | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/dom/quota/test/browser/browser_permissionsCrossOrigin.js b/dom/quota/test/browser/browser_permissionsCrossOrigin.js new file mode 100644 index 0000000000..759eff73a3 --- /dev/null +++ b/dom/quota/test/browser/browser_permissionsCrossOrigin.js @@ -0,0 +1,56 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +const emptyURL = + "https://example.com/browser/dom/quota/test/browser/empty.html"; + +addTest(async function testNoPermissionPrompt() { + registerPopupEventHandler("popupshowing", function () { + ok(false, "Shouldn't show a popup this time"); + }); + registerPopupEventHandler("popupshown", function () { + ok(false, "Shouldn't show a popup this time"); + }); + registerPopupEventHandler("popuphidden", function () { + ok(false, "Shouldn't show a popup this time"); + }); + + info("Creating tab"); + + await BrowserTestUtils.withNewTab(emptyURL, async function (browser) { + await new Promise(r => { + SpecialPowers.pushPrefEnv( + { + set: [ + ["permissions.delegation.enabled", true], + ["dom.security.featurePolicy.header.enabled", true], + ["dom.security.featurePolicy.webidl.enabled", true], + ], + }, + r + ); + }); + + await SpecialPowers.spawn(browser, [], async function (host0) { + let frame = content.document.createElement("iframe"); + // Cross origin src + frame.src = "https://example.org/browser/dom/quota/test/empty.html"; + content.document.body.appendChild(frame); + await ContentTaskUtils.waitForEvent(frame, "load"); + + await content.SpecialPowers.spawn(frame, [], async function () { + // Request a permission. + const persistAllowed = await this.content.navigator.storage.persist(); + Assert.ok( + !persistAllowed, + "navigator.storage.persist() has been denied" + ); + }); + content.document.body.removeChild(frame); + }); + }); + + unregisterAllPopupEventHandlers(); +}); |