dom/tests/mochitest/crypto/test_legacy.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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">
    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");
    22 function jsCallback () {
    23 }
    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 }
    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 }
    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