/
allow_in-process_windows_to_have_different_web_prefs.patch
188 lines (180 loc) · 8.1 KB
/
allow_in-process_windows_to_have_different_web_prefs.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Andy Locascio <andy@slack-corp.com>
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 6d51f6a77c21b60ab756dbf8d4961b351a2e2b07..26b820b3ce387e01900cec4227ff290113a833c3 100644
--- a/third_party/blink/common/web_preferences/web_preferences.cc
+++ b/third_party/blink/common/web_preferences/web_preferences.cc
@@ -142,6 +142,19 @@ WebPreferences::WebPreferences()
fake_no_alloc_direct_call_for_testing_enabled(false),
v8_cache_options(blink::mojom::V8CacheOptions::kDefault),
record_whole_document(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 187fd8d9818693262256d5cbddd5e02659ba903d..28e5178361e03d1ac851fa74214931b2332dd9c2 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
@@ -148,6 +148,19 @@ bool StructTraits<blink::mojom::WebPreferencesDataView,
data.fake_no_alloc_direct_call_for_testing_enabled();
out->v8_cache_options = data.v8_cache_options();
out->record_whole_document = data.record_whole_document();
+ // 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.s
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 59947bfd3c042e5f7d3993967fece9b519f93472..cb2a53f6147767394585ed371744d8a140aace71 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"
@@ -154,6 +155,20 @@ struct BLINK_COMMON_EXPORT WebPreferences {
blink::mojom::V8CacheOptions v8_cache_options;
bool record_whole_document;
+ // 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
// connected to the backing store, for instance if you wanted to be able to
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 bd425a5869477de9095c6a41c683609d065b08c0..c7ba3ff52c9de01028c9e2be214e20cd91cbf309 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"
@@ -428,6 +429,52 @@ struct BLINK_COMMON_EXPORT StructTraits<blink::mojom::WebPreferencesDataView,
return r.record_whole_document;
}
+ // 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 738ac646e075f7a37ba2a263c7799a755e63d3fb..40ab2a4b9a1f9de5f201502adebc166a48fccd35 100644
--- a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom
+++ b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom
@@ -10,6 +10,7 @@ import "third_party/blink/public/mojom/v8_cache_options.mojom";
import "url/mojom/url.mojom";
import "url/mojom/origin.mojom";
import "mojo/public/mojom/base/string16.mojom";
+import "mojo/public/mojom/base/file_path.mojom";
enum PointerType {
kPointerNone = 1, // 1 << 0
@@ -206,6 +207,20 @@ struct WebPreferences {
V8CacheOptions v8_cache_options;
bool record_whole_document;
+ // 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
// connected to the backing store, for instance if you wanted to be able to