Test crypto.subtle argument conversion

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".



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: Only ArrayBuffer and ArrayBufferView objects can be passed as CryptoOperationData.
PASS crypto.subtle.digest({name: 'sha-1'}, 10) threw exception TypeError: Only ArrayBuffer and ArrayBufferView objects can be passed as CryptoOperationData.
PASS crypto.subtle.digest({name: 'sha-1'}, [10]) threw exception TypeError: Only ArrayBuffer and ArrayBufferView objects can be passed as CryptoOperationData.
PASS crypto.subtle.digest({name: 'sha-1'}, [new Uint8Array([0])]) threw exception TypeError: Only ArrayBuffer and ArrayBufferView objects can be passed as CryptoOperationData.

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

