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