undo changes to WebContentsPreferences::GetPreloadPath to fix mac build

This commit is contained in:
Jeremy Rose 2021-03-22 10:35:11 -07:00
parent 2d3c65beca
commit deeb2de14b

View file

@ -235,24 +235,18 @@ bool WebContentsPreferences::GetPreference(base::StringPiece name,
bool WebContentsPreferences::GetPreloadPath(base::FilePath* path) const {
DCHECK(path);
base::FilePath::StringType preload_path;
std::u16string preload_path_str;
if (GetAsString(&preference_, options::kPreloadScript, &preload_path_str)) {
#if defined(OS_WIN)
base::FilePath preload(base::UTF16ToWide(preload_path_str));
#else
base::FilePath preload(preload_path_str);
#endif
if (GetAsString(&preference_, options::kPreloadScript, &preload_path)) {
base::FilePath preload(preload_path);
if (preload.IsAbsolute()) {
*path = std::move(preload);
return true;
} else {
LOG(ERROR) << "preload script must have absolute path.";
}
} else if (GetAsString(&preference_, options::kPreloadURL,
&preload_path_str)) {
} else if (GetAsString(&preference_, options::kPreloadURL, &preload_path)) {
// Translate to file path if there is "preload-url" option.
base::FilePath preload;
if (net::FileURLToFilePath(GURL(preload_path_str), &preload)) {
if (net::FileURLToFilePath(GURL(preload_path), &preload)) {
*path = std::move(preload);
return true;
} else {