1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:38:11 +00:00

LibWeb: Implement the CORS settings attribute credentials mode AO

This commit is contained in:
Timothy Flynn 2023-05-10 16:24:52 -04:00 committed by Andreas Kling
parent 9070aaebee
commit 9701128145
2 changed files with 22 additions and 0 deletions

View file

@ -26,4 +26,24 @@ CORSSettingAttribute cors_setting_attribute_from_keyword(Optional<String> const&
return CORSSettingAttribute::Anonymous;
}
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#cors-settings-attribute-credentials-mode
Fetch::Infrastructure::Request::CredentialsMode cors_settings_attribute_credentials_mode(CORSSettingAttribute attribute)
{
switch (attribute) {
// -> No CORS
// -> Anonymous
case CORSSettingAttribute::NoCORS:
case CORSSettingAttribute::Anonymous:
// "same-origin"
return Fetch::Infrastructure::Request::CredentialsMode::SameOrigin;
// -> Use Credentials
case CORSSettingAttribute::UseCredentials:
// "include"
return Fetch::Infrastructure::Request::CredentialsMode::Include;
}
VERIFY_NOT_REACHED();
}
}