feat: remove nativeWindowOpen option (#29405)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com> Co-authored-by: Milan Burda <milan.burda@gmail.com>
This commit is contained in:
parent
2f9fd06534
commit
d44a187d0b
39 changed files with 316 additions and 1164 deletions
|
@ -81,8 +81,7 @@ BrowserView::BrowserView(gin::Arguments* args,
|
|||
|
||||
v8::Local<v8::Value> value;
|
||||
|
||||
// Copy the webContents option to webPreferences. This is only used internally
|
||||
// to implement nativeWindowOpen option.
|
||||
// Copy the webContents option to webPreferences.
|
||||
if (options.Get("webContents", &value)) {
|
||||
web_preferences.SetHidden("webContents", value);
|
||||
}
|
||||
|
|
|
@ -78,8 +78,7 @@ BrowserWindow::BrowserWindow(gin::Arguments* args,
|
|||
web_preferences.Set(options::kEnableBlinkFeatures, enabled_features);
|
||||
}
|
||||
|
||||
// Copy the webContents option to webPreferences. This is only used internally
|
||||
// to implement nativeWindowOpen option.
|
||||
// Copy the webContents option to webPreferences.
|
||||
if (options.Get("webContents", &value)) {
|
||||
web_preferences.SetHidden("webContents", value);
|
||||
}
|
||||
|
|
|
@ -721,7 +721,7 @@ bool ElectronBrowserClient::CanCreateWindow(
|
|||
content::WebContents* web_contents =
|
||||
content::WebContents::FromRenderFrameHost(opener);
|
||||
WebContentsPreferences* prefs = WebContentsPreferences::From(web_contents);
|
||||
if (prefs && prefs->ShouldUseNativeWindowOpen()) {
|
||||
if (prefs) {
|
||||
if (prefs->ShouldDisablePopups()) {
|
||||
// <webview> without allowpopups attribute should return
|
||||
// null from window.open calls
|
||||
|
|
|
@ -130,7 +130,6 @@ void WebContentsPreferences::Clear() {
|
|||
disable_html_fullscreen_window_resize_ = false;
|
||||
webview_tag_ = false;
|
||||
sandbox_ = absl::nullopt;
|
||||
native_window_open_ = true;
|
||||
context_isolation_ = true;
|
||||
javascript_ = true;
|
||||
images_ = true;
|
||||
|
@ -148,7 +147,6 @@ void WebContentsPreferences::Clear() {
|
|||
default_monospace_font_size_ = absl::nullopt;
|
||||
minimum_font_size_ = absl::nullopt;
|
||||
default_encoding_ = absl::nullopt;
|
||||
opener_id_ = 0;
|
||||
is_webview_ = false;
|
||||
custom_args_.clear();
|
||||
custom_switches_.clear();
|
||||
|
@ -194,7 +192,6 @@ void WebContentsPreferences::Merge(
|
|||
bool sandbox;
|
||||
if (web_preferences.Get(options::kSandbox, &sandbox))
|
||||
sandbox_ = sandbox;
|
||||
web_preferences.Get(options::kNativeWindowOpen, &native_window_open_);
|
||||
web_preferences.Get(options::kContextIsolation, &context_isolation_);
|
||||
web_preferences.Get(options::kJavaScript, &javascript_);
|
||||
web_preferences.Get(options::kImages, &images_);
|
||||
|
@ -223,7 +220,6 @@ void WebContentsPreferences::Merge(
|
|||
std::string encoding;
|
||||
if (web_preferences.Get("defaultEncoding", &encoding))
|
||||
default_encoding_ = encoding;
|
||||
web_preferences.Get(options::kOpenerID, &opener_id_);
|
||||
web_preferences.Get(options::kCustomArgs, &custom_args_);
|
||||
web_preferences.Get("commandLineSwitches", &custom_switches_);
|
||||
web_preferences.Get("disablePopups", &disable_popups_);
|
||||
|
@ -406,13 +402,10 @@ void WebContentsPreferences::AppendCommandLineSwitches(
|
|||
|
||||
void WebContentsPreferences::SaveLastPreferences() {
|
||||
last_web_preferences_ = base::Value(base::Value::Type::DICTIONARY);
|
||||
last_web_preferences_.SetKey(options::kOpenerID, base::Value(opener_id_));
|
||||
last_web_preferences_.SetKey(options::kNodeIntegration,
|
||||
base::Value(node_integration_));
|
||||
last_web_preferences_.SetKey(options::kNodeIntegrationInSubFrames,
|
||||
base::Value(node_integration_in_sub_frames_));
|
||||
last_web_preferences_.SetKey(options::kNativeWindowOpen,
|
||||
base::Value(native_window_open_));
|
||||
last_web_preferences_.SetKey(options::kSandbox, base::Value(IsSandboxed()));
|
||||
last_web_preferences_.SetKey(options::kContextIsolation,
|
||||
base::Value(context_isolation_));
|
||||
|
@ -477,9 +470,6 @@ void WebContentsPreferences::OverrideWebkitPrefs(
|
|||
if (default_encoding_)
|
||||
prefs->default_encoding = *default_encoding_;
|
||||
|
||||
// Pass the opener's window id.
|
||||
prefs->opener_id = opener_id_;
|
||||
|
||||
// Run Electron APIs and preload script in isolated world
|
||||
prefs->context_isolation = context_isolation_;
|
||||
prefs->is_webview = is_webview_;
|
||||
|
@ -507,7 +497,6 @@ void WebContentsPreferences::OverrideWebkitPrefs(
|
|||
if (preload_path_)
|
||||
prefs->preload = *preload_path_;
|
||||
|
||||
prefs->native_window_open = native_window_open_;
|
||||
prefs->node_integration = node_integration_;
|
||||
prefs->node_integration_in_worker = node_integration_in_worker_;
|
||||
prefs->node_integration_in_sub_frames = node_integration_in_sub_frames_;
|
||||
|
|
|
@ -75,7 +75,6 @@ class WebContentsPreferences
|
|||
bool ShouldUseSafeDialogs() const { return safe_dialogs_; }
|
||||
bool GetSafeDialogsMessage(std::string* message) const;
|
||||
bool ShouldDisablePopups() const { return disable_popups_; }
|
||||
bool ShouldUseNativeWindowOpen() const { return native_window_open_; }
|
||||
bool IsWebSecurityEnabled() const { return web_security_; }
|
||||
bool GetPreloadPath(base::FilePath* path) const;
|
||||
bool IsSandboxed() const;
|
||||
|
@ -100,7 +99,6 @@ class WebContentsPreferences
|
|||
bool disable_html_fullscreen_window_resize_;
|
||||
bool webview_tag_;
|
||||
absl::optional<bool> sandbox_;
|
||||
bool native_window_open_;
|
||||
bool context_isolation_;
|
||||
bool javascript_;
|
||||
bool images_;
|
||||
|
@ -118,7 +116,6 @@ class WebContentsPreferences
|
|||
absl::optional<int> default_monospace_font_size_;
|
||||
absl::optional<int> minimum_font_size_;
|
||||
absl::optional<std::string> default_encoding_;
|
||||
int opener_id_;
|
||||
bool is_webview_;
|
||||
std::vector<std::string> custom_args_;
|
||||
std::vector<std::string> custom_switches_;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue