summaryrefslogtreecommitdiffstats
path: root/dom/u2f/tests/test_bind.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /dom/u2f/tests/test_bind.html
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--dom/u2f/tests/test_bind.html36
1 files changed, 36 insertions, 0 deletions
diff --git a/dom/u2f/tests/test_bind.html b/dom/u2f/tests/test_bind.html
new file mode 100644
index 0000000000..ca02a73f0e
--- /dev/null
+++ b/dom/u2f/tests/test_bind.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Test that bind() can be called on u2f.register/sign</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
+ <script>
+ SimpleTest.waitForExplicitFinish();
+ SpecialPowers.pushPrefEnv({ "set": [["security.webauth.u2f", true]] },
+ doTest);
+ function doTest() {
+ // For some reason, exceptions from inside here do not cause a test
+ // failure! Run the actual code we want off something that will report
+ // errors properly.
+ SimpleTest.executeSoon(function() {
+ // Need a new global for the pref to really take effect.
+ var iframe = document.createElement("iframe");
+ document.documentElement.appendChild(iframe);
+ var win = iframe.contentWindow;
+ is(typeof(win.u2f.register.bind(win.u2f)), "function",
+ "Should be able to bind u2f.register");
+ is(typeof(win.u2f.sign.bind(win.u2f)), "function",
+ "Should be able to bind u2f.sign");
+ iframe.remove();
+ SimpleTest.finish();
+ });
+ }
+ </script>
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+</body>
+</html>