|
26 | 26 | #include "shell/common/gin_converters/value_converter.h" |
27 | 27 | #include "shell/common/gin_helper/dictionary.h" |
28 | 28 | #include "shell/common/options_switches.h" |
| 29 | +#include "shell/common/process_util.h" |
29 | 30 | #include "third_party/blink/public/mojom/v8_cache_options.mojom.h" |
30 | 31 |
|
31 | 32 | #if defined(OS_WIN) |
@@ -126,6 +127,15 @@ WebContentsPreferences::WebContentsPreferences( |
126 | 127 | SetDefaultBoolIfUndefined(options::kWebviewTag, false); |
127 | 128 | SetDefaultBoolIfUndefined(options::kSandbox, false); |
128 | 129 | SetDefaultBoolIfUndefined(options::kNativeWindowOpen, false); |
| 130 | + if (IsUndefined(options::kContextIsolation)) { |
| 131 | + node::Environment* env = node::Environment::GetCurrent(isolate); |
| 132 | + EmitWarning(env, |
| 133 | + "The default of contextIsolation is deprecated and will be " |
| 134 | + "changing from false to true in a future release of Electron. " |
| 135 | + "See https://github.com/electron/electron/issues/23506 for " |
| 136 | + "more information", |
| 137 | + "electron"); |
| 138 | + } |
129 | 139 | SetDefaultBoolIfUndefined(options::kContextIsolation, false); |
130 | 140 | SetDefaultBoolIfUndefined(options::kJavaScript, true); |
131 | 141 | SetDefaultBoolIfUndefined(options::kImages, true); |
@@ -183,6 +193,10 @@ void WebContentsPreferences::SetDefaults() { |
183 | 193 | last_preference_ = preference_.Clone(); |
184 | 194 | } |
185 | 195 |
|
| 196 | +bool WebContentsPreferences::IsUndefined(base::StringPiece key) { |
| 197 | + return !preference_.FindKeyOfType(key, base::Value::Type::BOOLEAN); |
| 198 | +} |
| 199 | + |
186 | 200 | bool WebContentsPreferences::SetDefaultBoolIfUndefined(base::StringPiece key, |
187 | 201 | bool val) { |
188 | 202 | auto* current_value = |
|
0 commit comments