123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
- From: Andy Locascio <[email protected]>
- 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_mojom_traits.cc b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc
- index 31c4d7c5d17763a38fd8a814efbc599663e6c816..c7e705030b39a961cd98610908e231cc71158002 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
- @@ -149,6 +149,19 @@ bool StructTraits<blink::mojom::WebPreferencesDataView,
- out->v8_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 5c33a83513e528ada518751899a7c640c14dacf7..4b14c0fa75e65fca91e100969fb9707120d199ca 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 <vector>
-
- #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"
- @@ -420,6 +421,20 @@ struct BLINK_COMMON_EXPORT WebPreferences {
- // blocking user's access to the background web content.
- bool modal_context_menu = true;
-
- + // Begin Electron-specific WebPreferences.
- + bool context_isolation = false;
- + bool is_webview = false;
- + bool hidden_page = false;
- + bool offscreen = false;
- + bool node_integration = false;
- + bool node_integration_in_worker = false;
- + bool node_integration_in_sub_frames = false;
- + bool enable_spellcheck = false;
- + bool enable_plugins = false;
- + bool enable_websql = false;
- + bool webview_tag = false;
- + // End Electron-specific WebPreferences.
- +
- // We try to keep the default values the same as the default values in
- // chrome, except for the cases where it would require lots of extra work for
- // the embedder to use the same default value.
- 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 f54089ad64fa5a3c19d084821d188be1a623d548..7129aa8c9c63d31b6eede9e57fa37e2ec3efd257 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"
- @@ -439,6 +440,52 @@ struct BLINK_COMMON_EXPORT StructTraits<blink::mojom::WebPreferencesDataView,
- return r.stylus_handwriting_enabled;
- }
-
- + // Begin Electron-specific WebPreferences.
- + static bool context_isolation(const blink::web_pref::WebPreferences& r) {
- + return r.context_isolation;
- + }
- +
- + static int is_webview(const blink::web_pref::WebPreferences& r) {
- + return r.is_webview;
- + }
- +
- + static bool hidden_page(const blink::web_pref::WebPreferences& r) {
- + return r.hidden_page;
- + }
- +
- + static bool offscreen(const blink::web_pref::WebPreferences& r) {
- + return r.offscreen;
- + }
- +
- + static bool node_integration(const blink::web_pref::WebPreferences& r) {
- + return r.node_integration;
- + }
- +
- + static bool node_integration_in_worker(const blink::web_pref::WebPreferences& r) {
- + return r.node_integration_in_worker;
- + }
- +
- + static bool node_integration_in_sub_frames(const blink::web_pref::WebPreferences& r) {
- + return r.node_integration_in_sub_frames;
- + }
- +
- + static bool enable_spellcheck(const blink::web_pref::WebPreferences& r) {
- + return r.enable_spellcheck;
- + }
- +
- + static bool enable_plugins(const blink::web_pref::WebPreferences& r) {
- + return r.enable_plugins;
- + }
- +
- + static bool enable_websql(const blink::web_pref::WebPreferences& r) {
- + return r.enable_websql;
- + }
- +
- + static bool webview_tag(const blink::web_pref::WebPreferences& r) {
- + return r.webview_tag;
- + }
- + // End Electron-specific WebPreferences.
- +
- static bool cookie_enabled(const blink::web_pref::WebPreferences& r) {
- return r.cookie_enabled;
- }
- diff --git a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom
- index 54f3a206c8ab571563a5ac70ea32edbe844d2057..8376c8f8d5f56adea2ffce3d8d66a6dbc16a6ee6 100644
- --- a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom
- +++ b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom
- @@ -9,6 +9,7 @@ import "third_party/blink/public/mojom/css/preferred_contrast.mojom";
- import "third_party/blink/public/mojom/v8_cache_options.mojom";
- import "url/mojom/url.mojom";
- import "mojo/public/mojom/base/string16.mojom";
- +import "mojo/public/mojom/base/file_path.mojom";
-
- enum PointerType {
- kPointerNone = 1, // 1 << 0
- @@ -218,6 +219,19 @@ struct 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
|