blob: 6163e1b3920c08ad31c61eb64c64b3135d1e62f8 [file] [log] [blame]
Test crypto.subtle argument conversion
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
SHA1 of new Uint8Array([]))
= [da 39 a3 ee 5e 6b 4b 0d 32 55 bf ef 95 60 18 90 af d8 07 09]
Passing algorithm name as a string object...
PASS ...succeeded
Passing algorithm name as a string object in a dictionary...
PASS ...succeeded
Passing algorithm name as an object with toString
PASS ...succeeded
Passing invalid data to digest()
PASS crypto.subtle.digest({name: 'sha-1'}) threw exception TypeError: Not enough arguments.
PASS crypto.subtle.digest({name: 'sha-1'}, null) threw exception TypeError: Type error.
PASS crypto.subtle.digest({name: 'sha-1'}, 10) threw exception TypeError: Type error.
PASS crypto.subtle.digest({name: 'sha-1'}, [10]) threw exception TypeError: Only ArrayBuffer and ArrayBufferView objects can be part of CryptoOperationData sequence.
PASS crypto.subtle.digest({name: 'sha-1'}, new Uint8Array([0])) threw exception TypeError: Only ArrayBuffer and ArrayBufferView objects can be part of CryptoOperationData sequence.
Passing invalid algorithmIdentifiers to digest()
PASS crypto.subtle.digest({ toString:function() { return 'sha-1' } }, [data]) threw exception Error: NotSupportedError: DOM Exception 9.
PASS crypto.subtle.digest({name: ''}, [data]) threw exception Error: NotSupportedError: DOM Exception 9.
PASS crypto.subtle.digest({name: null}, [data]) threw exception Error: NotSupportedError: DOM Exception 9.
PASS crypto.subtle.digest({name: undefined}, [data]) threw exception Error: NotSupportedError: DOM Exception 9.
PASS crypto.subtle.digest({name: 'sha'}, [data]) threw exception Error: NotSupportedError: DOM Exception 9.
PASS crypto.subtle.digest({name: 1}, [data]) threw exception Error: NotSupportedError: DOM Exception 9.
PASS crypto.subtle.digest('', [data]) threw exception Error: NotSupportedError: DOM Exception 9.
PASS crypto.subtle.digest(null, [data]) threw exception Error: NotSupportedError: DOM Exception 9.
PASS crypto.subtle.digest(undefined, [data]) threw exception Error: NotSupportedError: DOM Exception 9.
PASS crypto.subtle.digest(1, [data]) threw exception Error: NotSupportedError: DOM Exception 9.
PASS crypto.subtle.digest({}, [data]) threw exception Error: NotSupportedError: DOM Exception 9.
PASS successfullyParsed is true
TEST COMPLETE