mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
undo changes to WebContentsPreferences::GetPreloadPath to fix mac build
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user