Fix CefCommandLine character case requirements (fixes issue #1872)

Switch names will now be converted to lowercase ASCII on all platforms.
Switch values will retain the original case and UTF8 encoding.
This commit is contained in:
Marshall Greenblatt
2021-09-27 13:36:08 +03:00
parent 6516b569a9
commit 4d1c5ebdd2
6 changed files with 58 additions and 15 deletions

View File

@@ -6,6 +6,7 @@
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/strings/string_util.h"
CefCommandLineImpl::CefCommandLineImpl(base::CommandLine* value,
bool will_delete,
@@ -90,12 +91,13 @@ bool CefCommandLineImpl::HasSwitches() {
bool CefCommandLineImpl::HasSwitch(const CefString& name) {
CEF_VALUE_VERIFY_RETURN(false, false);
return const_value().HasSwitch(name.ToString());
return const_value().HasSwitch(base::ToLowerASCII(name.ToString()));
}
CefString CefCommandLineImpl::GetSwitchValue(const CefString& name) {
CEF_VALUE_VERIFY_RETURN(false, CefString());
return const_value().GetSwitchValueNative(name.ToString());
return const_value().GetSwitchValueNative(
base::ToLowerASCII(name.ToString()));
}
void CefCommandLineImpl::GetSwitches(SwitchMap& switches) {