Bug 1283666 - Remove code to handle obsolete MediaKeySystemConfiguration attributes. r?jwwang
MozReview-Commit-ID: 1T3DH0JVstQ
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -2742,28 +2742,16 @@ ToCString(const MediaKeySystemConfigurat
str.AppendLiteral(", audioCapabilities=");
str.Append(ToCString(aConfig.mAudioCapabilities.Value()));
}
if (aConfig.mVideoCapabilities.WasPassed()) {
str.AppendLiteral(", videoCapabilities=");
str.Append(ToCString(aConfig.mVideoCapabilities.Value()));
}
- if (!aConfig.mAudioType.IsEmpty()) {
- str.AppendPrintf(", audioType='%s'",
- NS_ConvertUTF16toUTF8(aConfig.mAudioType).get());
- }
- if (!aConfig.mInitDataType.IsEmpty()) {
- str.AppendPrintf(", initDataType='%s'",
- NS_ConvertUTF16toUTF8(aConfig.mInitDataType).get());
- }
- if (!aConfig.mVideoType.IsEmpty()) {
- str.AppendPrintf(", videoType='%s'",
- NS_ConvertUTF16toUTF8(aConfig.mVideoType).get());
- }
str.AppendLiteral("}");
return str;
}
static nsCString
RequestKeySystemAccessLogString(const nsAString& aKeySystem,
const Sequence<MediaKeySystemConfiguration>& aConfigs)
--- a/dom/media/eme/MediaKeySystemAccess.cpp
+++ b/dom/media/eme/MediaKeySystemAccess.cpp
@@ -495,46 +495,16 @@ IsSupportedVideo(mozIGeckoMediaPluginSer
}
if (IsVP9ContentType(aVideoType) && aKeySystem.EqualsLiteral("org.w3.clearkey")) {
return GMPDecryptsAndGeckoDecodesVP9(aGMPService, aKeySystem, aVideoType, aDiagnostics);
}
return false;
}
static bool
-IsSupported(mozIGeckoMediaPluginService* aGMPService,
- const nsAString& aKeySystem,
- const MediaKeySystemConfiguration& aConfig,
- DecoderDoctorDiagnostics* aDiagnostics)
-{
- if (aConfig.mInitDataType.IsEmpty() &&
- aConfig.mAudioType.IsEmpty() &&
- aConfig.mVideoType.IsEmpty()) {
- // Not an old-style request.
- return false;
- }
-
- // Backwards compatibility with legacy MediaKeySystemConfiguration method.
- if (!aConfig.mInitDataType.IsEmpty() &&
- !aConfig.mInitDataType.EqualsLiteral("cenc")) {
- return false;
- }
- if (!aConfig.mAudioType.IsEmpty() &&
- !IsSupportedAudio(aGMPService, aKeySystem, aConfig.mAudioType, aDiagnostics)) {
- return false;
- }
- if (!aConfig.mVideoType.IsEmpty() &&
- !IsSupportedVideo(aGMPService, aKeySystem, aConfig.mVideoType, aDiagnostics)) {
- return false;
- }
-
- return true;
-}
-
-static bool
IsSupportedInitDataType(const nsString& aCandidate, const nsAString& aKeySystem)
{
// All supported keySystems can handle "cenc" initDataType.
// ClearKey also supports "keyids" and "webm" initDataTypes.
return aCandidate.EqualsLiteral("cenc") ||
((aKeySystem.EqualsLiteral("org.w3.clearkey")
|| aKeySystem.EqualsLiteral("com.widevine.alpha")) &&
(aCandidate.EqualsLiteral("keyids") || aCandidate.EqualsLiteral("webm")));
@@ -604,44 +574,16 @@ GetSupportedConfig(mozIGeckoMediaPluginS
}
#endif
aOutConfig = config;
return true;
}
-// Backwards compatibility with legacy requestMediaKeySystemAccess with fields
-// from old MediaKeySystemOptions dictionary.
-/* static */
-bool
-MediaKeySystemAccess::IsSupported(const nsAString& aKeySystem,
- const Sequence<MediaKeySystemConfiguration>& aConfigs,
- DecoderDoctorDiagnostics* aDiagnostics)
-{
- nsCOMPtr<mozIGeckoMediaPluginService> mps =
- do_GetService("@mozilla.org/gecko-media-plugin-service;1");
- if (NS_WARN_IF(!mps)) {
- return false;
- }
-
- if (!HaveGMPFor(mps,
- NS_ConvertUTF16toUTF8(aKeySystem),
- NS_LITERAL_CSTRING(GMP_API_DECRYPTOR))) {
- return false;
- }
-
- for (const MediaKeySystemConfiguration& config : aConfigs) {
- if (mozilla::dom::IsSupported(mps, aKeySystem, config, aDiagnostics)) {
- return true;
- }
- }
- return false;
-}
-
/* static */
bool
MediaKeySystemAccess::GetSupportedConfig(const nsAString& aKeySystem,
const Sequence<MediaKeySystemConfiguration>& aConfigs,
MediaKeySystemConfiguration& aOutConfig,
DecoderDoctorDiagnostics* aDiagnostics)
{
nsCOMPtr<mozIGeckoMediaPluginService> mps =
--- a/dom/media/eme/MediaKeySystemAccessManager.cpp
+++ b/dom/media/eme/MediaKeySystemAccessManager.cpp
@@ -164,20 +164,17 @@ MediaKeySystemAccessManager::Request(Det
aPromise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR,
NS_LITERAL_CSTRING("GetKeySystemAccess failed"));
diagnostics.StoreMediaKeySystemAccess(mWindow->GetExtantDoc(),
aKeySystem, false, __func__);
return;
}
MediaKeySystemConfiguration config;
- // TODO: Remove IsSupported() check here once we remove backwards
- // compatibility with initial implementation...
- if (MediaKeySystemAccess::GetSupportedConfig(keySystem, aConfigs, config, &diagnostics) ||
- MediaKeySystemAccess::IsSupported(keySystem, aConfigs, &diagnostics)) {
+ if (MediaKeySystemAccess::GetSupportedConfig(keySystem, aConfigs, config, &diagnostics)) {
RefPtr<MediaKeySystemAccess> access(
new MediaKeySystemAccess(mWindow, keySystem, NS_ConvertUTF8toUTF16(cdmVersion), config));
aPromise->MaybeResolve(access);
diagnostics.StoreMediaKeySystemAccess(mWindow->GetExtantDoc(),
aKeySystem, true, __func__);
return;
}
// Not to inform user, because nothing to do if the corresponding keySystem
--- a/dom/media/test/test_eme_detach_media_keys.html
+++ b/dom/media/test/test_eme_detach_media_keys.html
@@ -14,17 +14,17 @@
SimpleTest.waitForExplicitFinish();
const keysystem = 'org.w3.clearkey';
function createAndSet() {
return new Promise(function(resolve, reject) {
var m;
- navigator.requestMediaKeySystemAccess(keysystem, [{initDataType: 'cenc'}])
+ navigator.requestMediaKeySystemAccess(keysystem, [{initDataTypes: ['cenc']}])
.then(function (access) {
return access.createMediaKeys();
}).then(function (mediaKeys) {
m = mediaKeys;
return document.getElementById("v").setMediaKeys(mediaKeys);
}).then(function() {
resolve(m);
});
--- a/dom/media/test/test_eme_initDataTypes.html
+++ b/dom/media/test/test_eme_initDataTypes.html
@@ -103,17 +103,17 @@ function PrepareInitData(initDataType, i
return new TextEncoder().encode(initData);
} else if (initDataType == "webm") {
return StringToArrayBuffer(atob(initData));
}
}
function Test(test) {
return new Promise(function(resolve, reject) {
- navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{initDataTypes: ['keyids']}]).then(
+ navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{initDataTypes: [test.initDataType]}]).then(
(access) => access.createMediaKeys()
).then(
(mediaKeys) => {
var session = mediaKeys.createSession(test.sessionType);
session.addEventListener("message", function(event) {
is(event.messageType, "license-request", "'" + test.name + "' MediaKeyMessage type should be license-request.");
var text = new TextDecoder().decode(event.message);
is(text, test.expectedRequest, "'" + test.name + "' got expected response.");
--- a/dom/media/test/test_eme_requestKeySystemAccess.html
+++ b/dom/media/test/test_eme_requestKeySystemAccess.html
@@ -523,60 +523,16 @@ var tests = [
options: [
{
initDataTypes: ['cenc'],
videoCapabilities: [{contentType: 'video/mp4'}],
}
],
shouldPass: false
},
-
- // Test legacy support. Remove when we remove backwards compatibility.
- {
- name: 'Legacy CENC',
- keySystem: CLEARKEY_ID,
- options: [
- {
- initDataType: 'cenc',
- }
- ],
- expectedConfig: {
- label: ''
- },
- shouldPass: true,
- },
- {
- name: 'Legacy CENC + MP4 video',
- keySystem: CLEARKEY_ID,
- options: [
- {
- initDataType: 'cenc',
- videoType: 'video/mp4; codecs="avc1.42E01E"',
- }
- ],
- expectedConfig: {
- label: ''
- },
- shouldPass: true,
- },
- {
- name: 'Legacy CENC + MP4 video + MP4 audio',
- keySystem: CLEARKEY_ID,
- options: [
- {
- initDataType: 'cenc',
- videoType: 'video/mp4; codecs="avc1.42E01E"',
- audioType: 'audio/mp4; codecs="mp4a.40.2"',
- }
- ],
- expectedConfig: {
- label: ''
- },
- shouldPass: true,
- },
];
function beginTest() {
Promise.all(tests.map(Test)).then(function() { SimpleTest.finish(); });
}
if (!IsMacOSSnowLeopardOrEarlier()) {
SimpleTest.waitForExplicitFinish();