mirror of
https://github.com/servo/servo.git
synced 2025-07-12 18:03:49 +01:00
50 lines
2.3 KiB
HTML
50 lines
2.3 KiB
HTML
<!DOCTYPE html>
|
|
<!-- Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). -->
|
|
<html>
|
|
<head>
|
|
<title>Test Clear Key handling of non-ASCII responses for update().</title>
|
|
<script src="encrypted-media-utils.js"></script>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
</head>
|
|
<body>
|
|
<div id="log"></div>
|
|
<script>
|
|
// This test passes |response| to update() as a JSON Web Key Set.
|
|
// CDMs other than Clear Key won't expect |response| in this format.
|
|
|
|
async_test(function(test)
|
|
{
|
|
var initDataType;
|
|
var initData;
|
|
var mediaKeySession;
|
|
|
|
function processMessage(event)
|
|
{
|
|
// |jwkSet| includes some non-ASCII characters.
|
|
var jwkSet = '{"keys":[{'
|
|
+ '"kty":"oct\uDC00\uD800",'
|
|
+ '"k":"MDEyMzQ1Njc4OTAxMjM0NQ",'
|
|
+ '"kid":"MDEyMzQ1Njc4OTAxMjM0NQ"'
|
|
+ '\xff\xfe}]';
|
|
mediaKeySession.update(stringToUint8Array(jwkSet)).then(function() {
|
|
forceTestFailureFromPromise(test, 'Error: update() succeeded');
|
|
}, function(error) {
|
|
assert_equals(error.name, 'InvalidAccessError');
|
|
test.done();
|
|
});
|
|
}
|
|
|
|
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
|
|
initDataType = access.getConfiguration().initDataTypes[0];
|
|
initData = getInitData(initDataType);
|
|
return access.createMediaKeys();
|
|
}).then(function(mediaKeys) {
|
|
mediaKeySession = mediaKeys.createSession();
|
|
waitForEventAndRunStep('message', mediaKeySession, processMessage, test);
|
|
return mediaKeySession.generateRequest(initDataType, initData);
|
|
});
|
|
}, 'Clear Key update() with non-ASCII response.');
|
|
</script>
|
|
</body>
|
|
</html>
|