dom/tests/mochitest/crypto/test_legacy.html

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

mercurial