Skip to content
Permalink
Browse files
[GTK] Deprecate WebKitSettings:enable-java
https://bugs.webkit.org/show_bug.cgi?id=239538

Reviewed by Adrian Perez de Castro and Michael Catanzaro.

250264@main removed the WKPreference entry regarding Java support, which in turn
was dropped long time ago.

* Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp:
(webKitSettingsSetProperty): Do not call deprecated function.
(webKitSettingsGetProperty): Ditto.
(webkit_settings_class_init): Ditto.
(webkit_settings_get_enable_java): Add deprecation warnings.
(webkit_settings_set_enable_java): Add deprecation warnings.
* Source/WebKit/UIProcess/API/gtk/WebKitSettings.h: Mark functions as
deprecated.
* Source/WebKit/UIProcess/API/wpe/WebKitSettings.h: Ditto.
* Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitSettings.cpp:
(testWebKitSettings): Update for new behavior and remove fatal warning
flag for enable-java block as the warnings are expected.

Canonical link: https://commits.webkit.org/251036@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294920 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
lauromoura committed May 27, 2022
1 parent c21585e commit 506b7e9af0c6ed9d832528b1c4fdc2fb1b938766
Showing 4 changed files with 23 additions and 10 deletions.
@@ -236,7 +236,6 @@ static void webKitSettingsSetProperty(GObject* object, guint propId, const GValu
case PROP_ENABLE_PLUGINS:
break;
case PROP_ENABLE_JAVA:
webkit_settings_set_enable_java(settings, g_value_get_boolean(value));
break;
case PROP_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY:
webkit_settings_set_javascript_can_open_windows_automatically(settings, g_value_get_boolean(value));
@@ -439,7 +438,7 @@ static void webKitSettingsGetProperty(GObject* object, guint propId, GValue* val
g_value_set_boolean(value, FALSE);
break;
case PROP_ENABLE_JAVA:
g_value_set_boolean(value, webkit_settings_get_enable_java(settings));
g_value_set_boolean(value, FALSE);
break;
case PROP_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY:
g_value_set_boolean(value, webkit_settings_get_javascript_can_open_windows_automatically(settings));
@@ -752,13 +751,15 @@ static void webkit_settings_class_init(WebKitSettingsClass* klass)
* WebKitSettings:enable-java:
*
* Determines whether or not Java is enabled on the page.
*
* Deprecated: 2.38
*/
sObjProperties[PROP_ENABLE_JAVA] =
g_param_spec_boolean(
"enable-java",
_("Enable Java"),
_("Whether Java support should be enabled."),
TRUE,
FALSE,
readWriteConstructParamFlags);

/**
@@ -1917,11 +1918,15 @@ void webkit_settings_set_enable_plugins(WebKitSettings* settings, gboolean enabl
* Get the #WebKitSettings:enable-java property.
*
* Returns: %FALSE always.
*
* Deprecated: 2.38. This function always returns %FALSE.
*/
gboolean webkit_settings_get_enable_java(WebKitSettings* settings)
{
g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);

g_warning("webkit_settings_get_enable_java is deprecated and always returns FALSE. Java is no longer supported.");

return FALSE;
}

@@ -1931,10 +1936,15 @@ gboolean webkit_settings_get_enable_java(WebKitSettings* settings)
* @enabled: Value to be set
*
* Set the #WebKitSettings:enable-java property. Deprecated function that does nothing.
*
* Deprecated: 2.38. This function does nothing.
*/
void webkit_settings_set_enable_java(WebKitSettings* settings, gboolean)
void webkit_settings_set_enable_java(WebKitSettings* settings, gboolean enabled)
{
g_return_if_fail(WEBKIT_IS_SETTINGS(settings));

if (enabled)
g_warning("webkit_settings_set_enable_java is deprecated and does nothing. Java is no longer supported.");
}

/**
@@ -156,10 +156,10 @@ WEBKIT_DEPRECATED void
webkit_settings_set_enable_plugins (WebKitSettings *settings,
gboolean enabled);

WEBKIT_API gboolean
WEBKIT_DEPRECATED gboolean
webkit_settings_get_enable_java (WebKitSettings *settings);

WEBKIT_API void
WEBKIT_DEPRECATED void
webkit_settings_set_enable_java (WebKitSettings *settings,
gboolean enabled);

@@ -140,10 +140,10 @@ WEBKIT_DEPRECATED void
webkit_settings_set_enable_plugins (WebKitSettings *settings,
gboolean enabled);

WEBKIT_API gboolean
WEBKIT_DEPRECATED gboolean
webkit_settings_get_enable_java (WebKitSettings *settings);

WEBKIT_API void
WEBKIT_DEPRECATED void
webkit_settings_set_enable_java (WebKitSettings *settings,
gboolean enabled);

@@ -77,10 +77,13 @@ static void testWebKitSettings(Test*, gconstpointer)
webkit_settings_set_enable_frame_flattening(settings, TRUE);
g_assert_true(webkit_settings_get_enable_frame_flattening(settings));

// Java is enabled by default.
g_assert_true(webkit_settings_get_enable_java(settings));
// Java is not supported, and always disabled.
// Make warnings non-fatal for this test to make it pass.
Test::removeLogFatalFlag(G_LOG_LEVEL_WARNING);
g_assert_false(webkit_settings_get_enable_java(settings));
webkit_settings_set_enable_java(settings, FALSE);
g_assert_false(webkit_settings_get_enable_java(settings));
Test::addLogFatalFlag(G_LOG_LEVEL_WARNING);

// By default, JavaScript can open windows automatically is disabled.
g_assert_false(webkit_settings_get_javascript_can_open_windows_automatically(settings));

0 comments on commit 506b7e9

Please sign in to comment.