refactor: implement isRemoteModuleEnabled via getLastWebPreferences() (#19220)
This commit is contained in:
parent
04debd5890
commit
01fdb80f7c
9 changed files with 13 additions and 30 deletions
|
@ -124,7 +124,6 @@ WebContentsPreferences::WebContentsPreferences(
|
|||
SetDefaultBoolIfUndefined(options::kWebviewTag, false);
|
||||
SetDefaultBoolIfUndefined(options::kSandbox, false);
|
||||
SetDefaultBoolIfUndefined(options::kNativeWindowOpen, false);
|
||||
SetDefaultBoolIfUndefined(options::kEnableRemoteModule, true);
|
||||
SetDefaultBoolIfUndefined(options::kContextIsolation, false);
|
||||
SetDefaultBoolIfUndefined(options::kJavaScript, true);
|
||||
SetDefaultBoolIfUndefined(options::kImages, true);
|
||||
|
@ -171,6 +170,8 @@ WebContentsPreferences::~WebContentsPreferences() {
|
|||
}
|
||||
|
||||
void WebContentsPreferences::SetDefaults() {
|
||||
SetDefaultBoolIfUndefined(options::kEnableRemoteModule, true);
|
||||
|
||||
if (IsEnabled(options::kSandbox)) {
|
||||
SetBool(options::kNativeWindowOpen, true);
|
||||
}
|
||||
|
@ -220,10 +221,6 @@ bool WebContentsPreferences::GetPreference(base::StringPiece name,
|
|||
return GetAsString(&preference_, name, value);
|
||||
}
|
||||
|
||||
bool WebContentsPreferences::IsRemoteModuleEnabled() const {
|
||||
return IsEnabled(options::kEnableRemoteModule, true);
|
||||
}
|
||||
|
||||
bool WebContentsPreferences::GetPreloadPath(
|
||||
base::FilePath::StringType* path) const {
|
||||
DCHECK(path);
|
||||
|
@ -327,8 +324,8 @@ void WebContentsPreferences::AppendCommandLineSwitches(
|
|||
}
|
||||
|
||||
// Whether to enable the remote module
|
||||
if (!IsRemoteModuleEnabled())
|
||||
command_line->AppendSwitch(switches::kDisableRemoteModule);
|
||||
if (IsEnabled(options::kEnableRemoteModule))
|
||||
command_line->AppendSwitch(switches::kEnableRemoteModule);
|
||||
|
||||
// Run Electron APIs and preload script in isolated world
|
||||
if (IsEnabled(options::kContextIsolation))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue