Skip to content

Commit

Permalink
[GTK] Remove WebKitWebContext:process-swap-on-cross-site-navigation-e…
Browse files Browse the repository at this point in the history
…nabled and ensure PSON is always enabled with GTK 4

https://bugs.webkit.org/show_bug.cgi?id=220116

Reviewed by Carlos Garcia Campos.

In WPE, PSON is mandatory and always enabled. We cannot do this for GTK
3 without breaking existing apps, but we can do it for GTK 4.

* Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp:
(webkitWebContextConstructed):
(webkit_web_context_class_init):
* Tools/MiniBrowser/gtk/main.c:
(activate):
* Tools/TestWebKitAPI/glib/WebKitGLib/TestMain.h:
(Test::Test):

Canonical link: https://commits.webkit.org/255825@main
  • Loading branch information
mcatanzaro committed Oct 21, 2022
1 parent b450166 commit 94be12a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 22 deletions.
26 changes: 8 additions & 18 deletions Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp
Expand Up @@ -121,11 +121,9 @@ enum {
PROP_LOCAL_STORAGE_DIRECTORY,
#endif
PROP_WEBSITE_DATA_MANAGER,
#if PLATFORM(GTK)
#if PLATFORM(GTK) && !USE(GTK4)
PROP_PSON_ENABLED,
#if !USE(GTK4)
PROP_USE_SYSTEM_APPEARANCE_FOR_SCROLLBARS,
#endif
#endif
PROP_MEMORY_PRESSURE_SETTINGS,
PROP_TIME_ZONE_OVERRIDE,
Expand Down Expand Up @@ -211,11 +209,9 @@ struct _WebKitWebContextPrivate {

RefPtr<WebProcessPool> processPool;
bool clientsDetached;
#if PLATFORM(GTK)
#if PLATFORM(GTK) && !USE(GTK4)
bool psonEnabled;
#if !USE(GTK4)
bool useSystemAppearanceForScrollbars;
#endif
#endif

GRefPtr<WebKitFaviconDatabase> faviconDatabase;
Expand Down Expand Up @@ -346,15 +342,13 @@ static void webkitWebContextGetProperty(GObject* object, guint propID, GValue* v
case PROP_WEBSITE_DATA_MANAGER:
g_value_set_object(value, webkit_web_context_get_website_data_manager(context));
break;
#if PLATFORM(GTK)
#if PLATFORM(GTK) && !USE(GTK4)
case PROP_PSON_ENABLED:
g_value_set_boolean(value, context->priv->psonEnabled);
break;
#if !USE(GTK4)
case PROP_USE_SYSTEM_APPEARANCE_FOR_SCROLLBARS:
g_value_set_boolean(value, webkit_web_context_get_use_system_appearance_for_scrollbars(context));
break;
#endif
#endif
case PROP_TIME_ZONE_OVERRIDE:
g_value_set_string(value, webkit_web_context_get_time_zone_override(context));
Expand All @@ -379,15 +373,13 @@ static void webkitWebContextSetProperty(GObject* object, guint propID, const GVa
context->priv->websiteDataManager = manager ? WEBKIT_WEBSITE_DATA_MANAGER(manager) : nullptr;
break;
}
#if PLATFORM(GTK)
#if PLATFORM(GTK) && !USE(GTK4)
case PROP_PSON_ENABLED:
context->priv->psonEnabled = g_value_get_boolean(value);
break;
#if !USE(GTK4)
case PROP_USE_SYSTEM_APPEARANCE_FOR_SCROLLBARS:
webkit_web_context_set_use_system_appearance_for_scrollbars(context, g_value_get_boolean(value));
break;
#endif
#endif
case PROP_MEMORY_PRESSURE_SETTINGS: {
gpointer settings = g_value_get_boxed(value);
Expand Down Expand Up @@ -417,11 +409,11 @@ static void webkitWebContextConstructed(GObject* object)
API::ProcessPoolConfiguration configuration;
configuration.setInjectedBundlePath(FileSystem::stringFromFileSystemRepresentation(bundleFilename.get()));
configuration.setUsesWebProcessCache(true);
#if PLATFORM(GTK)
#if PLATFORM(GTK) && !USE(GTK4)
configuration.setProcessSwapsOnNavigation(priv->psonEnabled);
#if !USE(GTK4)
configuration.setUseSystemAppearanceForScrollbars(priv->useSystemAppearanceForScrollbars);
#endif
#else
configuration.setProcessSwapsOnNavigation(true);
#endif
if (priv->memoryPressureSettings) {
configuration.setMemoryPressureHandlerConfiguration(webkitMemoryPressureSettingsGetMemoryPressureHandlerConfiguration(priv->memoryPressureSettings));
Expand Down Expand Up @@ -531,7 +523,7 @@ static void webkit_web_context_class_init(WebKitWebContextClass* webContextClass
WEBKIT_TYPE_WEBSITE_DATA_MANAGER,
static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));

#if PLATFORM(GTK)
#if PLATFORM(GTK) && !USE(GTK4)
/**
* WebKitWebContext:process-swap-on-cross-site-navigation-enabled:
*
Expand All @@ -553,7 +545,6 @@ static void webkit_web_context_class_init(WebKitWebContextClass* webContextClass
FALSE,
static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));

#if !USE(GTK4)
/**
* WebKitWebContext:use-system-appearance-for-scrollbars:
*
Expand All @@ -572,7 +563,6 @@ static void webkit_web_context_class_init(WebKitWebContextClass* webContextClass
_("Whether to use system appearance for rendering scrollbars"),
TRUE,
static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT));
#endif
#endif

/**
Expand Down
3 changes: 2 additions & 1 deletion Tools/MiniBrowser/gtk/main.c
Expand Up @@ -683,8 +683,9 @@ static void activate(GApplication *application, WebKitSettings *webkitSettings)
if (ignoreTLSErrors)
webkit_website_data_manager_set_tls_errors_policy(manager, WEBKIT_TLS_ERRORS_POLICY_IGNORE);

WebKitWebContext *webContext = g_object_new(WEBKIT_TYPE_WEB_CONTEXT, "website-data-manager", manager, "process-swap-on-cross-site-navigation-enabled", TRUE,
WebKitWebContext *webContext = g_object_new(WEBKIT_TYPE_WEB_CONTEXT, "website-data-manager", manager,
#if !GTK_CHECK_VERSION(3, 98, 0)
"process-swap-on-cross-site-navigation-enabled", TRUE,
"use-system-appearance-for-scrollbars", FALSE,
#endif
"time-zone-override", timeZone,
Expand Down
4 changes: 1 addition & 3 deletions Tools/TestWebKitAPI/glib/WebKitGLib/TestMain.h
Expand Up @@ -138,11 +138,9 @@ class Test {

m_webContext = adoptGRef(WEBKIT_WEB_CONTEXT(g_object_new(WEBKIT_TYPE_WEB_CONTEXT,
"website-data-manager", websiteDataManager.get(),
#if PLATFORM(GTK)
#if PLATFORM(GTK) && !USE(GTK4)
"process-swap-on-cross-site-navigation-enabled", TRUE,
#if !USE(GTK4)
"use-system-appearance-for-scrollbars", FALSE,
#endif
#endif
"memory-pressure-settings", s_memoryPressureSettings,
nullptr)));
Expand Down

0 comments on commit 94be12a

Please sign in to comment.