forked from mirrors/gecko-dev
Bug 1846848 - part6 : display GMPCDM capabilities in about:support. r=jolin
ClearKey and Widevine L3 are used in the GMP process, so comparing with MFCDM, we need to use another different way to access their capabilities. Differential Revision: https://phabricator.services.mozilla.com/D194932
This commit is contained in:
parent
999157ad9b
commit
bae8ed95b1
6 changed files with 55 additions and 2 deletions
|
|
@ -1944,4 +1944,17 @@ already_AddRefed<Promise> ChromeUtils::GetWMFContentDecryptionModuleInformation(
|
|||
}
|
||||
#endif
|
||||
|
||||
already_AddRefed<Promise> ChromeUtils::GetGMPContentDecryptionModuleInformation(
|
||||
GlobalObject& aGlobal, ErrorResult& aRv) {
|
||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
MOZ_ASSERT(global);
|
||||
RefPtr<Promise> domPromise = Promise::Create(global, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
MOZ_ASSERT(domPromise);
|
||||
KeySystemConfig::GetGMPKeySystemConfigs(domPromise);
|
||||
return domPromise.forget();
|
||||
}
|
||||
|
||||
} // namespace mozilla::dom
|
||||
|
|
|
|||
|
|
@ -313,6 +313,9 @@ class ChromeUtils {
|
|||
GlobalObject& aGlobal, ErrorResult& aRv);
|
||||
#endif
|
||||
|
||||
static already_AddRefed<Promise> GetGMPContentDecryptionModuleInformation(
|
||||
GlobalObject& aGlobal, ErrorResult& aRv);
|
||||
|
||||
private:
|
||||
// Number of DevTools session debugging the current process
|
||||
static std::atomic<uint32_t> sDevToolsOpenedCount;
|
||||
|
|
|
|||
|
|
@ -306,6 +306,13 @@ namespace ChromeUtils {
|
|||
Promise<sequence<CDMInformation>> getWMFContentDecryptionModuleInformation();
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns the information about the GMP based content decryption
|
||||
* modules, which would include key system names and their capabilities.
|
||||
*/
|
||||
[NewObject]
|
||||
Promise<sequence<CDMInformation>> getGMPContentDecryptionModuleInformation();
|
||||
|
||||
/**
|
||||
* IF YOU ADD NEW METHODS HERE, MAKE SURE THEY ARE THREAD-SAFE.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -211,6 +211,30 @@ bool KeySystemConfig::IsSameKeySystem(const nsAString& aKeySystem) const {
|
|||
return mKeySystem.Equals(aKeySystem);
|
||||
}
|
||||
|
||||
/* static */
|
||||
void KeySystemConfig::GetGMPKeySystemConfigs(dom::Promise* aPromise) {
|
||||
MOZ_ASSERT(aPromise);
|
||||
nsTArray<KeySystemConfig> keySystemConfigs;
|
||||
const nsTArray<nsString> keySystemNames{
|
||||
NS_ConvertUTF8toUTF16(kClearKeyKeySystemName),
|
||||
NS_ConvertUTF8toUTF16(kWidevineKeySystemName),
|
||||
};
|
||||
FallibleTArray<dom::CDMInformation> cdmInfo;
|
||||
for (const auto& name : keySystemNames) {
|
||||
if (KeySystemConfig::CreateKeySystemConfigs(name, keySystemConfigs)) {
|
||||
auto* info = cdmInfo.AppendElement(fallible);
|
||||
if (!info) {
|
||||
aPromise->MaybeReject(NS_ERROR_OUT_OF_MEMORY);
|
||||
return;
|
||||
}
|
||||
MOZ_ASSERT(keySystemConfigs.Length() == cdmInfo.Length());
|
||||
info->mKeySystemName = name;
|
||||
info->mCapabilities = keySystemConfigs.LastElement().GetDebugInfo();
|
||||
}
|
||||
}
|
||||
aPromise->MaybeResolve(cdmInfo);
|
||||
}
|
||||
|
||||
nsString KeySystemConfig::GetDebugInfo() const {
|
||||
nsString debugInfo;
|
||||
debugInfo.AppendLiteral(" key-system=");
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ struct KeySystemConfig {
|
|||
static bool Supports(const nsAString& aKeySystem);
|
||||
static bool CreateKeySystemConfigs(const nsAString& aKeySystem,
|
||||
nsTArray<KeySystemConfig>& aOutConfigs);
|
||||
static void GetGMPKeySystemConfigs(dom::Promise* aPromise);
|
||||
|
||||
KeySystemConfig() = default;
|
||||
~KeySystemConfig() = default;
|
||||
|
|
|
|||
|
|
@ -1182,10 +1182,15 @@ var snapshotFormatters = {
|
|||
|
||||
async function insertContentDecryptionModuleInfo() {
|
||||
let rows = [];
|
||||
// Retrieve information from GMPCDM
|
||||
let cdmInfo =
|
||||
await ChromeUtils.getGMPContentDecryptionModuleInformation();
|
||||
for (let info of cdmInfo) {
|
||||
rows.push(createCDMInfoRow(info));
|
||||
}
|
||||
// Retrieve information from WMFCDM, only works when MOZ_WMF_CDM is true
|
||||
if (ChromeUtils.getWMFContentDecryptionModuleInformation !== undefined) {
|
||||
const cdmInfo =
|
||||
await ChromeUtils.getWMFContentDecryptionModuleInformation();
|
||||
cdmInfo = await ChromeUtils.getWMFContentDecryptionModuleInformation();
|
||||
for (let info of cdmInfo) {
|
||||
rows.push(createCDMInfoRow(info));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue