Chromium Code Reviews| Index: LayoutTests/media/encrypted-media/encrypted-media-utils.js |
| diff --git a/LayoutTests/media/encrypted-media/encrypted-media-utils.js b/LayoutTests/media/encrypted-media/encrypted-media-utils.js |
| index 523eab05160081983597bf82df8027de583735d3..40148e886d1832c8d3b9fdd50ae13dbcf2a75c97 100644 |
| --- a/LayoutTests/media/encrypted-media/encrypted-media-utils.js |
| +++ b/LayoutTests/media/encrypted-media/encrypted-media-utils.js |
| @@ -70,6 +70,13 @@ function stringToUint8Array(str) |
| return result; |
| } |
| +function decodeMessageAttribute(event) |
|
ddorwin
2014/07/16 22:34:57
I'm not sure this is worth hiding. Part of the pur
jrummell
2014/07/18 21:56:00
Removed. We can do the conversion when ClearKey is
|
| +{ |
| + var decoder = new TextDecoder('utf-8'); |
|
ddorwin
2014/07/16 22:34:57
FYI, the Intent to Ship email was just sent, so th
jrummell
2014/07/18 21:56:00
Acknowledged.
|
| + var data = new Uint8Array(event.message); |
| + return decoder.decode(data); |
| +} |
| + |
| // For Clear Key, MediaKeySession.update() takes a JSON Web Key (JWK) Set, |
| // which contains a set of cryptographic keys represented by JSON. These helper |
| // functions help wrap raw keys into a JWK set. |
| @@ -80,17 +87,18 @@ function stringToUint8Array(str) |
| // Encodes data into base64 string without trailing '='. |
| function base64Encode(data) |
| { |
| - var result = btoa(String.fromCharCode.apply(null, data)); |
| + var result = btoa(data); |
| return result.replace(/=+$/g, ''); |
| } |
| // Creates a JWK from raw key ID and key. |
| +// keyId is expected to be a string, key is ArrayBufferView. |
|
ddorwin
2014/07/16 22:34:57
nit: "key is an"
ddorwin
2014/07/16 22:34:57
Why are these types different? They contain the sa
jrummell
2014/07/18 21:56:00
Updated.
jrummell
2014/07/18 21:56:00
They do now.
|
| function createJWK(keyId, key) |
| { |
| var jwk = '{"kty":"oct","kid":"'; |
| jwk += base64Encode(keyId); |
|
ddorwin
2014/07/16 22:34:57
FIXME: base64URLEncode()
jrummell
2014/07/18 21:56:00
Done.
|
| jwk += '","k":"'; |
| - jwk += base64Encode(key); |
| + jwk += base64Encode(String.fromCharCode.apply(null, key)); |
| jwk += '"}'; |
| return jwk; |
| } |