--- a/dom/media/eme/MediaKeySystemAccessManager.cpp
+++ b/dom/media/eme/MediaKeySystemAccessManager.cpp
@@ -74,41 +74,39 @@ MediaKeySystemAccessManager::Request(Det
void
MediaKeySystemAccessManager::Request(DetailedPromise* aPromise,
const nsAString& aKeySystem,
const Sequence<MediaKeySystemConfiguration>& aConfigs,
RequestType aType)
{
EME_LOG("MediaKeySystemAccessManager::Request %s", NS_ConvertUTF16toUTF8(aKeySystem).get());
+
+ // Parse keysystem, split it out into keySystem prefix, and version suffix.
+ nsAutoString keySystem;
+ int32_t minCdmVersion = NO_CDM_VERSION;
+ if (!ParseKeySystem(aKeySystem, keySystem, minCdmVersion)) {
+ // Not to inform user, because nothing to do if the keySystem is not
+ // supported.
+ aPromise->MaybeReject(NS_ERROR_DOM_NOT_SUPPORTED_ERR,
+ NS_LITERAL_CSTRING("Key system string is invalid,"
+ " or key system is unsupported"));
+ return;
+ }
+
if (!Preferences::GetBool("media.eme.enabled", false)) {
- // EME disabled by user, send notification to chrome so UI can
- // inform user.
+ // EME disabled by user, send notification to chrome so UI can inform user.
MediaKeySystemAccess::NotifyObservers(mWindow,
aKeySystem,
MediaKeySystemStatus::Api_disabled);
aPromise->MaybeReject(NS_ERROR_DOM_NOT_SUPPORTED_ERR,
NS_LITERAL_CSTRING("EME has been preffed off"));
return;
}
- // Parse keysystem, split it out into keySystem prefix, and version suffix.
- nsAutoString keySystem;
- int32_t minCdmVersion = NO_CDM_VERSION;
- if (!ParseKeySystem(aKeySystem,
- keySystem,
- minCdmVersion)) {
- // Invalid keySystem string, or unsupported keySystem. Send notification
- // to chrome to show a failure notice.
- MediaKeySystemAccess::NotifyObservers(mWindow, aKeySystem, MediaKeySystemStatus::Cdm_not_supported);
- aPromise->MaybeReject(NS_ERROR_DOM_NOT_SUPPORTED_ERR,
- NS_LITERAL_CSTRING("Key system string is invalid, or key system is unsupported"));
- return;
- }
-
nsAutoCString message;
nsAutoCString cdmVersion;
MediaKeySystemStatus status =
MediaKeySystemAccess::GetKeySystemStatus(keySystem, minCdmVersion, message, cdmVersion);
nsPrintfCString msg("MediaKeySystemAccess::GetKeySystemStatus(%s, minVer=%d) "
"result=%s version='%s' msg='%s'",
NS_ConvertUTF16toUTF8(keySystem).get(),
@@ -163,19 +161,20 @@ MediaKeySystemAccessManager::Request(Det
// compatibility with initial implementation...
if (MediaKeySystemAccess::GetSupportedConfig(keySystem, aConfigs, config) ||
MediaKeySystemAccess::IsSupported(keySystem, aConfigs)) {
RefPtr<MediaKeySystemAccess> access(
new MediaKeySystemAccess(mWindow, keySystem, NS_ConvertUTF8toUTF16(cdmVersion), config));
aPromise->MaybeResolve(access);
return;
}
-
+ // Not to inform user, because nothing to do if the corresponding keySystem
+ // configuration is not supported.
aPromise->MaybeReject(NS_ERROR_DOM_NOT_SUPPORTED_ERR,
- NS_LITERAL_CSTRING("Key system is not supported"));
+ NS_LITERAL_CSTRING("Key system configuration is not supported"));
}
MediaKeySystemAccessManager::PendingRequest::PendingRequest(DetailedPromise* aPromise,
const nsAString& aKeySystem,
const Sequence<MediaKeySystemConfiguration>& aConfigs,
nsITimer* aTimer)
: mPromise(aPromise)
, mKeySystem(aKeySystem)