| OLD | NEW |
| 1 <!DOCTYPE html> | 1 if (self.importScripts) |
| 2 <html> | 2 importScripts('../../fast/js/resources/js-test-pre.js'); |
| 3 <head> | 3 |
| 4 <script src="../fast/js/resources/js-test-pre.js"></script> | |
| 5 </head> | |
| 6 <body> | |
| 7 <p id="description"></p> | |
| 8 <div id="console"></div> | |
| 9 <script> | |
| 10 description("Tests the limits of crypto.randomValues."); | 4 description("Tests the limits of crypto.randomValues."); |
| 11 | 5 |
| 12 if (!window.ArrayBuffer) | 6 if (!self.ArrayBuffer) |
| 13 debug("This test requres ArrayBuffers to run!"); | 7 debug("This test requres ArrayBuffers to run!"); |
| 14 | 8 |
| 15 shouldBe("'crypto' in window", "true"); | 9 shouldBe("'crypto' in self", "true"); |
| 16 shouldBe("'getRandomValues' in window.crypto", "true"); | 10 shouldBe("'getRandomValues' in self.crypto", "true"); |
| 17 | 11 |
| 18 try { | 12 try { |
| 19 var almostTooLargeArray = new Uint8Array(65536); | 13 var almostTooLargeArray = new Uint8Array(65536); |
| 20 var tooLargeArray = new Uint8Array(65537); | 14 var tooLargeArray = new Uint8Array(65537); |
| 21 | 15 |
| 22 shouldNotThrow("crypto.getRandomValues(almostTooLargeArray)"); | 16 shouldNotThrow("crypto.getRandomValues(almostTooLargeArray)"); |
| 23 shouldThrow("crypto.getRandomValues(tooLargeArray)"); | 17 shouldThrow("crypto.getRandomValues(tooLargeArray)"); |
| 24 } catch(ex) { | 18 } catch(ex) { |
| 25 debug(ex); | 19 debug(ex); |
| 26 } | 20 } |
| 27 | 21 |
| 28 </script> | 22 finishJSTest(); |
| 29 <script src="../fast/js/resources/js-test-post.js"></script> | |
| 30 </body> | |
| 31 </html> | |
| 32 | |
| 33 | |
| OLD | NEW |