mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-20 06:59:47 +00:00
LibWeb/EME: Implement get_supported_configuration
This commit is contained in:
parent
ca66a4933e
commit
7b9d5f9fdc
Notes:
github-actions[bot]
2025-08-27 07:59:21 +00:00
Author: https://github.com/stelar7
Commit: 7b9d5f9fdc
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5665
Reviewed-by: https://github.com/gmta ✅
Reviewed-by: https://github.com/trflynn89
2 changed files with 29 additions and 1 deletions
|
@ -372,4 +372,31 @@ Optional<ConsentConfiguration> get_supported_configuration_and_consent(KeySystem
|
|||
return ConsentConfiguration { consent_status, accumulated_configuration };
|
||||
}
|
||||
|
||||
// https://w3c.github.io/encrypted-media/#get-supported-configuration
|
||||
Optional<ConsentConfiguration> get_supported_configuration(KeySystem const& implementation, Bindings::MediaKeySystemConfiguration const& candidate_configuration, URL::Origin const& origin)
|
||||
{
|
||||
// 1. Let supported configuration be ConsentDenied.
|
||||
Optional<ConsentConfiguration> supported_configuration = ConsentConfiguration { ConsentStatus::ConsentDenied, {} };
|
||||
|
||||
// 2. Initialize restrictions to indicate that no configurations have had user consent denied.
|
||||
MediaKeyRestrictions restrictions;
|
||||
|
||||
size_t loop_count = 0;
|
||||
|
||||
// 3. Repeat the following step while supported configuration is ConsentDenied:
|
||||
while (supported_configuration.has_value() && supported_configuration->status == ConsentStatus::ConsentDenied) {
|
||||
// 1. Let supported configuration and, if provided, restrictions be the result of executing
|
||||
// the Get Supported Configuration and Consent algorithm with implementation, candidate configuration, restrictions and origin.
|
||||
supported_configuration = get_supported_configuration_and_consent(implementation, candidate_configuration, restrictions, origin);
|
||||
|
||||
// AD-HOC: While this is being implemented, we use this to avoid a possible infinite loop
|
||||
if (loop_count++ > 5) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 4. Return supported configuration.
|
||||
return supported_configuration;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue