summaryrefslogtreecommitdiffstats
path: root/js/xpconnect/tests
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--js/xpconnect/tests/mochitest/mochitest.toml2
-rw-r--r--js/xpconnect/tests/mochitest/test_bug871887.html43
-rw-r--r--js/xpconnect/tests/unit/test_import_global_current.js2
-rw-r--r--js/xpconnect/tests/unit/test_scriptable_nsIClassInfo.js41
-rw-r--r--js/xpconnect/tests/unit/xpcshell.toml2
5 files changed, 44 insertions, 46 deletions
diff --git a/js/xpconnect/tests/mochitest/mochitest.toml b/js/xpconnect/tests/mochitest/mochitest.toml
index c57cb26890..bc0f1d97b7 100644
--- a/js/xpconnect/tests/mochitest/mochitest.toml
+++ b/js/xpconnect/tests/mochitest/mochitest.toml
@@ -200,8 +200,6 @@ skip-if = [
"http2",
]
-["test_bug871887.html"]
-
["test_bug912322.html"]
["test_bug916945.html"]
diff --git a/js/xpconnect/tests/mochitest/test_bug871887.html b/js/xpconnect/tests/mochitest/test_bug871887.html
deleted file mode 100644
index 082b2ae746..0000000000
--- a/js/xpconnect/tests/mochitest/test_bug871887.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=871887
--->
-<head>
- <meta charset="utf-8">
- <title>Test for Bug 871887</title>
- <script src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
- <script type="application/javascript">
-
- /** Test for Bug 871887 **/
- SimpleTest.waitForExplicitFinish();
-
- // NB: onstart ends up getting invoked twice, for mysterious and potentially-
- // IE6-related reasons.
- function checkpoint(invocant) {
- ok(true, "onstart called");
- is(invocant, $('llama'), "this-binding is correct");
- $('llama').loop = 1;
- $('llama').scrollDelay = 1;
- $('llama').scrollAmount = 500;
- }
-
- function done(invocant) {
- is(invocant, $('llama'), "this-binding is correct");
- ok(true, "onfinish called");
- SimpleTest.finish();
- }
-
- </script>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=871887">Mozilla Bug 871887</a>
-<p id="display"></p>
-<div id="content">
-<marquee id="llama" onstart="checkpoint(this);" onfinish="done(this);">Watch the Llama</marquee>
-</div>
-<pre id="test">
-</pre>
-</body>
-</html>
diff --git a/js/xpconnect/tests/unit/test_import_global_current.js b/js/xpconnect/tests/unit/test_import_global_current.js
index cf466a7391..59037512f3 100644
--- a/js/xpconnect/tests/unit/test_import_global_current.js
+++ b/js/xpconnect/tests/unit/test_import_global_current.js
@@ -204,7 +204,7 @@ ChromeUtils.importESModule("resource://test/es6module_import_error.js", {
`, sb);
} catch (e) {
caught = true;
- Assert.stringMatches(e.message, /import not found/);
+ Assert.stringMatches(e.message, /doesn't provide an export named/);
}
Assert.ok(caught);
});
diff --git a/js/xpconnect/tests/unit/test_scriptable_nsIClassInfo.js b/js/xpconnect/tests/unit/test_scriptable_nsIClassInfo.js
new file mode 100644
index 0000000000..161afcbb9b
--- /dev/null
+++ b/js/xpconnect/tests/unit/test_scriptable_nsIClassInfo.js
@@ -0,0 +1,41 @@
+/* Any copyright is dedicated to the Public Domain.
+https://creativecommons.org/publicdomain/zero/1.0/ */
+
+add_task(function () {
+ class TestClass {
+ QueryInterface = ChromeUtils.generateQI([
+ "nsIXPCTestInterfaceA",
+ "nsIClassInfo",
+ ]);
+
+ interfaces = [Ci.nsIXPCTestInterfaceA, Ci.nsIClassInfo, Ci.nsISupports];
+ contractID = "@mozilla.org/test/class;1";
+ classDescription = "description";
+ classID = Components.ID("{4da556d4-00fa-451a-a280-d2aec7c5f265}");
+ flags = 0;
+
+ name = "this is a test";
+ }
+
+ let instance = new TestClass();
+ Assert.ok(instance, "can create an instance");
+ Assert.ok(instance.QueryInterface(Ci.nsIClassInfo), "can QI to nsIClassInfo");
+
+ let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
+ registrar.registerFactory(
+ instance.classID,
+ instance.classDescription,
+ instance.contractID,
+ {
+ createInstance(iid) {
+ return instance.QueryInterface(iid);
+ },
+ }
+ );
+ Assert.ok(true, "successfully registered the factory");
+
+ let otherInstance = Cc["@mozilla.org/test/class;1"].createInstance(
+ Ci.nsIXPCTestInterfaceA
+ );
+ Assert.ok(otherInstance, "can create an instance via xpcom");
+});
diff --git a/js/xpconnect/tests/unit/xpcshell.toml b/js/xpconnect/tests/unit/xpcshell.toml
index 37274eba96..b7bc15afdc 100644
--- a/js/xpconnect/tests/unit/xpcshell.toml
+++ b/js/xpconnect/tests/unit/xpcshell.toml
@@ -358,6 +358,8 @@ head = "head_ongc.js"
["test_sandbox_name.js"]
+["test_scriptable_nsIClassInfo.js"]
+
["test_storage.js"]
["test_structuredClone.js"]