summaryrefslogtreecommitdiffstats
path: root/dom/indexedDB/test/unit/test_globalObjects_other.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /dom/indexedDB/test/unit/test_globalObjects_other.js
parentInitial commit. (diff)
downloadthunderbird-upstream.tar.xz
thunderbird-upstream.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/indexedDB/test/unit/test_globalObjects_other.js')
-rw-r--r--dom/indexedDB/test/unit/test_globalObjects_other.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/dom/indexedDB/test/unit/test_globalObjects_other.js b/dom/indexedDB/test/unit/test_globalObjects_other.js
new file mode 100644
index 0000000000..2687675689
--- /dev/null
+++ b/dom/indexedDB/test/unit/test_globalObjects_other.js
@@ -0,0 +1,54 @@
+/**
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+var testGenerator = testSteps();
+
+function* testSteps() {
+ function getSpec(filename) {
+ let file = do_get_file(filename);
+ let uri = Services.io.newFileURI(file);
+ return uri.spec;
+ }
+
+ // Test for IDBKeyRange and indexedDB availability in JS modules.
+ const { GlobalObjectsModule } = ChromeUtils.importESModule(
+ "resource://test/GlobalObjectsModule.sys.mjs"
+ );
+ let test = new GlobalObjectsModule();
+ test.ok = ok;
+ test.finishTest = continueToNextStep;
+ test.runTest();
+ yield undefined;
+
+ // Test for IDBKeyRange and indexedDB availability in JS sandboxes.
+ let principal = Cc["@mozilla.org/systemprincipal;1"].createInstance(
+ Ci.nsIPrincipal
+ );
+ let sandbox = new Cu.Sandbox(principal, {
+ wantGlobalProperties: ["indexedDB"],
+ });
+ sandbox.__SCRIPT_URI_SPEC__ = getSpec("GlobalObjectsSandbox.js");
+ Cu.evalInSandbox(
+ "Components.classes['@mozilla.org/moz/jssubscript-loader;1'] \
+ .createInstance(Components.interfaces.mozIJSSubScriptLoader) \
+ .loadSubScript(__SCRIPT_URI_SPEC__);",
+ sandbox,
+ "1.7"
+ );
+ sandbox.ok = ok;
+ sandbox.finishTest = continueToNextStep;
+ Cu.evalInSandbox("runTest();", sandbox);
+ yield undefined;
+
+ finishTest();
+ yield undefined;
+}
+
+this.runTest = function () {
+ do_get_profile();
+
+ do_test_pending();
+ testGenerator.next();
+};