fix: ensure that requestMediaKeySystemAccess resolves (#34886)

When widevine was disabled at the build level we never dealt with the callback passed into GetSupportedKeySystems.  This was ok until requests became marked pending in https://chromium-review.googlesource.com/c/chromium/src/+/3430502 until the callback was called.  This resulted in a promise never resolving / rejecting and certain media websites (E.g. spotify) hanging on load waiting for a signal that would never arrive.
This commit is contained in:
Samuel Attard 2022-07-12 00:48:51 -07:00 committed by GitHub
commit 511ff8bc8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 8 deletions

View file

@ -47,6 +47,7 @@
#include "third_party/blink/public/web/web_view.h"
#include "third_party/blink/renderer/platform/media/multi_buffer_data_source.h" // nogncheck
#include "third_party/blink/renderer/platform/weborigin/scheme_registry.h" // nogncheck
#include "third_party/widevine/cdm/buildflags.h"
#if BUILDFLAG(IS_MAC)
#include "base/strings/sys_string_conversions.h"
@ -56,7 +57,7 @@
#include <shlobj.h>
#endif
#if defined(WIDEVINE_CDM_AVAILABLE)
#if BUILDFLAG(ENABLE_WIDEVINE)
#include "chrome/renderer/media/chrome_key_systems.h" // nogncheck
#endif
@ -377,8 +378,10 @@ bool RendererClientBase::OverrideCreatePlugin(
void RendererClientBase::GetSupportedKeySystems(
media::GetSupportedKeySystemsCB cb) {
#if defined(WIDEVINE_CDM_AVAILABLE)
#if BUILDFLAG(ENABLE_WIDEVINE)
GetChromeKeySystems(std::move(cb));
#else
std::move(cb).Run({});
#endif
}