feat: enable context isolation by default (#26890)

* feat: enable context isolation by default

* chore: set default in ctx iso getter

* spec: make all specs work with the new contextIsolation default

* spec: fix affinity specs

* spec: update tests for new ctx iso default

* spec: update tests for new ctx iso default

* spec: update tests for new ctx iso default

* spec: update tests for new ctx iso default

* chore: move stray prod deps to dev deps

* spec: update tests for new ctx iso default

* turn off contextIsolation for visibility tests

* turn off contextIsolation for <webview> tag nodeintegration attribute loads native modules when navigation happens

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
This commit is contained in:
Samuel Attard 2021-03-01 13:52:29 -08:00 committed by GitHub
parent 2d0ad0b96a
commit 186301e126
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 291 additions and 194 deletions

View file

@ -127,16 +127,7 @@ WebContentsPreferences::WebContentsPreferences(
SetDefaultBoolIfUndefined(options::kWebviewTag, false);
SetDefaultBoolIfUndefined(options::kSandbox, false);
SetDefaultBoolIfUndefined(options::kNativeWindowOpen, false);
if (IsUndefined(options::kContextIsolation)) {
node::Environment* env = node::Environment::GetCurrent(isolate);
EmitWarning(env,
"The default of contextIsolation is deprecated and will be "
"changing from false to true in a future release of Electron. "
"See https://github.com/electron/electron/issues/23506 for "
"more information",
"electron");
}
SetDefaultBoolIfUndefined(options::kContextIsolation, false);
SetDefaultBoolIfUndefined(options::kContextIsolation, true);
SetDefaultBoolIfUndefined(options::kWorldSafeExecuteJavaScript, true);
SetDefaultBoolIfUndefined(options::kJavaScript, true);
SetDefaultBoolIfUndefined(options::kImages, true);
@ -429,7 +420,7 @@ void WebContentsPreferences::OverrideWebkitPrefs(
prefs->opener_id = opener_id;
// Run Electron APIs and preload script in isolated world
prefs->context_isolation = IsEnabled(options::kContextIsolation);
prefs->context_isolation = IsEnabled(options::kContextIsolation, true);
#if BUILDFLAG(ENABLE_REMOTE_MODULE)
// Whether to enable the remote module