dom/u2f/tests/test_multiple_keys.html
author J.C. Jones <jjones@mozilla.com>
Thu, 26 Jan 2017 15:18:50 -0700
changeset 380270 456d27bbbe7429efb8c7df47820353af7dabd424
child 395196 d38ae6ee4f4f14a439bbbb1694a7dab6191cb416
permissions -rw-r--r--
Bug 1333592 - Fix a regression with U2F sign() called with multiple keys r=keeler Add a test that U2F supports signing with multiple keys. Reorder the WaitGroupDone calls to ensure they always fire, even if there are multiple actions in flight. Also, change the status lanbda captures to capture by reference, and disable the copy constructor that would let the by-value work. Interestingly, the compiler is choosing by-reference by default -- at least logs show that the behavior is correct without this change, but still - this is the right thing to do. Updated: Fix the unit tests and write a README that explains why they have to use an iframe, while WebAuthn tests do not. MozReview-Commit-ID: AqSyxU5N4yu

<!DOCTYPE html>
<meta charset=utf-8>
<head>
  <title>Test for Multiple Keys for FIDO U2F</title>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <script src="u2futil.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>

<h1>Test Multiple Keys for FIDO U2F</h1>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1333592">Mozilla Bug 1333592</a>

<script class="testbody" type="text/javascript">
"use strict";

 /** Test for XBL scope behavior. **/
SimpleTest.waitForExplicitFinish();

// Embed the real test. It will take care of everything else.
//
// This is necessary since the U2F object on window is hidden behind a preference
// and window won't pick up changes by pref without a reload.
SpecialPowers.pushPrefEnv({"set": [["security.webauth.u2f", true],
                                   ["security.webauth.u2f_enable_softtoken", true],
                                   ["security.webauth.u2f_enable_usbtoken", false]]},
function() {
  // listen for messages from the test harness
  window.addEventListener("message", handleEventMessage);
  document.getElementById('testing_frame').src = "frame_multiple_keys.html";
});
</script>

<div id="framediv">
  <iframe id="testing_frame"></iframe>
</div>

</body>
</html>