Diff
Modified: trunk/Source/WebKit/ChangeLog (250645 => 250646)
--- trunk/Source/WebKit/ChangeLog 2019-10-03 08:24:17 UTC (rev 250645)
+++ trunk/Source/WebKit/ChangeLog 2019-10-03 08:25:46 UTC (rev 250646)
@@ -1,5 +1,22 @@
2019-10-03 Carlos Garcia Campos <cgar...@igalia.com>
+ [GTK] Make PSON optional
+ https://bugs.webkit.org/show_bug.cgi?id=200967
+
+ Reviewed by Michael Catanzaro.
+
+ It's not possible to enable PSON by default and keep backwards compatibility, applications might need to use new
+ API to monitor the page ID changes in the Web view. So, this patch adds a construct only property to
+ WebKitWebContext to enable PSON.
+
+ * UIProcess/API/glib/WebKitWebContext.cpp:
+ (webkitWebContextGetProperty):
+ (webkitWebContextSetProperty):
+ (webkitWebContextConstructed):
+ (webkit_web_context_class_init):
+
+2019-10-03 Carlos Garcia Campos <cgar...@igalia.com>
+
[GTK][WPE] Add WebKitWebView:page-id property
https://bugs.webkit.org/show_bug.cgi?id=201642
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp (250645 => 250646)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp 2019-10-03 08:24:17 UTC (rev 250645)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp 2019-10-03 08:25:46 UTC (rev 250646)
@@ -112,7 +112,10 @@
#if PLATFORM(GTK)
PROP_LOCAL_STORAGE_DIRECTORY,
#endif
- PROP_WEBSITE_DATA_MANAGER
+ PROP_WEBSITE_DATA_MANAGER,
+#if PLATFORM(GTK)
+ PROP_PSON_ENABLED
+#endif
};
enum {
@@ -187,6 +190,9 @@
struct _WebKitWebContextPrivate {
RefPtr<WebProcessPool> processPool;
bool clientsDetached;
+#if PLATFORM(GTK)
+ bool psonEnabled;
+#endif
GRefPtr<WebKitFaviconDatabase> faviconDatabase;
GRefPtr<WebKitSecurityManager> securityManager;
@@ -308,6 +314,11 @@
case PROP_WEBSITE_DATA_MANAGER:
g_value_set_object(value, webkit_web_context_get_website_data_manager(context));
break;
+#if PLATFORM(GTK)
+ case PROP_PSON_ENABLED:
+ g_value_set_boolean(value, context->priv->psonEnabled);
+ break;
+#endif
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, paramSpec);
}
@@ -328,6 +339,11 @@
context->priv->websiteDataManager = manager ? WEBKIT_WEBSITE_DATA_MANAGER(manager) : nullptr;
break;
}
+#if PLATFORM(GTK)
+ case PROP_PSON_ENABLED:
+ context->priv->psonEnabled = g_value_get_boolean(value);
+ break;
+#endif
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, paramSpec);
}
@@ -339,11 +355,15 @@
GUniquePtr<char> bundleFilename(g_build_filename(injectedBundleDirectory(), INJECTED_BUNDLE_FILENAME, nullptr));
+ WebKitWebContext* webContext = WEBKIT_WEB_CONTEXT(object);
+ WebKitWebContextPrivate* priv = webContext->priv;
+
API::ProcessPoolConfiguration configuration;
configuration.setInjectedBundlePath(FileSystem::stringFromFileSystemRepresentation(bundleFilename.get()));
+#if PLATFORM(GTK)
+ configuration.setProcessSwapsOnNavigation(priv->psonEnabled);
+#endif
- WebKitWebContext* webContext = WEBKIT_WEB_CONTEXT(object);
- WebKitWebContextPrivate* priv = webContext->priv;
if (!priv->websiteDataManager)
priv->websiteDataManager = adoptGRef(webkit_website_data_manager_new("local-storage-directory", priv->localStorageDirectory.data(), nullptr));
@@ -448,7 +468,26 @@
WEBKIT_TYPE_WEBSITE_DATA_MANAGER,
static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
+#if PLATFORM(GTK)
/**
+ * WebKitWebContext:process-swap-on-cross-site-navigation-enabled:
+ *
+ * Whether swap Web processes on cross-site navigations is enabled.
+ *
+ * Since: 2.28
+ */
+ g_object_class_install_property(
+ gObjectClass,
+ PROP_PSON_ENABLED,
+ g_param_spec_boolean(
+ "process-swap-on-cross-site-navigation-enabled",
+ _("Swap Processes on Cross-Site Navigation"),
+ _("Whether swap Web processes on cross-site navigations is enabled"),
+ FALSE,
+ static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
+#endif
+
+ /**
* WebKitWebContext::download-started:
* @context: the #WebKitWebContext
* @download: the #WebKitDownload associated with this event
Modified: trunk/Tools/ChangeLog (250645 => 250646)
--- trunk/Tools/ChangeLog 2019-10-03 08:24:17 UTC (rev 250645)
+++ trunk/Tools/ChangeLog 2019-10-03 08:25:46 UTC (rev 250646)
@@ -1,5 +1,22 @@
2019-10-03 Carlos Garcia Campos <cgar...@igalia.com>
+ [GTK] Make PSON optional
+ https://bugs.webkit.org/show_bug.cgi?id=200967
+
+ Reviewed by Michael Catanzaro.
+
+ Enable PSON in MiniBrowser and unit tests. Also add more tests to page-id to check that we can still talk to the
+ right web process after cross-site history navigation.
+
+ * MiniBrowser/gtk/main.c:
+ (main):
+ * TestWebKitAPI/Tests/WebKitGLib/TestWebExtensions.cpp:
+ (testWebExtensionPageID):
+ * TestWebKitAPI/glib/WebKitGLib/TestMain.h:
+ (Test::Test):
+
+2019-10-03 Carlos Garcia Campos <cgar...@igalia.com>
+
[GTK][WPE] Add WebKitWebView:page-id property
https://bugs.webkit.org/show_bug.cgi?id=201642
Modified: trunk/Tools/MiniBrowser/gtk/main.c (250645 => 250646)
--- trunk/Tools/MiniBrowser/gtk/main.c 2019-10-03 08:24:17 UTC (rev 250645)
+++ trunk/Tools/MiniBrowser/gtk/main.c 2019-10-03 08:25:46 UTC (rev 250646)
@@ -532,7 +532,9 @@
return 0;
}
- WebKitWebContext *webContext = (privateMode || automationMode) ? webkit_web_context_new_ephemeral() : webkit_web_context_get_default();
+ WebKitWebsiteDataManager *manager = (privateMode || automationMode) ? webkit_website_data_manager_new_ephemeral() : webkit_website_data_manager_new(NULL);
+ WebKitWebContext *webContext = g_object_new(WEBKIT_TYPE_WEB_CONTEXT, "website-data-manager", manager, "process-swap-on-cross-site-navigation-enabled", TRUE, NULL);
+ g_object_unref(manager);
if (cookiesPolicy) {
WebKitCookieManager *cookieManager = webkit_web_context_get_cookie_manager(webContext);
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebExtensions.cpp (250645 => 250646)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebExtensions.cpp 2019-10-03 08:24:17 UTC (rev 250645)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebExtensions.cpp 2019-10-03 08:25:46 UTC (rev 250646)
@@ -488,6 +488,53 @@
g_assert_false(pageIDChangedEmitted);
g_assert_cmpuint(pageID, ==, webkit_web_view_get_page_id(test->m_webView));
checkTitle(test, proxy.get(), "Title4");
+
+ // Register a custom URI scheme to test history navigation.
+ webkit_web_context_register_uri_scheme(test->m_webContext.get(), "foo",
+ [](WebKitURISchemeRequest* request, gpointer) {
+ SoupURI* uri = soup_uri_new(webkit_uri_scheme_request_get_uri(request));
+ GRefPtr<GInputStream> inputStream = adoptGRef(g_memory_input_stream_new());
+ char* html = g_strdup_printf("<html><head><title>%s</title></head><body></body></html>", !strcmp(uri->host, "host5") ? "Title5" : "Title6");
+ soup_uri_free(uri);
+ g_memory_input_stream_add_data(G_MEMORY_INPUT_STREAM(inputStream.get()), html, strlen(html), g_free);
+ webkit_uri_scheme_request_finish(request, inputStream.get(), strlen(html), "text/html");
+ }, nullptr, nullptr);
+
+ test->loadURI("foo://host5/");
+ test->waitUntilLoadFinished();
+ g_assert_true(pageIDChangedEmitted);
+ pageIDChangedEmitted = false;
+ g_assert_cmpuint(pageID, <, webkit_web_view_get_page_id(test->m_webView));
+ pageID = webkit_web_view_get_page_id(test->m_webView);
+ proxy = test->extensionProxy();
+ checkTitle(test, proxy.get(), "Title5");
+
+ test->loadURI("foo://host6/");
+ test->waitUntilLoadFinished();
+ g_assert_true(pageIDChangedEmitted);
+ pageIDChangedEmitted = false;
+ g_assert_cmpuint(pageID, <, webkit_web_view_get_page_id(test->m_webView));
+ pageID = webkit_web_view_get_page_id(test->m_webView);
+ proxy = test->extensionProxy();
+ checkTitle(test, proxy.get(), "Title6");
+
+ test->goBack();
+ test->waitUntilLoadFinished();
+ g_assert_true(pageIDChangedEmitted);
+ pageIDChangedEmitted = false;
+ g_assert_cmpuint(pageID, >, webkit_web_view_get_page_id(test->m_webView));
+ pageID = webkit_web_view_get_page_id(test->m_webView);
+ proxy = test->extensionProxy();
+ checkTitle(test, proxy.get(), "Title5");
+
+ test->goForward();
+ test->waitUntilLoadFinished();
+ g_assert_true(pageIDChangedEmitted);
+ pageIDChangedEmitted = false;
+ g_assert_cmpuint(pageID, <, webkit_web_view_get_page_id(test->m_webView));
+ pageID = webkit_web_view_get_page_id(test->m_webView);
+ proxy = test->extensionProxy();
+ checkTitle(test, proxy.get(), "Title6");
}
void beforeAll()
Modified: trunk/Tools/TestWebKitAPI/glib/WebKitGLib/TestMain.h (250645 => 250646)
--- trunk/Tools/TestWebKitAPI/glib/WebKitGLib/TestMain.h 2019-10-03 08:24:17 UTC (rev 250645)
+++ trunk/Tools/TestWebKitAPI/glib/WebKitGLib/TestMain.h 2019-10-03 08:25:46 UTC (rev 250646)
@@ -129,7 +129,12 @@
"disk-cache-directory", diskCacheDirectory.get(), "offline-application-cache-directory", applicationCacheDirectory.get(),
"websql-directory", webSQLDirectory.get(), "hsts-cache-directory", hstsDirectory.get(), nullptr));
- m_webContext = adoptGRef(webkit_web_context_new_with_website_data_manager(websiteDataManager.get()));
+ m_webContext = adoptGRef(WEBKIT_WEB_CONTEXT(g_object_new(WEBKIT_TYPE_WEB_CONTEXT,
+ "website-data-manager", websiteDataManager.get(),
+#if PLATFORM(GTK)
+ "process-swap-on-cross-site-navigation-enabled", TRUE,
+#endif
+ nullptr)));
g_signal_connect(m_webContext.get(), "initialize-web-extensions", G_CALLBACK(initializeWebExtensionsCallback), this);
}