| OLD | NEW |
| 1 if (self.importScripts) | 1 if (self.importScripts) |
| 2 importScripts('../../resources/js-test.js'); | 2 importScripts('../resources/js-test.js'); |
| 3 | 3 |
| 4 description("Tests the limits of crypto.randomValues."); | 4 description("Tests the limits of crypto.randomValues."); |
| 5 | 5 |
| 6 if (!self.ArrayBuffer) | 6 if (!self.ArrayBuffer) |
| 7 debug("This test requres ArrayBuffers to run!"); | 7 debug("This test requres ArrayBuffers to run!"); |
| 8 | 8 |
| 9 shouldBe("'crypto' in self", "true"); | 9 shouldBe("'crypto' in self", "true"); |
| 10 shouldBe("'getRandomValues' in self.crypto", "true"); | 10 shouldBe("'getRandomValues' in self.crypto", "true"); |
| 11 | 11 |
| 12 try { | 12 try { |
| 13 var almostTooLargeArray = new Uint8Array(65536); | 13 var almostTooLargeArray = new Uint8Array(65536); |
| 14 var tooLargeArray = new Uint8Array(65537); | 14 var tooLargeArray = new Uint8Array(65537); |
| 15 | 15 |
| 16 shouldNotThrow("crypto.getRandomValues(almostTooLargeArray)"); | 16 shouldNotThrow("crypto.getRandomValues(almostTooLargeArray)"); |
| 17 shouldThrow("crypto.getRandomValues(tooLargeArray)"); | 17 shouldThrow("crypto.getRandomValues(tooLargeArray)"); |
| 18 } catch(ex) { | 18 } catch(ex) { |
| 19 debug(ex); | 19 debug(ex); |
| 20 } | 20 } |
| 21 | 21 |
| 22 finishJSTest(); | 22 finishJSTest(); |
| OLD | NEW |