diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/encrypted-media/scripts/update-disallowed-input.js | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/encrypted-media/scripts/update-disallowed-input.js')
-rw-r--r-- | testing/web-platform/tests/encrypted-media/scripts/update-disallowed-input.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/testing/web-platform/tests/encrypted-media/scripts/update-disallowed-input.js b/testing/web-platform/tests/encrypted-media/scripts/update-disallowed-input.js new file mode 100644 index 0000000000..2a30ad38d4 --- /dev/null +++ b/testing/web-platform/tests/encrypted-media/scripts/update-disallowed-input.js @@ -0,0 +1,43 @@ +function runTest(config) +{ + // This test passes |response| to update() as a JSON Web Key Set. + // CDMs other than Clear Key won't expect |response| in this format. + promise_test(function(test) { + var initDataType; + var initData; + var keySystem = config.keysystem; + var mediaKeySession; + + function createReallyLongJWKSet() + { + // This is just a standard JWKSet with a lot of + // extra items added to the end. Key ID and key + // doesn't really matter. + var jwkSet = '{"keys":[{' + + '"kty":"oct",' + + '"k":"MDEyMzQ1Njc4OTAxMjM0NQ",' + + '"kid":"MDEyMzQ1Njc4OTAxMjM0NQ"' + + '}]'; + return jwkSet + ',"test":"unknown"'.repeat(4000) + '}'; + } + + var p = navigator.requestMediaKeySystemAccess(keySystem, getSimpleConfiguration()).then(function(access) { + initDataType = access.getConfiguration().initDataTypes[0]; + initData = getInitData(initDataType); + return access.createMediaKeys(); + }).then(function(mediaKeys) { + mediaKeySession = mediaKeys.createSession(); + var eventWatcher = new EventWatcher(test, mediaKeySession, ['message']); + var promise = eventWatcher.wait_for('message'); + mediaKeySession.generateRequest(initDataType, initData); + return promise; + }).then(function () { + var jwkSet = createReallyLongJWKSet(); + assert_greater_than(jwkSet.length, 65536); + var jwkSetArray = stringToUint8Array(jwkSet); + return mediaKeySession.update(jwkSetArray); + }); + + return promise_rejects_js(test, TypeError, p); + }, 'update() with invalid response (longer than 64Kb characters) should fail.'); +} |