Bug 1270599 - add test to ensure generateKey returns the correct error given an invalid algorithm argument r=keeler

Differential Revision: https://phabricator.services.mozilla.com/D80008
This commit is contained in:
R. Martinho Fernandes 2020-07-06 16:43:21 +00:00
parent c8ef1c44cb
commit 0b0d3c3672

View File

@ -398,7 +398,21 @@ TestArray.addTest(
// -----------------------------------------------------------------------------
TestArray.addTest(
"Generate a 1024-bit RSA key",
"Fail generating a key with bad algorithm argument",
function() {
var that = this;
var alg = { name: "AES", length: 128 };
crypto.subtle.generateKey(alg, false, ["encrypt"]).then(
error(that),
complete(that, function(e) {
return e.name == "NotSupportedError";
})
);
}
);
// -----------------------------------------------------------------------------
TestArray.addTest( "Generate a 1024-bit RSA key",
function() {
var that = this;
var alg = {