dom/tests/mochitest/crypto/test_legacy.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <head>
michael@0 4 <title>Test presence of legacy window.crypto features when
michael@0 5 MOZ_DISABLE_CRYPTOLEGACY is NOT set.</title>
michael@0 6 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 8 </head>
michael@0 9 <body>
michael@0 10 <script class="testbody" type="text/javascript">
michael@0 11
michael@0 12 ok("crypto" in window, "crypto in window");
michael@0 13 ok("version" in window.crypto, "version in window.crypto");
michael@0 14 ok("enableSmartCardEvents" in window.crypto,
michael@0 15 "enableSmartCardEvents in window.crypto");
michael@0 16 ok("generateCRMFRequest" in window.crypto,
michael@0 17 "generateCRMFRequest in window.crypto");
michael@0 18 ok("importUserCertificates" in window.crypto,
michael@0 19 "importUserCertificates in window.crypto");
michael@0 20 ok("signText" in window.crypto, "signText in window.crypto");
michael@0 21
michael@0 22 function jsCallback () {
michael@0 23 }
michael@0 24
michael@0 25 try {
michael@0 26 window.crypto.generateCRMFRequest(null, null, null, null, jsCallback.toString());
michael@0 27 ok(false, "window.crypto.generateCRMFRequest failed, should throw error");
michael@0 28 } catch (e) {
michael@0 29 ok(e.toString().search(/Failure/) > -1,
michael@0 30 "Expected error: ReqDN cannot be null");
michael@0 31 }
michael@0 32
michael@0 33 try {
michael@0 34 window.crypto.generateCRMFRequest(document.documentElement, null, null, null,
michael@0 35 null);
michael@0 36 ok(false, "window.crypto.generateCRMFRequest failed, should throw error");
michael@0 37 } catch (e) {
michael@0 38 ok(e.toString().search(/Failure/) > -1,
michael@0 39 "Expected error: jsCallback cannot be null");
michael@0 40 }
michael@0 41
michael@0 42 try {
michael@0 43 window.crypto.generateCRMFRequest(document.documentElement, null, null, null,
michael@0 44 jsCallback.toString(), 1024);
michael@0 45 ok(false, "window.crypto.generateCRMFRequest failed, should throw error");
michael@0 46 } catch (e) {
michael@0 47 ok(e.toString().search(/TypeError/) > -1,
michael@0 48 "Expected error: Not enough arguments");
michael@0 49 }
michael@0 50 </script>
michael@0 51 </body></html>

mercurial