Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

  • This test gets skipped with pattern: (os == "win" && processor == "aarch64") os == "linux" && (asan || debug) toolkit == 'android'
<!DOCTYPE html>
<title>Test Encrypted Media Extensions - Special key system</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<pre id="test">
<script class="testbody" type="text/javascript">
function requestProtectionQueryKeySystemAccess() {
const kKeySystemOptions = [
initDataTypes: ["cenc"],
videoCapabilities: [{ contentType: 'video/mp4; codecs="avc1.4d4015"' }],
const kClearKeyWithProtectionQuery =
return navigator.requestMediaKeySystemAccess(
// Tests that org.mozilla.clearkey_with_protection_query cannot be accessed from JS if not preffed on.
add_task(async function protectionQueryKeySystemShouldBeHidden() {
try {
// Should throw since special key systems are not enabled.
await requestProtectionQueryKeySystemAccess();
"Test should have thrown by default because media.clearkey.test-key-systems.enabled should not be set"
} catch (e) {
is(, "NotSupportedError", "Should get not supported error");
"Key system is unsupported",
"Should get message that key system is unsupported"
// Tests that org.mozilla.clearkey_with_protection_query can be accessed from JS if preffed on.
add_task(async function protectionQueryKeySystemShouldBeExposed() {
await SpecialPowers.pushPrefEnv({
set: [["media.clearkey.test-key-systems.enabled", true]],
try {
// Should not throw since special key systems are enabled.
let access = await requestProtectionQueryKeySystemAccess();
"Should get access to protection query key system when preffed on"
} catch (e) {
ok(false, "Test should not have thrown and key system should be available");