Bug 1131755 - Make media.eme.enabled pref enable/disable EME rather than hide/expose EME. r=bz

This commit is contained in:
Chris Pearce 2015-02-12 11:27:25 +13:00
parent 90bf2066c0
commit 481a2bba91
15 changed files with 28 additions and 18 deletions

View File

@ -235,6 +235,7 @@ DEFAULT_TEST_PREFS = {
'dom.mozApps.debug': True, 'dom.mozApps.debug': True,
'dom.apps.customization.enabled': True, 'dom.apps.customization.enabled': True,
'media.eme.enabled': True, 'media.eme.enabled': True,
'media.eme.apiVisible': True,
# Don't forceably kill content processes after a timeout # Don't forceably kill content processes after a timeout
'dom.ipc.tabs.shutdownTimeoutSecs': 0, 'dom.ipc.tabs.shutdownTimeoutSecs': 0,
# Don't show the search first run UI by default # Don't show the search first run UI by default

View File

@ -43,6 +43,7 @@
"dom.mozApps.debug": true, "dom.mozApps.debug": true,
"dom.apps.customization.enabled": true, "dom.apps.customization.enabled": true,
"media.eme.enabled": true, "media.eme.enabled": true,
"media.eme.apiVisible": true,
"dom.ipc.tabs.shutdownTimeoutSecs": 0, "dom.ipc.tabs.shutdownTimeoutSecs": 0,
"browser.search.highlightCount": 0, "browser.search.highlightCount": 0,
"general.useragent.locale": "en-US", "general.useragent.locale": "en-US",

View File

@ -1787,8 +1787,10 @@ pref("ui.key.menuAccessKeyFocuses", true);
// Encrypted media extensions. // Encrypted media extensions.
#ifdef RELEASE_BUILD #ifdef RELEASE_BUILD
pref("media.eme.enabled", false); pref("media.eme.enabled", false);
pref("media.eme.apiVisible", false);
#else #else
pref("media.eme.enabled", true); pref("media.eme.enabled", true);
pref("media.eme.apiVisible", true);
#endif #endif
// Play with different values of the decay time and get telemetry, // Play with different values of the decay time and get telemetry,

View File

@ -2608,6 +2608,11 @@ Navigator::RequestMediaKeySystemAccess(const nsAString& aKeySystem,
return nullptr; return nullptr;
} }
if (!Preferences::GetBool("media.eme.enabled", false)) {
p->MaybeReject(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return p.forget();
}
if (aKeySystem.IsEmpty() || if (aKeySystem.IsEmpty() ||
(aOptions.WasPassed() && aOptions.Value().IsEmpty())) { (aOptions.WasPassed() && aOptions.Value().IsEmpty())) {
p->MaybeReject(NS_ERROR_DOM_INVALID_ACCESS_ERR); p->MaybeReject(NS_ERROR_DOM_INVALID_ACCESS_ERR);

View File

@ -652,19 +652,19 @@ var interfaceNamesInGlobalScope =
// IMPORTANT: Do not change this list without review from a DOM peer! // IMPORTANT: Do not change this list without review from a DOM peer!
"MediaError", "MediaError",
// IMPORTANT: Do not change this list without review from a DOM peer! // IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MediaKeyError", pref: "media.eme.enabled"}, {name: "MediaKeyError", pref: "media.eme.apiVisible"},
// IMPORTANT: Do not change this list without review from a DOM peer! // IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MediaEncryptedEvent", pref: "media.eme.enabled"}, {name: "MediaEncryptedEvent", pref: "media.eme.apiVisible"},
// IMPORTANT: Do not change this list without review from a DOM peer! // IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MediaKeys", pref: "media.eme.enabled"}, {name: "MediaKeys", pref: "media.eme.apiVisible"},
// IMPORTANT: Do not change this list without review from a DOM peer! // IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MediaKeySession", pref: "media.eme.enabled"}, {name: "MediaKeySession", pref: "media.eme.apiVisible"},
// IMPORTANT: Do not change this list without review from a DOM peer! // IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MediaKeySystemAccess", pref: "media.eme.enabled"}, {name: "MediaKeySystemAccess", pref: "media.eme.apiVisible"},
// IMPORTANT: Do not change this list without review from a DOM peer! // IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MediaKeyMessageEvent", pref: "media.eme.enabled"}, {name: "MediaKeyMessageEvent", pref: "media.eme.apiVisible"},
// IMPORTANT: Do not change this list without review from a DOM peer! // IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MediaKeyStatusMap", pref: "media.eme.enabled"}, {name: "MediaKeyStatusMap", pref: "media.eme.apiVisible"},
// IMPORTANT: Do not change this list without review from a DOM peer! // IMPORTANT: Do not change this list without review from a DOM peer!
"MediaList", "MediaList",
// IMPORTANT: Do not change this list without review from a DOM peer! // IMPORTANT: Do not change this list without review from a DOM peer!

View File

@ -145,14 +145,14 @@ partial interface HTMLMediaElement {
#ifdef MOZ_EME #ifdef MOZ_EME
// Encrypted Media Extensions // Encrypted Media Extensions
partial interface HTMLMediaElement { partial interface HTMLMediaElement {
[Pref="media.eme.enabled"] [Pref="media.eme.apiVisible"]
readonly attribute MediaKeys? mediaKeys; readonly attribute MediaKeys? mediaKeys;
// void, not any: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26457 // void, not any: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26457
[Pref="media.eme.enabled", NewObject] [Pref="media.eme.apiVisible", NewObject]
Promise<void> setMediaKeys(MediaKeys? mediaKeys); Promise<void> setMediaKeys(MediaKeys? mediaKeys);
[Pref="media.eme.enabled"] [Pref="media.eme.apiVisible"]
attribute EventHandler onencrypted; attribute EventHandler onencrypted;
}; };
#endif #endif

View File

@ -10,7 +10,7 @@
* W3C liability, trademark and document use rules apply. * W3C liability, trademark and document use rules apply.
*/ */
[Pref="media.eme.enabled", Constructor(DOMString type, optional MediaKeyNeededEventInit eventInitDict)] [Pref="media.eme.apiVisible", Constructor(DOMString type, optional MediaKeyNeededEventInit eventInitDict)]
interface MediaEncryptedEvent : Event { interface MediaEncryptedEvent : Event {
readonly attribute DOMString initDataType; readonly attribute DOMString initDataType;
[Throws] [Throws]

View File

@ -13,7 +13,7 @@
// According to the spec, "The future of error events and MediaKeyError // According to the spec, "The future of error events and MediaKeyError
// is uncertain." // is uncertain."
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=21798 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=21798
[Pref="media.eme.enabled"] [Pref="media.eme.apiVisible"]
interface MediaKeyError : Event { interface MediaKeyError : Event {
readonly attribute unsigned long systemCode; readonly attribute unsigned long systemCode;
}; };

View File

@ -17,7 +17,7 @@ enum MediaKeyMessageType {
"individualization-request" "individualization-request"
}; };
[Pref="media.eme.enabled", Constructor(DOMString type, optional MediaKeyMessageEventInit eventInitDict)] [Pref="media.eme.apiVisible", Constructor(DOMString type, optional MediaKeyMessageEventInit eventInitDict)]
interface MediaKeyMessageEvent : Event { interface MediaKeyMessageEvent : Event {
readonly attribute MediaKeyMessageType messageType; readonly attribute MediaKeyMessageType messageType;
[Throws] [Throws]

View File

@ -10,7 +10,7 @@
* W3C liability, trademark and document use rules apply. * W3C liability, trademark and document use rules apply.
*/ */
[Pref="media.eme.enabled"] [Pref="media.eme.apiVisible"]
interface MediaKeySession : EventTarget { interface MediaKeySession : EventTarget {
// error state // error state
readonly attribute MediaKeyError? error; readonly attribute MediaKeyError? error;

View File

@ -18,7 +18,7 @@ enum MediaKeyStatus {
"internal-error" "internal-error"
}; };
[Pref="media.eme.enabled"] [Pref="media.eme.apiVisible"]
interface MediaKeyStatusMap { interface MediaKeyStatusMap {
[Throws] [Throws]
readonly attribute unsigned long size; readonly attribute unsigned long size;

View File

@ -26,7 +26,7 @@ dictionary MediaKeySystemOptions {
MediaKeysRequirement stateful = "optional"; MediaKeysRequirement stateful = "optional";
}; };
[Pref="media.eme.enabled"] [Pref="media.eme.apiVisible"]
interface MediaKeySystemAccess { interface MediaKeySystemAccess {
readonly attribute DOMString keySystem; readonly attribute DOMString keySystem;
[NewObject] [NewObject]

View File

@ -13,7 +13,7 @@
enum IsTypeSupportedResult { "" /* empty string */, "maybe", "probably" }; enum IsTypeSupportedResult { "" /* empty string */, "maybe", "probably" };
enum SessionType { "temporary", "persistent" }; enum SessionType { "temporary", "persistent" };
[Pref="media.eme.enabled"] [Pref="media.eme.apiVisible"]
interface MediaKeys { interface MediaKeys {
readonly attribute DOMString keySystem; readonly attribute DOMString keySystem;

View File

@ -414,7 +414,7 @@ partial interface Navigator {
#ifdef MOZ_EME #ifdef MOZ_EME
partial interface Navigator { partial interface Navigator {
[Pref="media.eme.enabled", NewObject] [Pref="media.eme.apiVisible", NewObject]
Promise<MediaKeySystemAccess> Promise<MediaKeySystemAccess>
requestMediaKeySystemAccess(DOMString keySystem, requestMediaKeySystemAccess(DOMString keySystem,
optional sequence<MediaKeySystemOptions> supportedConfigurations); optional sequence<MediaKeySystemOptions> supportedConfigurations);

View File

@ -284,6 +284,7 @@ user_pref("browser.search.isUS", true);
user_pref("browser.search.countryCode", "US"); user_pref("browser.search.countryCode", "US");
user_pref("media.eme.enabled", true); user_pref("media.eme.enabled", true);
user_pref("media.eme.apiVisible", true);
#if defined(XP_WIN) #if defined(XP_WIN)
user_pref("media.decoder.heuristic.dormant.timeout", 0); user_pref("media.decoder.heuristic.dormant.timeout", 0);