browser(webkit): reapply wpe fixes (#419)

This commit is contained in:
Pavel Feldman 2020-01-07 17:47:19 -08:00 committed by GitHub
parent 80ffd92552
commit 85c0cc3ae2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 143 additions and 30 deletions

View File

@ -1 +1 @@
1070 1071

View File

@ -4158,6 +4158,18 @@ index fcb9e8ddb8c3a804aa27339cab1b0039eb136f53..633a4efd58ac5c6a8999fa8d75d88342
const String& host = challenge.protectionSpace().host(); const String& host = challenge.protectionSpace().host();
NSArray *certificates = [NSURLRequest allowsSpecificHTTPSCertificateForHost:host]; NSArray *certificates = [NSURLRequest allowsSpecificHTTPSCertificateForHost:host];
if (!certificates) if (!certificates)
diff --git a/Source/WebKit/PlatformWPE.cmake b/Source/WebKit/PlatformWPE.cmake
index a8a95f4b0db4a50a8ef5b72039c51cc5818ed304..324504696770fb095a70153aa830a87b46b77327 100644
--- a/Source/WebKit/PlatformWPE.cmake
+++ b/Source/WebKit/PlatformWPE.cmake
@@ -248,6 +248,7 @@ list(APPEND WebKit_INCLUDE_DIRECTORIES
"${WEBKIT_DIR}/UIProcess/API/wpe"
"${WEBKIT_DIR}/UIProcess/CoordinatedGraphics"
"${WEBKIT_DIR}/UIProcess/geoclue"
+ "${WEBKIT_DIR}/UIProcess/glib"
"${WEBKIT_DIR}/UIProcess/gstreamer"
"${WEBKIT_DIR}/UIProcess/linux"
"${WEBKIT_DIR}/UIProcess/soup"
diff --git a/Source/WebKit/Shared/API/c/wpe/WebKit.h b/Source/WebKit/Shared/API/c/wpe/WebKit.h diff --git a/Source/WebKit/Shared/API/c/wpe/WebKit.h b/Source/WebKit/Shared/API/c/wpe/WebKit.h
index 898e30b370db8176e886fbbde0cd960e38a64818..74945e06fac0eb14936578de6a599a123364a63a 100644 index 898e30b370db8176e886fbbde0cd960e38a64818..74945e06fac0eb14936578de6a599a123364a63a 100644
--- a/Source/WebKit/Shared/API/c/wpe/WebKit.h --- a/Source/WebKit/Shared/API/c/wpe/WebKit.h
@ -4916,10 +4928,64 @@ index f769407fdc660c6f6fef77af90a43bd5dca9d544..ba010ed593bdedc0d70e4f4d3139e73d
bool canRunBeforeUnloadConfirmPanel() const final { return true; } bool canRunBeforeUnloadConfirmPanel() const final { return true; }
diff --git a/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp b/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp diff --git a/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp b/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp
index 33a9b7d5ad060f275dcf7156a8cff3f37644e736..406c6431bd84a9193f75a7689553fe79eb5d864b 100644 index 33a9b7d5ad060f275dcf7156a8cff3f37644e736..128a5c75807848de10aed628618fc7d149a42792 100644
--- a/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp --- a/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp
+++ b/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp +++ b/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp
@@ -385,6 +385,11 @@ static void webkitWebContextConstructed(GObject* object) @@ -119,9 +119,7 @@ enum {
PROP_LOCAL_STORAGE_DIRECTORY,
#endif
PROP_WEBSITE_DATA_MANAGER,
-#if PLATFORM(GTK)
PROP_PSON_ENABLED
-#endif
};
enum {
@@ -202,9 +200,7 @@ struct _WebKitWebContextPrivate {
RefPtr<WebProcessPool> processPool;
bool clientsDetached;
-#if PLATFORM(GTK)
bool psonEnabled;
-#endif
GRefPtr<WebKitFaviconDatabase> faviconDatabase;
GRefPtr<WebKitSecurityManager> securityManager;
@@ -329,11 +325,9 @@ 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)
case PROP_PSON_ENABLED:
g_value_set_boolean(value, context->priv->psonEnabled);
break;
-#endif
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, paramSpec);
}
@@ -354,11 +348,9 @@ static void webkitWebContextSetProperty(GObject* object, guint propID, const GVa
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);
}
@@ -375,9 +367,7 @@ static void webkitWebContextConstructed(GObject* object)
API::ProcessPoolConfiguration configuration;
configuration.setInjectedBundlePath(FileSystem::stringFromFileSystemRepresentation(bundleFilename.get()));
-#if PLATFORM(GTK)
configuration.setProcessSwapsOnNavigation(priv->psonEnabled);
-#endif
if (!priv->websiteDataManager)
priv->websiteDataManager = adoptGRef(webkit_website_data_manager_new("local-storage-directory", priv->localStorageDirectory.data(), nullptr));
@@ -385,6 +375,11 @@ static void webkitWebContextConstructed(GObject* object)
if (!webkit_website_data_manager_is_ephemeral(priv->websiteDataManager.get())) if (!webkit_website_data_manager_is_ephemeral(priv->websiteDataManager.get()))
WebKit::LegacyGlobalSettings::singleton().setHSTSStorageDirectory(FileSystem::stringFromFileSystemRepresentation(webkit_website_data_manager_get_hsts_cache_directory(priv->websiteDataManager.get()))); WebKit::LegacyGlobalSettings::singleton().setHSTSStorageDirectory(FileSystem::stringFromFileSystemRepresentation(webkit_website_data_manager_get_hsts_cache_directory(priv->websiteDataManager.get())));
@ -4931,6 +4997,22 @@ index 33a9b7d5ad060f275dcf7156a8cff3f37644e736..406c6431bd84a9193f75a7689553fe79
priv->processPool = WebProcessPool::create(configuration); priv->processPool = WebProcessPool::create(configuration);
priv->processPool->setPrimaryDataStore(webkitWebsiteDataManagerGetDataStore(priv->websiteDataManager.get())); priv->processPool->setPrimaryDataStore(webkitWebsiteDataManagerGetDataStore(priv->websiteDataManager.get()));
priv->processPool->setUserMessageHandler([webContext](UserMessage&& message, CompletionHandler<void(UserMessage&&)>&& completionHandler) { priv->processPool->setUserMessageHandler([webContext](UserMessage&& message, CompletionHandler<void(UserMessage&&)>&& completionHandler) {
@@ -496,7 +491,6 @@ 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)
/**
* WebKitWebContext:process-swap-on-cross-site-navigation-enabled:
*
@@ -519,7 +513,6 @@ static void webkit_web_context_class_init(WebKitWebContextClass* webContextClass
_("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:
diff --git a/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp b/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp diff --git a/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp b/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp
index 646e45adc2818287f47d00340567822c210a16ed..1caff042a6783addd52355527ea9797fb4e4c513 100644 index 646e45adc2818287f47d00340567822c210a16ed..1caff042a6783addd52355527ea9797fb4e4c513 100644
--- a/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp --- a/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp
@ -5075,10 +5157,10 @@ index 930b17b6629e04d0dfa2222bbc3217877c6e1812..395462e5f01c195231e9296d1204167c
#include <webkit2/WebKitContextMenuItem.h> #include <webkit2/WebKitContextMenuItem.h>
diff --git a/Source/WebKit/UIProcess/API/wpe/WebKitBrowserInspector.h b/Source/WebKit/UIProcess/API/wpe/WebKitBrowserInspector.h diff --git a/Source/WebKit/UIProcess/API/wpe/WebKitBrowserInspector.h b/Source/WebKit/UIProcess/API/wpe/WebKitBrowserInspector.h
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..773cbab35accf562349a133fe14ac84c22d32cc6 index 0000000000000000000000000000000000000000..b9392bc9f232f1f8a5be1e9668ec31e11bd8e3f8
--- /dev/null --- /dev/null
+++ b/Source/WebKit/UIProcess/API/wpe/WebKitBrowserInspector.h +++ b/Source/WebKit/UIProcess/API/wpe/WebKitBrowserInspector.h
@@ -0,0 +1,76 @@ @@ -0,0 +1,79 @@
+/* +/*
+ * Copyright (C) 2019 Microsoft Corporation. + * Copyright (C) 2019 Microsoft Corporation.
+ * + *
@ -5152,6 +5234,9 @@ index 0000000000000000000000000000000000000000..773cbab35accf562349a133fe14ac84c
+WEBKIT_API WebKitBrowserInspector * +WEBKIT_API WebKitBrowserInspector *
+webkit_browser_inspector_get_default (void); +webkit_browser_inspector_get_default (void);
+ +
+WEBKIT_API void
+webkit_browser_inspector_initialize_pipe (void);
+
+G_END_DECLS +G_END_DECLS
+ +
+#endif +#endif
@ -8859,10 +8944,10 @@ index 0000000000000000000000000000000000000000..7453194ca6f032ba86a4c67f5bf12688
+} // namespace WebKit +} // namespace WebKit
diff --git a/Source/WebKit/UIProcess/wpe/WebPageInspectorEmulationAgentWPE.cpp b/Source/WebKit/UIProcess/wpe/WebPageInspectorEmulationAgentWPE.cpp diff --git a/Source/WebKit/UIProcess/wpe/WebPageInspectorEmulationAgentWPE.cpp b/Source/WebKit/UIProcess/wpe/WebPageInspectorEmulationAgentWPE.cpp
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..db8eb05b6e9e738e61e04823929bbdf44373c5b0 index 0000000000000000000000000000000000000000..5dc76aa302cb574307059e66a1b73730efe920da
--- /dev/null --- /dev/null
+++ b/Source/WebKit/UIProcess/wpe/WebPageInspectorEmulationAgentWPE.cpp +++ b/Source/WebKit/UIProcess/wpe/WebPageInspectorEmulationAgentWPE.cpp
@@ -0,0 +1,40 @@ @@ -0,0 +1,41 @@
+/* +/*
+ * Copyright (C) 2019 Microsoft Corporation. + * Copyright (C) 2019 Microsoft Corporation.
+ * + *
@ -8896,19 +8981,20 @@ index 0000000000000000000000000000000000000000..db8eb05b6e9e738e61e04823929bbdf4
+ +
+namespace WebKit { +namespace WebKit {
+ +
+void WebPageInspectorEmulationAgent::platformSetSize(String& error, int width, int height) +void WebPageInspectorEmulationAgent::platformSetSize(int width, int height, Function<void (const String& error)>&& callback)
+{ +{
+ struct wpe_view_backend* backend = m_page.viewBackend(); + struct wpe_view_backend* backend = m_page.viewBackend();
+ wpe_view_backend_dispatch_set_size(backend, width, height); + wpe_view_backend_dispatch_set_size(backend, width, height);
+ callback(String());
+} +}
+ +
+} // namespace WebKit +} // namespace WebKit
diff --git a/Source/WebKit/UIProcess/wpe/WebPageInspectorInputAgentWPE.cpp b/Source/WebKit/UIProcess/wpe/WebPageInspectorInputAgentWPE.cpp diff --git a/Source/WebKit/UIProcess/wpe/WebPageInspectorInputAgentWPE.cpp b/Source/WebKit/UIProcess/wpe/WebPageInspectorInputAgentWPE.cpp
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..3850c53812149aac3258f9d5c7fc852b02231c1e index 0000000000000000000000000000000000000000..be4d3436bd66359d3de795bf368359bad0fe785d
--- /dev/null --- /dev/null
+++ b/Source/WebKit/UIProcess/wpe/WebPageInspectorInputAgentWPE.cpp +++ b/Source/WebKit/UIProcess/wpe/WebPageInspectorInputAgentWPE.cpp
@@ -0,0 +1,98 @@ @@ -0,0 +1,94 @@
+/* +/*
+ * Copyright (C) 2019 Microsoft Corporation. + * Copyright (C) 2019 Microsoft Corporation.
+ * + *
@ -8944,10 +9030,6 @@ index 0000000000000000000000000000000000000000..3850c53812149aac3258f9d5c7fc852b
+ +
+namespace WebKit { +namespace WebKit {
+ +
+void WebPageInspectorInputAgent::platformDispatchKeyEvent(String& error, const String& type, const String& keyRef)
+{
+}
+
+static unsigned toWPEButton(WebMouseEvent::Button button) +static unsigned toWPEButton(WebMouseEvent::Button button)
+{ +{
+ switch (button) { + switch (button) {
@ -9368,26 +9450,28 @@ index 1570d65effb5d601ee3c44a2a7461436f4691c2c..456f96cf589320efa70a76f76e230b67
typedef struct _BrowserWindow BrowserWindow; typedef struct _BrowserWindow BrowserWindow;
diff --git a/Tools/MiniBrowser/gtk/main.c b/Tools/MiniBrowser/gtk/main.c diff --git a/Tools/MiniBrowser/gtk/main.c b/Tools/MiniBrowser/gtk/main.c
index 4c5147dcd38a53e2feaeaae0fce38f92dc60eba6..bc895f379e5dcca90464b63ebebcc756c479c47e 100644 index 4c5147dcd38a53e2feaeaae0fce38f92dc60eba6..be501274061102f805c43df37a67e4a1cf6d5494 100644
--- a/Tools/MiniBrowser/gtk/main.c --- a/Tools/MiniBrowser/gtk/main.c
+++ b/Tools/MiniBrowser/gtk/main.c +++ b/Tools/MiniBrowser/gtk/main.c
@@ -53,6 +53,7 @@ static const char *cookiesFile; @@ -53,6 +53,8 @@ static const char *cookiesFile;
static const char *cookiesPolicy; static const char *cookiesPolicy;
static const char *proxy; static const char *proxy;
static gboolean darkMode; static gboolean darkMode;
+static gboolean inspectorPipe; +static gboolean inspectorPipe;
+static gboolean headless;
static gboolean printVersion; static gboolean printVersion;
typedef enum { typedef enum {
@@ -121,6 +122,7 @@ static const GOptionEntry commandLineOptions[] = @@ -121,6 +123,8 @@ static const GOptionEntry commandLineOptions[] =
{ "ignore-tls-errors", 0, 0, G_OPTION_ARG_NONE, &ignoreTLSErrors, "Ignore TLS errors", NULL }, { "ignore-tls-errors", 0, 0, G_OPTION_ARG_NONE, &ignoreTLSErrors, "Ignore TLS errors", NULL },
{ "content-filter", 0, 0, G_OPTION_ARG_FILENAME, &contentFilter, "JSON with content filtering rules", "FILE" }, { "content-filter", 0, 0, G_OPTION_ARG_FILENAME, &contentFilter, "JSON with content filtering rules", "FILE" },
{ "version", 'v', 0, G_OPTION_ARG_NONE, &printVersion, "Print the WebKitGTK version", NULL }, { "version", 'v', 0, G_OPTION_ARG_NONE, &printVersion, "Print the WebKitGTK version", NULL },
+ { "inspector-pipe", 0, 0, G_OPTION_ARG_NONE, &inspectorPipe, "Open pipe connection to the remote inspector", NULL }, + { "inspector-pipe", 0, 0, G_OPTION_ARG_NONE, &inspectorPipe, "Open pipe connection to the remote inspector", NULL },
+ { "headless", 0, 0, G_OPTION_ARG_NONE, &headless, "Noop headless operation", NULL },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &uriArguments, 0, "[URL…]" }, { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &uriArguments, 0, "[URL…]" },
{ 0, 0, 0, 0, 0, 0, 0 } { 0, 0, 0, 0, 0, 0, 0 }
}; };
@@ -498,6 +500,29 @@ static void filterSavedCallback(WebKitUserContentFilterStore *store, GAsyncResul @@ -498,6 +502,29 @@ static void filterSavedCallback(WebKitUserContentFilterStore *store, GAsyncResul
g_main_loop_quit(data->mainLoop); g_main_loop_quit(data->mainLoop);
} }
@ -9417,7 +9501,7 @@ index 4c5147dcd38a53e2feaeaae0fce38f92dc60eba6..bc895f379e5dcca90464b63ebebcc756
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#if ENABLE_DEVELOPER_MODE #if ENABLE_DEVELOPER_MODE
@@ -541,10 +566,22 @@ int main(int argc, char *argv[]) @@ -541,10 +568,22 @@ int main(int argc, char *argv[])
return 0; return 0;
} }
@ -9976,11 +10060,39 @@ index 031edd533ae1b791bc6862c631b909ae99dac886..0eee1f2071e5e6800f4889a561e94951
+} +}
+ +
@end @end
diff --git a/Tools/MiniBrowser/wpe/CMakeLists.txt b/Tools/MiniBrowser/wpe/CMakeLists.txt
index 245f319abf2595e154d03e1ee8b3250d7f46aafd..9cae87b23deade7c163f34aade2b2aed91d47fc8 100644
--- a/Tools/MiniBrowser/wpe/CMakeLists.txt
+++ b/Tools/MiniBrowser/wpe/CMakeLists.txt
@@ -13,6 +13,7 @@ set(MiniBrowser_INCLUDE_DIRECTORIES
set(MiniBrowser_SYSTEM_INCLUDE_DIRECTORIES
${ATK_INCLUDE_DIRS}
+ ${GLIB_INCLUDE_DIRS}
${WPE_INCLUDE_DIRS}
${WPEBACKEND_FDO_INCLUDE_DIRS}
)
diff --git a/Tools/MiniBrowser/wpe/main.cpp b/Tools/MiniBrowser/wpe/main.cpp diff --git a/Tools/MiniBrowser/wpe/main.cpp b/Tools/MiniBrowser/wpe/main.cpp
index 2d183d394123bd84545dc51f53eb9be796fb8873..d94d4f06fc5be9ab9cd732ceb612a1676089ab82 100644 index 2d183d394123bd84545dc51f53eb9be796fb8873..c59a705dfe586c1ed1f08a173715cf3c35bc49de 100644
--- a/Tools/MiniBrowser/wpe/main.cpp --- a/Tools/MiniBrowser/wpe/main.cpp
+++ b/Tools/MiniBrowser/wpe/main.cpp +++ b/Tools/MiniBrowser/wpe/main.cpp
@@ -172,6 +172,41 @@ static WebKitWebView* createWebView(WebKitWebView* webView, WebKitNavigationActi @@ -43,6 +43,7 @@ static gboolean headlessMode;
static gboolean privateMode;
static gboolean automationMode;
static gboolean ignoreTLSErrors;
+static gboolean inspectorPipe;
static const char* contentFilter;
static const char* cookiesFile;
static const char* cookiesPolicy;
@@ -63,6 +64,7 @@ static const GOptionEntry commandLineOptions[] =
{ "content-filter", 0, 0, G_OPTION_ARG_FILENAME, &contentFilter, "JSON with content filtering rules", "FILE" },
{ "bg-color", 0, 0, G_OPTION_ARG_STRING, &bgColor, "Window background color. Default: white", "COLOR" },
{ "version", 'v', 0, G_OPTION_ARG_NONE, &printVersion, "Print the WPE version", nullptr },
+ { "inspector-pipe", 'v', 0, G_OPTION_ARG_NONE, &inspectorPipe, "Expose remote debugging protocol over pipe", nullptr },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &uriArguments, nullptr, "[URL]" },
{ nullptr, 0, 0, G_OPTION_ARG_NONE, nullptr, nullptr, nullptr }
};
@@ -172,6 +174,41 @@ static WebKitWebView* createWebView(WebKitWebView* webView, WebKitNavigationActi
return newWebView; return newWebView;
} }
@ -10011,23 +10123,24 @@ index 2d183d394123bd84545dc51f53eb9be796fb8873..d94d4f06fc5be9ab9cd732ceb612a167
+ g_main_loop_quit(mainLoop); + g_main_loop_quit(mainLoop);
+} +}
+ +
+static void configureBrowserInspector(GMainLoop* mainLoop, WebKitWebView *firstWebView) +static void configureBrowserInspector()
+{ +{
+ WebKitBrowserInspector* browserInspector = webkit_browser_inspector_get_default(); + WebKitBrowserInspector* browserInspector = webkit_browser_inspector_get_default();
+ g_signal_connect(browserInspector, "create-new-page", G_CALLBACK(createNewPage), NULL); + g_signal_connect(browserInspector, "create-new-page", G_CALLBACK(createNewPage), NULL);
+ // FIXME: This signal is received only when closeAll is called. We should not rely on that. + // FIXME: This signal is received only when closeAll is called. We should not rely on that.
+ g_signal_connect(firstWebView, "close", G_CALLBACK(closeAll), mainLoop); + webkit_browser_inspector_initialize_pipe();
+} +}
+ +
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#if ENABLE_DEVELOPER_MODE #if ENABLE_DEVELOPER_MODE
@@ -301,6 +336,8 @@ int main(int argc, char *argv[]) @@ -280,6 +317,9 @@ int main(int argc, char *argv[])
g_signal_connect(webView, "permission-request", G_CALLBACK(decidePermissionRequest), nullptr); delete static_cast<WPEToolingBackends::ViewBackend*>(data);
g_signal_connect(webView, "create", G_CALLBACK(createWebView), nullptr); }, backend.release());
+ configureBrowserInspector(loop, webView); + if (inspectorPipe)
+ configureBrowserInspector();
+ +
if (ignoreTLSErrors) auto* webView = WEBKIT_WEB_VIEW(g_object_new(WEBKIT_TYPE_WEB_VIEW,
webkit_web_context_set_tls_errors_policy(webContext, WEBKIT_TLS_ERRORS_POLICY_IGNORE); "backend", viewBackend,
"web-context", webContext,