blob: 272de18f7f5800adbb814c374b74d971e4f884d4 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="../resources/js-test-pre.js"></script>
<script src="resources/common.js"></script>
</head>
<body>
<script>
description("Test that CryptoKey.usages preserves custom properties.");
jsTestIsAsync = true;
debug("\nGenerating a HMAC key with default length...");
crypto.subtle.generateKey({name: "hmac", hash: "sha-1"}, true, ["sign", "verify"]).then(function(result) {
key = result;
startTest();
});
function startTest()
{
shouldBeTrue("key.usages === key.usages");
key.usages.foo = "bar";
gc();
setTimeout(continueTest, 10);
}
function continueTest()
{
gc();
setTimeout(finishTest, 10);
}
function finishTest()
{
gc();
shouldBeEqualToString('key.usages.foo', 'bar');
finishJSTest();
}
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>