mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
Add ability to set arbitrary arguments in a renderer process (#11850)
This commit is contained in:
committed by
Charles Kerr
parent
66b57858b8
commit
b3234f634b
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user