| <!DOCTYPE HTML><!-- webkit-test-runner [ dumpJSConsoleLogInStdErr=true ] --> |
| <script src="../resources/js-test.js"></script> |
| description("Test crypto.getRandomValues behavior in oom situation.") |
| let exceptionString = undefined; |
| function useAllMemory() { |
| Object.defineProperty(a, 0, {get: foo}); |
| Object.defineProperty(a, 80000000, {}); |
| for (let i = 0; i < 2**32; i++) { |
| crypto.getRandomValues(new Uint8Array()); |
| exceptionString = e.toString(); |
| shouldBeTrue("exceptionString == undefined || exceptionString === \"TypeError: Argument 1 ('array') to Crypto.getRandomValues must be an instance of ArrayBufferView\""); |
| testPassed("crypto.getRandomValues didn't crash"); |