From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Andy Locascio Date: Wed, 6 May 2020 16:37:54 -0700 Subject: allow in-process windows to have different web prefs Allow earlier access to newly created WebContents so that we can change WebPreferences of in-process child windows, rather than relying on process-level command line switches, as before. diff --git a/third_party/blink/common/web_preferences/web_preferences.cc b/third_party/blink/common/web_preferences/web_preferences.cc index 4f332fd867bed29f084891e5f2b281f5c99c011b..f63fda73d2b3337de60d23caacd9a0f0ae77364e 100644 --- a/third_party/blink/common/web_preferences/web_preferences.cc +++ b/third_party/blink/common/web_preferences/web_preferences.cc @@ -146,6 +146,19 @@ WebPreferences::WebPreferences() v8_cache_options(blink::mojom::V8CacheOptions::kDefault), record_whole_document(false), stylus_handwriting_enabled(false), + // Begin Electron-specific WebPreferences. + context_isolation(false), + is_webview(false), + hidden_page(false), + offscreen(false), + node_integration(false), + node_integration_in_worker(false), + node_integration_in_sub_frames(false), + enable_spellcheck(false), + enable_plugins(false), + enable_websql(false), + webview_tag(false), + // End Electron-specific WebPreferences. cookie_enabled(true), accelerated_video_decode_enabled(false), animation_policy( diff --git a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc index 62b6af4669061757f3f707859f0296fd6c49bade..cbeece7a75f8c7a7169ea6b768bf0a056c849ee6 100644 --- a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc +++ b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc @@ -150,6 +150,19 @@ bool StructTraitsv8_cache_options = data.v8_cache_options(); out->record_whole_document = data.record_whole_document(); out->stylus_handwriting_enabled = data.stylus_handwriting_enabled(); + // Begin Electron-specific WebPreferences. + out->context_isolation = data.context_isolation(); + out->is_webview = data.is_webview(); + out->hidden_page = data.hidden_page(); + out->offscreen = data.offscreen(); + out->node_integration = data.node_integration(); + out->node_integration_in_worker = data.node_integration_in_worker(); + out->node_integration_in_sub_frames = data.node_integration_in_sub_frames(); + out->enable_spellcheck = data.enable_spellcheck(); + out->enable_plugins = data.enable_plugins(); + out->enable_websql = data.enable_websql(); + out->webview_tag = data.webview_tag(); + // End Electron-specific WebPreferences. out->cookie_enabled = data.cookie_enabled(); out->accelerated_video_decode_enabled = data.accelerated_video_decode_enabled(); diff --git a/third_party/blink/public/common/web_preferences/web_preferences.h b/third_party/blink/public/common/web_preferences/web_preferences.h index 8821fe095126feef49e50b87b84c29d1fa956a9b..61565991cc66a31e428cdf3fb0f457db08aaa901 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences.h +++ b/third_party/blink/public/common/web_preferences/web_preferences.h @@ -10,6 +10,7 @@ #include #include "build/build_config.h" +#include "base/files/file_path.h" #include "net/nqe/effective_connection_type.h" #include "third_party/blink/public/common/common_export.h" #include "third_party/blink/public/mojom/css/preferred_color_scheme.mojom-shared.h" @@ -161,6 +162,19 @@ struct BLINK_COMMON_EXPORT WebPreferences { // If true, stylus handwriting recognition to text input will be available in // editable input fields which are non-password type. bool stylus_handwriting_enabled; + // Begin Electron-specific WebPreferences. + bool context_isolation; + bool is_webview; + bool hidden_page; + bool offscreen; + bool node_integration; + bool node_integration_in_worker; + bool node_integration_in_sub_frames; + bool enable_spellcheck; + bool enable_plugins; + bool enable_websql; + bool webview_tag; + // End Electron-specific WebPreferences. // This flags corresponds to a Page's Settings' setCookieEnabled state. It // only controls whether or not the "document.cookie" field is properly diff --git a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h index 4e95e23afe936cb87b4390a977c69b1b8263335c..bec35f10856c982febf45dcc3a2ee651f5bf4fed 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h +++ b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h @@ -6,6 +6,7 @@ #define THIRD_PARTY_BLINK_PUBLIC_COMMON_WEB_PREFERENCES_WEB_PREFERENCES_MOJOM_TRAITS_H_ #include "build/build_config.h" +#include "mojo/public/cpp/base/file_path_mojom_traits.h" #include "mojo/public/cpp/bindings/struct_traits.h" #include "net/nqe/effective_connection_type.h" #include "third_party/blink/public/common/common_export.h" @@ -448,6 +449,52 @@ struct BLINK_COMMON_EXPORT StructTraits