source: webkit/trunk/Source/WebKit/UIProcess/WebPreferences.cpp

Last change on this file was 293785, checked in by Brent Fulgham, 3 years ago

Remove deprecated 'JavaEnabled' feature flag and related code
https://bugs.webkit.org/show_bug.cgi?id=240044

Reviewed by Darin Adler.

We removed support for Java Plug-Ins in macOS 10.15, but never removed the preference. To reduce code complexity
and build times we should remove this unused preference, leaving non-functional stubs to avoid breaking binaries
that expect to call their accessor methods.

Source/WebCore:

  • loader/ResourceLoadStatistics.cpp:

(WebCore::navigatorAPIEnumToString):

  • loader/ResourceLoadStatistics.h:
  • loader/SubframeLoader.cpp:

(WebCore::FrameLoader::SubframeLoader::pluginIsLoadable):

  • page/Navigator.cpp:

(WebCore::Navigator::javaEnabled const): Deleted.

  • page/Navigator.h:

Source/WebKit:

  • UIProcess/API/C/WKPreferences.cpp:

(WKPreferencesSetJavaEnabled):
(WKPreferencesGetJavaEnabled):
(WKPreferencesSetJavaEnabledForLocalFiles):
(WKPreferencesGetJavaEnabledForLocalFiles):

  • UIProcess/API/C/WKPreferencesRef.h:
  • UIProcess/API/C/WKPreferencesRefPrivate.h:
  • UIProcess/API/Cocoa/WKPreferences.mm:

(-[WKPreferences encodeWithCoder:]):
(-[WKPreferences initWithCoder:]):
(-[WKPreferences javaEnabled]):
(-[WKPreferences setJavaEnabled:]):
(-[WKPreferences _setJavaEnabledForLocalFiles:]):
(-[WKPreferences _javaEnabledForLocalFiles]):

  • UIProcess/API/Cocoa/WKPreferencesPrivate.h:
  • UIProcess/API/glib/WebKitSettings.cpp:
  • UIProcess/WebPreferences.cpp:

(WebKit::WebPreferences::createWithLegacyDefaults):

Source/WebKitLegacy/mac:

  • WebCoreSupport/WebInspectorClient.mm:

(-[WebInspectorWindowController init]):

  • WebView/WebPreferenceKeysPrivate.h:
  • WebView/WebPreferences.h:
  • WebView/WebPreferences.mm:

(-[WebPreferences isJavaEnabled]):
(-[WebPreferences setJavaEnabled:]):

Source/WebKitLegacy/win:

  • WebCoreSupport/WebInspectorClient.cpp:

(WebInspectorClient::openLocalFrontend):

  • WebPreferenceKeysPrivate.h:
  • WebPreferences.cpp:

(WebPreferences::initializeDefaultSettings):
(WebPreferences::isJavaEnabled):
(WebPreferences::setJavaEnabled):

  • WebView.cpp:

(WebView::notifyPreferencesChanged):

Source/WTF:

  • Scripts/Preferences/WebPreferences.yaml:

Tools:

  • DumpRenderTree/TestOptions.cpp:

(WTR::TestOptions::defaults):

  • DumpRenderTree/win/DumpRenderTree.cpp:

(resetWebPreferencesToConsistentValues):

  • TestWebKitAPI/Tests/WebKit/WKPreferences.cpp:

(TestWebKitAPI::TEST):

  • TestWebKitAPI/Tests/WebKitCocoa/Coding.mm:

(TEST):

  • TestWebKitAPI/Tests/WebKitCocoa/Copying.mm:

(TEST):

  • Property svn:eol-style set to native
File size: 8.3 KB
Line 
1/*
2 * Copyright (C) 2010-2022 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include "config.h"
27#include "WebPreferences.h"
28
29#include "WebPageGroup.h"
30#include "WebPageProxy.h"
31#include "WebPreferencesKeys.h"
32#include "WebProcessPool.h"
33#include <WebCore/LibWebRTCProvider.h>
34#include <wtf/NeverDestroyed.h>
35#include <wtf/ThreadingPrimitives.h>
36
37#if !PLATFORM(COCOA)
38#include <WebCore/NotImplemented.h>
39#endif
40
41namespace WebKit {
42
43Ref<WebPreferences> WebPreferences::create(const String& identifier, const String& keyPrefix, const String& globalDebugKeyPrefix)
44{
45 return adoptRef(*new WebPreferences(identifier, keyPrefix, globalDebugKeyPrefix));
46}
47
48Ref<WebPreferences> WebPreferences::createWithLegacyDefaults(const String& identifier, const String& keyPrefix, const String& globalDebugKeyPrefix)
49{
50 auto preferences = WebPreferences::create(identifier, keyPrefix, globalDebugKeyPrefix);
51 // FIXME: The registerDefault...ValueForKey machinery is unnecessarily heavyweight and complicated.
52 // We can just compute different defaults for modern and legacy APIs in WebPreferencesDefinitions.h macros.
53 preferences->registerDefaultBoolValueForKey(WebPreferencesKey::pluginsEnabledKey(), true);
54 preferences->registerDefaultUInt32ValueForKey(WebPreferencesKey::storageBlockingPolicyKey(), static_cast<uint32_t>(WebCore::StorageBlockingPolicy::AllowAll));
55 return preferences;
56}
57
58WebPreferences::WebPreferences(const String& identifier, const String& keyPrefix, const String& globalDebugKeyPrefix)
59 : m_identifier(identifier)
60 , m_keyPrefix(keyPrefix)
61 , m_globalDebugKeyPrefix(globalDebugKeyPrefix)
62{
63 platformInitializeStore();
64}
65
66WebPreferences::WebPreferences(const WebPreferences& other)
67 : m_identifier()
68 , m_keyPrefix(other.m_keyPrefix)
69 , m_globalDebugKeyPrefix(other.m_globalDebugKeyPrefix)
70 , m_store(other.m_store)
71{
72 platformInitializeStore();
73}
74
75WebPreferences::~WebPreferences()
76{
77 ASSERT(m_pages.computesEmpty());
78}
79
80Ref<WebPreferences> WebPreferences::copy() const
81{
82 return adoptRef(*new WebPreferences(*this));
83}
84
85void WebPreferences::addPage(WebPageProxy& webPageProxy)
86{
87 ASSERT(!m_pages.contains(webPageProxy));
88 m_pages.add(webPageProxy);
89}
90
91void WebPreferences::removePage(WebPageProxy& webPageProxy)
92{
93 ASSERT(m_pages.contains(webPageProxy));
94 m_pages.remove(webPageProxy);
95}
96
97void WebPreferences::update()
98{
99 if (m_updateBatchCount) {
100 m_needUpdateAfterBatch = true;
101 return;
102 }
103
104 for (auto& webPageProxy : m_pages)
105 webPageProxy.preferencesDidChange();
106}
107
108void WebPreferences::startBatchingUpdates()
109{
110 if (!m_updateBatchCount)
111 m_needUpdateAfterBatch = false;
112
113 ++m_updateBatchCount;
114}
115
116void WebPreferences::endBatchingUpdates()
117{
118 ASSERT(m_updateBatchCount > 0);
119 --m_updateBatchCount;
120 if (!m_updateBatchCount && m_needUpdateAfterBatch)
121 update();
122}
123
124void WebPreferences::setBoolValueForKey(const String& key, bool value)
125{
126 if (!m_store.setBoolValueForKey(key, value))
127 return;
128 updateBoolValueForKey(key, value);
129}
130
131void WebPreferences::setDoubleValueForKey(const String& key, double value)
132{
133 if (!m_store.setDoubleValueForKey(key, value))
134 return;
135 updateDoubleValueForKey(key, value);
136}
137
138void WebPreferences::setUInt32ValueForKey(const String& key, uint32_t value)
139{
140 if (!m_store.setUInt32ValueForKey(key, value))
141 return;
142 updateUInt32ValueForKey(key, value);
143}
144
145void WebPreferences::setStringValueForKey(const String& key, const String& value)
146{
147 if (!m_store.setStringValueForKey(key, value))
148 return;
149 updateStringValueForKey(key, value);
150}
151
152void WebPreferences::updateStringValueForKey(const String& key, const String& value)
153{
154 platformUpdateStringValueForKey(key, value);
155 update(); // FIXME: Only send over the changed key and value.
156}
157
158void WebPreferences::updateBoolValueForKey(const String& key, bool value)
159{
160 platformUpdateBoolValueForKey(key, value);
161 update(); // FIXME: Only send over the changed key and value.
162}
163
164void WebPreferences::updateBoolValueForInternalDebugFeatureKey(const String& key, bool value)
165{
166 if (key == WebPreferencesKey::processSwapOnCrossSiteNavigationEnabledKey()) {
167 for (auto& page : m_pages)
168 page.process().processPool().configuration().setProcessSwapsOnNavigation(value);
169
170 return;
171 }
172 update(); // FIXME: Only send over the changed key and value.
173}
174
175void WebPreferences::updateBoolValueForExperimentalFeatureKey(const String& key, bool value)
176{
177 update(); // FIXME: Only send over the changed key and value.
178}
179
180void WebPreferences::updateUInt32ValueForKey(const String& key, uint32_t value)
181{
182 platformUpdateUInt32ValueForKey(key, value);
183 update(); // FIXME: Only send over the changed key and value.
184}
185
186void WebPreferences::updateDoubleValueForKey(const String& key, double value)
187{
188 platformUpdateDoubleValueForKey(key, value);
189 update(); // FIXME: Only send over the changed key and value.
190}
191
192void WebPreferences::updateFloatValueForKey(const String& key, float value)
193{
194 platformUpdateFloatValueForKey(key, value);
195 update(); // FIXME: Only send over the changed key and value.
196}
197
198void WebPreferences::deleteKey(const String& key)
199{
200 m_store.deleteKey(key);
201 platformDeleteKey(key);
202 update(); // FIXME: Only send over the changed key and value.
203}
204
205void WebPreferences::registerDefaultBoolValueForKey(const String& key, bool value)
206{
207 m_store.setOverrideDefaultsBoolValueForKey(key, value);
208 bool userValue;
209 if (platformGetBoolUserValueForKey(key, userValue))
210 m_store.setBoolValueForKey(key, userValue);
211}
212
213void WebPreferences::registerDefaultUInt32ValueForKey(const String& key, uint32_t value)
214{
215 m_store.setOverrideDefaultsUInt32ValueForKey(key, value);
216 uint32_t userValue;
217 if (platformGetUInt32UserValueForKey(key, userValue))
218 m_store.setUInt32ValueForKey(key, userValue);
219}
220
221#if !PLATFORM(COCOA) && !PLATFORM(GTK)
222void WebPreferences::platformInitializeStore()
223{
224 notImplemented();
225}
226#endif
227
228#if !PLATFORM(COCOA)
229void WebPreferences::platformUpdateStringValueForKey(const String&, const String&)
230{
231 notImplemented();
232}
233
234void WebPreferences::platformUpdateBoolValueForKey(const String&, bool)
235{
236 notImplemented();
237}
238
239void WebPreferences::platformUpdateUInt32ValueForKey(const String&, uint32_t)
240{
241 notImplemented();
242}
243
244void WebPreferences::platformUpdateDoubleValueForKey(const String&, double)
245{
246 notImplemented();
247}
248
249void WebPreferences::platformUpdateFloatValueForKey(const String&, float)
250{
251 notImplemented();
252}
253
254void WebPreferences::platformDeleteKey(const String&)
255{
256 notImplemented();
257}
258
259bool WebPreferences::platformGetStringUserValueForKey(const String&, String&)
260{
261 notImplemented();
262 return false;
263}
264
265bool WebPreferences::platformGetBoolUserValueForKey(const String&, bool&)
266{
267 notImplemented();
268 return false;
269}
270
271bool WebPreferences::platformGetUInt32UserValueForKey(const String&, uint32_t&)
272{
273 notImplemented();
274 return false;
275}
276
277bool WebPreferences::platformGetDoubleUserValueForKey(const String&, double&)
278{
279 notImplemented();
280 return false;
281}
282#endif
283
284} // namespace WebKit
Note: See TracBrowser for help on using the repository browser.