fix: ignore non-absolute session preload script paths when sandboxed (#19066)

This commit is contained in:
Milan Burda 2019-07-03 17:05:45 +02:00 committed by John Kleinschmidt
parent 50b9c7051e
commit 69ea0b4ebf
10 changed files with 46 additions and 64 deletions

View file

@ -151,6 +151,12 @@ void SetApplicationLocaleOnIOThread(const std::string& locale) {
g_io_thread_application_locale.Get() = locale;
}
#if defined(OS_WIN)
const base::FilePath::StringPieceType kPathDelimiter = FILE_PATH_LITERAL(";");
#else
const base::FilePath::StringPieceType kPathDelimiter = FILE_PATH_LITERAL(":");
#endif
} // namespace
// static
@ -539,8 +545,12 @@ void AtomBrowserClient::AppendExtraCommandLineSwitches(
if (web_preferences)
web_preferences->AppendCommandLineSwitches(
command_line, IsRendererSubFrame(process_id));
SessionPreferences::AppendExtraCommandLineSwitches(
web_contents->GetBrowserContext(), command_line);
auto preloads =
SessionPreferences::GetValidPreloads(web_contents->GetBrowserContext());
if (!preloads.empty())
command_line->AppendSwitchNative(
switches::kPreloadScripts,
base::JoinString(preloads, kPathDelimiter));
if (CanUseCustomSiteInstance()) {
command_line->AppendSwitch(
switches::kDisableElectronSiteInstanceOverrides);