summaryrefslogtreecommitdiffstats
path: root/dom/localstorage/test/unit/test_clientValidation.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /dom/localstorage/test/unit/test_clientValidation.js
parentInitial commit. (diff)
downloadfirefox-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/localstorage/test/unit/test_clientValidation.js')
-rw-r--r--dom/localstorage/test/unit/test_clientValidation.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/dom/localstorage/test/unit/test_clientValidation.js b/dom/localstorage/test/unit/test_clientValidation.js
new file mode 100644
index 0000000000..26dc2bfdf7
--- /dev/null
+++ b/dom/localstorage/test/unit/test_clientValidation.js
@@ -0,0 +1,32 @@
+/**
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+/**
+ * Because this is an xpcshell global, it does not have an associated client id.
+ * We turn on client validation for LocalStorage and ensure that we don't have
+ * access to LocalStorage.
+ */
+add_task(async function testSteps() {
+ const principal = getPrincipal("http://example.com");
+
+ info("Setting prefs");
+
+ Services.prefs.setBoolPref(
+ "dom.storage.enable_unsupported_legacy_implementation",
+ false
+ );
+ Services.prefs.setBoolPref("dom.storage.client_validation", true);
+
+ info("Getting storage");
+
+ try {
+ getLocalStorage(principal);
+ ok(false, "Should have thrown");
+ } catch (ex) {
+ ok(true, "Did throw");
+ is(ex.name, "NS_ERROR_FAILURE", "Threw right Exception");
+ is(ex.result, Cr.NS_ERROR_FAILURE, "Threw with right result");
+ }
+});