Add ability to set arbitrary arguments in a renderer process (#11850)

This commit is contained in:
Samuel Attard 2018-02-13 04:54:31 +11:00 committed by Charles Kerr
parent 66b57858b8
commit b3234f634b
6 changed files with 57 additions and 0 deletions

View file

@ -136,6 +136,17 @@ void WebContentsPreferences::AppendExtraCommandLineSwitches(
LOG(ERROR) << "preload url must be file:// protocol.";
}
// Custom args for renderer process
base::Value* customArgs;
if ((web_preferences.Get(options::kCustomArgs, &customArgs))
&& (customArgs->is_list())) {
for (const base::Value& customArg : customArgs->GetList()) {
if (customArg.is_string()) {
command_line->AppendArg(customArg.GetString());
}
}
}
// Run Electron APIs and preload script in isolated world
bool isolated;
if (web_preferences.GetBoolean(options::kContextIsolation, &isolated) &&

View file

@ -139,6 +139,8 @@ const char kNodeIntegrationInWorker[] = "nodeIntegrationInWorker";
// Enable the web view tag.
const char kWebviewTag[] = "webviewTag";
const char kCustomArgs[] = "additionalArguments";
} // namespace options
namespace switches {

View file

@ -68,6 +68,7 @@ extern const char kBlinkFeatures[];
extern const char kDisableBlinkFeatures[];
extern const char kNodeIntegrationInWorker[];
extern const char kWebviewTag[];
extern const char kCustomArgs[];
} // namespace options