Add ability to set arbitrary arguments in a renderer process (#11850)
This commit is contained in:
parent
66b57858b8
commit
b3234f634b
6 changed files with 57 additions and 0 deletions
|
@ -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) &&
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue