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 /dom/tests/mochitest/general/frameStoragePrevented.html | |
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 'dom/tests/mochitest/general/frameStoragePrevented.html')
-rw-r--r-- | dom/tests/mochitest/general/frameStoragePrevented.html | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/dom/tests/mochitest/general/frameStoragePrevented.html b/dom/tests/mochitest/general/frameStoragePrevented.html new file mode 100644 index 0000000000..693beff5a4 --- /dev/null +++ b/dom/tests/mochitest/general/frameStoragePrevented.html @@ -0,0 +1,47 @@ + +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>frame for storage prevented test</title> + +<script type="text/javascript" src="https://example.com/tests/dom/tests/mochitest/general/storagePermissionsUtils.js"></script> +<script type="text/javascript"> + + task(async function() { + // We shouldn't be able to access storage + await storagePrevented(); + + // This hash of the URI is set to #nullprincipal by the test if the current page has a null principal, + // and thus attempting to create a dedicated worker will throw + if (location.hash == "#nullprincipal") { + function createWorker() { + return new Promise((resolve, reject) => { + var w; + try { + w = new Worker("workerStoragePrevented.js"); + } catch (e) { + ok(true, "Running workers was prevented"); + resolve(); + } + + w.onerror = function() { + ok(true, "Running workers was prevented"); + resolve(); + } + }); + } + + await createWorker(); + return; + } + + // Try to run a worker, which shouldn't be able to access storage + await runWorker("workerStoragePrevented.js"); + }); + +</script> + +</head> + +<body> +</body> +</html> |