blob: 86bea79126aba3da4433988910e25bd113846168 [file] [log] [blame]
jiewen_tan@apple.come942daa2016-09-15 00:19:12 +00001<!DOCTYPE html>
2<html>
3<head>
4<meta charset="utf-8">
jiewen_tan@apple.com6ae34e62016-12-13 01:32:56 +00005<script src="../resources/js-test-pre.js"></script>
6<script src="resources/common.js"></script>
jiewen_tan@apple.come942daa2016-09-15 00:19:12 +00007</head>
8<body>
9<script>
10
11description("Test that CryptoKey.algorithm preserves custom properties.");
12jsTestIsAsync = true;
13
14debug("\nGenerating a HMAC key with default length...");
jiewen_tan@apple.com6ae34e62016-12-13 01:32:56 +000015crypto.subtle.generateKey({name: "hmac", hash: "sha-1"}, true, ["sign", "verify"]).then(function(result) {
jiewen_tan@apple.come942daa2016-09-15 00:19:12 +000016 key = result;
17 startTest();
18});
19
20function startTest()
21{
22 shouldBeTrue("key.algorithm === key.algorithm");
23 key.algorithm.foo = "bar";
24 gc();
25 setTimeout(continueTest, 10);
26}
27
28function continueTest()
29{
30 gc();
31 setTimeout(finishTest, 10);
32}
33
34function finishTest()
35{
36 gc();
37 shouldBeEqualToString('key.algorithm.foo', 'bar');
38 finishJSTest();
39}
40
41</script>
jiewen_tan@apple.com6ae34e62016-12-13 01:32:56 +000042<script src="../resources/js-test-post.js"></script>
jiewen_tan@apple.come942daa2016-09-15 00:19:12 +000043</body>
44</html>