diff --git a/browser_patches/webkit/BUILD_NUMBER b/browser_patches/webkit/BUILD_NUMBER index 31ba99e92f..ba3343d500 100644 --- a/browser_patches/webkit/BUILD_NUMBER +++ b/browser_patches/webkit/BUILD_NUMBER @@ -1 +1 @@ -1157 +1158 diff --git a/browser_patches/webkit/patches/bootstrap.diff b/browser_patches/webkit/patches/bootstrap.diff index f2395191f3..9c79b143a8 100644 --- a/browser_patches/webkit/patches/bootstrap.diff +++ b/browser_patches/webkit/patches/bootstrap.diff @@ -8468,10 +8468,10 @@ index 8a871bf2916d5eab86becf5fde0faed79283d88c..a19a429c4d53edf81c3028c7053265e6 diff --git a/Source/WebKit/UIProcess/RemoteInspectorPipe.cpp b/Source/WebKit/UIProcess/RemoteInspectorPipe.cpp new file mode 100644 -index 0000000000000000000000000000000000000000..0b4ec2de5671723f4045e98b3e398fc11180b3b8 +index 0000000000000000000000000000000000000000..45d8dc48601548951dc5c5ecd68958dbd47c89db --- /dev/null +++ b/Source/WebKit/UIProcess/RemoteInspectorPipe.cpp -@@ -0,0 +1,219 @@ +@@ -0,0 +1,220 @@ +/* + * Copyright (C) 2019 Microsoft Corporation. + * @@ -8624,6 +8624,7 @@ index 0000000000000000000000000000000000000000..0b4ec2de5671723f4045e98b3e398fc1 + +bool RemoteInspectorPipe::start() +{ ++ WTF::RunLoop::initializeMainRunLoop(); + if (m_receiverThread) + return true; + @@ -11921,8 +11922,42 @@ index 9e9978efd3d821c7afcd7b65e14c64e36b355802..a5eef119bddd011470319ac80a0ac443 g_signal_connect(tab->webView, "load-failed-with-tls-errors", G_CALLBACK(loadFailedWithTLSerrors), tab); g_signal_connect(tab->webView, "permission-request", G_CALLBACK(decidePermissionRequest), tab); g_signal_connect(tab->webView, "run-color-chooser", G_CALLBACK(runColorChooserCallback), tab); +diff --git a/Tools/MiniBrowser/gtk/BrowserWindow.c b/Tools/MiniBrowser/gtk/BrowserWindow.c +index 37f9eefbafd14b69c2bedf928ef379670cfef531..5e7e5db253cf788a079e4a0922833b0778b4640d 100644 +--- a/Tools/MiniBrowser/gtk/BrowserWindow.c ++++ b/Tools/MiniBrowser/gtk/BrowserWindow.c +@@ -79,6 +79,8 @@ static const gdouble defaultZoomLevel = 1; + static const gdouble zoomStep = 1.2; + static GList *windowList; + ++static gboolean no_quit = false; ++ + G_DEFINE_TYPE(BrowserWindow, browser_window, GTK_TYPE_WINDOW) + + static char *getExternalURI(const char *uri) +@@ -707,7 +709,7 @@ static void browserWindowFinalize(GObject *gObject) + + G_OBJECT_CLASS(browser_window_parent_class)->finalize(gObject); + +- if (!windowList) ++ if (!windowList && !no_quit) + gtk_main_quit(); + } + +@@ -1233,6 +1235,11 @@ void browser_window_set_background_color(BrowserWindow *window, GdkRGBA *rgba) + gtk_widget_set_app_paintable(GTK_WIDGET(window), TRUE); + } + ++void browser_window_no_quit(void) ++{ ++ no_quit = true; ++} ++ + static BrowserWindow *findActiveWindow(void) + { + GList *l; diff --git a/Tools/MiniBrowser/gtk/BrowserWindow.h b/Tools/MiniBrowser/gtk/BrowserWindow.h -index 1570d65effb5d601ee3c44a2a7461436f4691c2c..456f96cf589320efa70a76f76e230b6795886b5a 100644 +index 1570d65effb5d601ee3c44a2a7461436f4691c2c..65e62adad0c3684e5cec2f6bc8e7f5281e1f77eb 100644 --- a/Tools/MiniBrowser/gtk/BrowserWindow.h +++ b/Tools/MiniBrowser/gtk/BrowserWindow.h @@ -37,7 +37,7 @@ G_BEGIN_DECLS @@ -11934,31 +11969,42 @@ index 1570d65effb5d601ee3c44a2a7461436f4691c2c..456f96cf589320efa70a76f76e230b67 #define BROWSER_ABOUT_SCHEME "minibrowser-about" typedef struct _BrowserWindow BrowserWindow; +@@ -53,7 +53,7 @@ void browser_window_load_session(BrowserWindow *, const char *sessionFile); + void browser_window_set_background_color(BrowserWindow*, GdkRGBA*); + WebKitWebView* browser_window_get_or_create_web_view_for_automation(void); + WebKitWebView *browser_window_create_web_view_in_new_tab_for_automation(void); +- ++void browser_window_no_quit(void); + G_END_DECLS + + #endif diff --git a/Tools/MiniBrowser/gtk/main.c b/Tools/MiniBrowser/gtk/main.c -index 4c5147dcd38a53e2feaeaae0fce38f92dc60eba6..4b1cab0c187352688740c7cca79483fa256aa7fe 100644 +index 4c5147dcd38a53e2feaeaae0fce38f92dc60eba6..77d031add801b2f45c9d90e74afab8802aa08e20 100644 --- a/Tools/MiniBrowser/gtk/main.c +++ b/Tools/MiniBrowser/gtk/main.c -@@ -53,6 +53,9 @@ static const char *cookiesFile; +@@ -53,6 +53,10 @@ static const char *cookiesFile; static const char *cookiesPolicy; static const char *proxy; static gboolean darkMode; +static gboolean inspectorPipe; +static gboolean headless; ++static gboolean noStartupWindow; +static const char *userDataDir; static gboolean printVersion; typedef enum { -@@ -121,6 +124,9 @@ static const GOptionEntry commandLineOptions[] = +@@ -121,6 +125,10 @@ static const GOptionEntry commandLineOptions[] = { "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" }, { "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 }, + { "user-data-dir", 0, 0, G_OPTION_ARG_STRING, &userDataDir, "Default profile persistence folder location", NULL }, + { "headless", 0, 0, G_OPTION_ARG_NONE, &headless, "Noop headless operation", NULL }, ++ { "no-startup-window", 0, 0, G_OPTION_ARG_NONE, &noStartupWindow, "Do not open default page", NULL }, { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &uriArguments, 0, "[URL…]" }, { 0, 0, 0, 0, 0, 0, 0 } }; -@@ -498,6 +504,36 @@ static void filterSavedCallback(WebKitUserContentFilterStore *store, GAsyncResul +@@ -498,6 +506,34 @@ static void filterSavedCallback(WebKitUserContentFilterStore *store, GAsyncResul g_main_loop_quit(data->mainLoop); } @@ -11982,10 +12028,8 @@ index 4c5147dcd38a53e2feaeaae0fce38f92dc60eba6..4b1cab0c187352688740c7cca79483fa + return newWebView; +} + -+static void configureBrowserInspectorPipe(WebKitWebContext *webContext) ++static void configureBrowserInspectorPipe() +{ -+ persistentWebContext = webContext; -+ + WebKitBrowserInspector* browserInspector = webkit_browser_inspector_get_default(); + g_signal_connect(browserInspector, "create-new-page", G_CALLBACK(createNewPage), NULL); + @@ -11995,11 +12039,21 @@ index 4c5147dcd38a53e2feaeaae0fce38f92dc60eba6..4b1cab0c187352688740c7cca79483fa int main(int argc, char *argv[]) { #if ENABLE_DEVELOPER_MODE -@@ -541,10 +577,22 @@ int main(int argc, char *argv[]) +@@ -541,8 +577,28 @@ int main(int argc, char *argv[]) return 0; } - WebKitWebsiteDataManager *manager = (privateMode || automationMode) ? webkit_website_data_manager_new_ephemeral() : webkit_website_data_manager_new(NULL); ++ if (inspectorPipe) ++ configureBrowserInspectorPipe(); ++ ++ if (noStartupWindow) { ++ browser_window_no_quit(); ++ gtk_main(); ++ g_clear_object(&webkitSettings); ++ return 0; ++ } ++ + WebKitWebsiteDataManager *manager; + if (userDataDir) { + manager = webkit_website_data_manager_new("base-data-directory", userDataDir, "base-cache-directory", userDataDir, NULL); @@ -12011,15 +12065,11 @@ index 4c5147dcd38a53e2feaeaae0fce38f92dc60eba6..4b1cab0c187352688740c7cca79483fa + } + WebKitWebContext *webContext = g_object_new(WEBKIT_TYPE_WEB_CONTEXT, "website-data-manager", manager, "process-swap-on-cross-site-navigation-enabled", TRUE, NULL); ++ persistentWebContext = webContext; g_object_unref(manager); -+ if (inspectorPipe) -+ configureBrowserInspectorPipe(webContext); -+ if (cookiesPolicy) { - WebKitCookieManager *cookieManager = webkit_web_context_get_cookie_manager(webContext); - GEnumClass *enumClass = g_type_class_ref(WEBKIT_TYPE_COOKIE_ACCEPT_POLICY); -@@ -648,8 +696,7 @@ int main(int argc, char *argv[]) +@@ -648,8 +704,7 @@ int main(int argc, char *argv[]) gtk_main(); @@ -12591,10 +12641,10 @@ index 373d0de77e852c673a6615e0acedd5195e3c021b..cfeb4f806f79d1a213fdb13346e2b383 + WKPageRunBeforeUnloadConfirmPanelResultListenerRef m_beforeUnloadDialog = { }; }; diff --git a/Tools/MiniBrowser/win/WinMain.cpp b/Tools/MiniBrowser/win/WinMain.cpp -index 6008ca19e26a938cf962c0c336299fff7d13f9a3..a5f7daaf5c2dc860296b5d9379d5637d611ca707 100644 +index 6008ca19e26a938cf962c0c336299fff7d13f9a3..8005d72f8c0d9ef82efda8aec1ff0e7d96501ae8 100644 --- a/Tools/MiniBrowser/win/WinMain.cpp +++ b/Tools/MiniBrowser/win/WinMain.cpp -@@ -31,7 +31,12 @@ +@@ -31,6 +31,10 @@ #include "stdafx.h" #include "Common.h" #include "MiniBrowserLibResource.h" @@ -12603,11 +12653,9 @@ index 6008ca19e26a938cf962c0c336299fff7d13f9a3..a5f7daaf5c2dc860296b5d9379d5637d +#include +#include #include -+#include #if USE(CF) - #include -@@ -46,11 +51,30 @@ +@@ -46,9 +50,25 @@ #include #endif @@ -12632,13 +12680,8 @@ index 6008ca19e26a938cf962c0c336299fff7d13f9a3..a5f7daaf5c2dc860296b5d9379d5637d + int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpstrCmdLine, _In_ int nCmdShow) { -+#if ENABLE(WEBKIT) -+ WTF::RunLoop::initializeMainRunLoop(); -+#endif #ifdef _CRTDBG_MAP_ALLOC - _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); - _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); -@@ -66,6 +90,11 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, +@@ -66,6 +86,11 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, InitCommonControlsEx(&InitCtrlEx); auto options = parseCommandLine(); @@ -12650,7 +12693,7 @@ index 6008ca19e26a938cf962c0c336299fff7d13f9a3..a5f7daaf5c2dc860296b5d9379d5637d if (options.useFullDesktop) computeFullDesktopFrame(); -@@ -74,32 +103,50 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, +@@ -74,32 +99,50 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, OleInitialize(nullptr); if (SetProcessDpiAwarenessContextPtr()) @@ -12658,9 +12701,9 @@ index 6008ca19e26a938cf962c0c336299fff7d13f9a3..a5f7daaf5c2dc860296b5d9379d5637d - else - ::SetProcessDPIAware(); + SetProcessDpiAwarenessContextPtr()(DPI_AWARENESS_CONTEXT_UNAWARE); - -+ MainWindow::configure(options.headless, options.noStartupWindow); + ++ MainWindow::configure(options.headless, options.noStartupWindow); + + if (!options.noStartupWindow) { #if !ENABLE(WEBKIT_LEGACY) - auto factory = WebKitBrowserWindow::create; @@ -12730,7 +12773,7 @@ index 04d3630dc2b0f5e937af173046268001da003753..ba0a60b832cd353776bb50b8198df2d8 ) diff --git a/Tools/MiniBrowser/wpe/main.cpp b/Tools/MiniBrowser/wpe/main.cpp -index a0ca94ac2dcc005b403180aa11407ff7b33dcbc6..ad155edd606477ecfc4a72c524df1fa5af33bab8 100644 +index a0ca94ac2dcc005b403180aa11407ff7b33dcbc6..a10ce93a58f138eb475273444bba33f9a6b69081 100644 --- a/Tools/MiniBrowser/wpe/main.cpp +++ b/Tools/MiniBrowser/wpe/main.cpp @@ -25,7 +25,7 @@ @@ -12742,25 +12785,27 @@ index a0ca94ac2dcc005b403180aa11407ff7b33dcbc6..ad155edd606477ecfc4a72c524df1fa5 #include "WindowViewBackend.h" #if ENABLE_WEB_AUDIO || ENABLE_VIDEO #include -@@ -43,6 +43,8 @@ static gboolean headlessMode; +@@ -43,6 +43,9 @@ static gboolean headlessMode; static gboolean privateMode; static gboolean automationMode; static gboolean ignoreTLSErrors; +static gboolean inspectorPipe; ++static gboolean noStartupWindow; +static const char* userDataDir; static const char* contentFilter; static const char* cookiesFile; static const char* cookiesPolicy; -@@ -63,6 +65,8 @@ static const GOptionEntry commandLineOptions[] = +@@ -63,6 +66,9 @@ 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 }, + { "user-data-dir", 0, 0, G_OPTION_ARG_STRING, &userDataDir, "Default profile persistence folder location", "FILE" }, ++ { "no-startup-window", 0, 0, G_OPTION_ARG_NONE, &noStartupWindow, "Do not open default page", nullptr }, { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &uriArguments, nullptr, "[URL]" }, { nullptr, 0, 0, G_OPTION_ARG_NONE, nullptr, nullptr, nullptr } }; -@@ -131,7 +135,7 @@ static gboolean decidePermissionRequest(WebKitWebView *, WebKitPermissionRequest +@@ -131,7 +137,7 @@ static gboolean decidePermissionRequest(WebKitWebView *, WebKitPermissionRequest static std::unique_ptr createViewBackend(uint32_t width, uint32_t height) { if (headlessMode) @@ -12769,7 +12814,7 @@ index a0ca94ac2dcc005b403180aa11407ff7b33dcbc6..ad155edd606477ecfc4a72c524df1fa5 return std::make_unique(width, height); } -@@ -147,12 +151,33 @@ static void filterSavedCallback(WebKitUserContentFilterStore *store, GAsyncResul +@@ -147,12 +153,33 @@ static void filterSavedCallback(WebKitUserContentFilterStore *store, GAsyncResul g_main_loop_quit(data->mainLoop); } @@ -12804,7 +12849,7 @@ index a0ca94ac2dcc005b403180aa11407ff7b33dcbc6..ad155edd606477ecfc4a72c524df1fa5 { auto backend = createViewBackend(1280, 720); struct wpe_view_backend* wpeBackend = backend->backend(); -@@ -164,14 +189,56 @@ static WebKitWebView* createWebView(WebKitWebView* webView, WebKitNavigationActi +@@ -164,14 +191,54 @@ static WebKitWebView* createWebView(WebKitWebView* webView, WebKitNavigationActi delete static_cast(data); }, backend.release()); @@ -12852,10 +12897,8 @@ index a0ca94ac2dcc005b403180aa11407ff7b33dcbc6..ad155edd606477ecfc4a72c524df1fa5 + return webView; +} + -+static void configureBrowserInspector(GMainLoop* mainLoop, WebKitWebContext *webContext) ++static void configureBrowserInspector(GMainLoop* mainLoop) +{ -+ persistentWebContext = webContext; -+ + WebKitBrowserInspector* browserInspector = webkit_browser_inspector_get_default(); + g_signal_connect(browserInspector, "create-new-page", G_CALLBACK(createNewPage), NULL); + webkit_browser_inspector_initialize_pipe(mainLoop); @@ -12864,7 +12907,22 @@ index a0ca94ac2dcc005b403180aa11407ff7b33dcbc6..ad155edd606477ecfc4a72c524df1fa5 int main(int argc, char *argv[]) { #if ENABLE_DEVELOPER_MODE -@@ -215,7 +282,18 @@ int main(int argc, char *argv[]) +@@ -206,6 +273,14 @@ int main(int argc, char *argv[]) + } + + auto* loop = g_main_loop_new(nullptr, FALSE); ++ if (inspectorPipe) ++ configureBrowserInspector(loop); ++ ++ if (noStartupWindow) { ++ g_main_loop_run(loop); ++ g_main_loop_unref(loop); ++ return 0; ++ } + + auto backend = createViewBackend(1280, 720); + struct wpe_view_backend* wpeBackend = backend->backend(); +@@ -215,7 +290,19 @@ int main(int argc, char *argv[]) return 1; } @@ -12880,21 +12938,12 @@ index a0ca94ac2dcc005b403180aa11407ff7b33dcbc6..ad155edd606477ecfc4a72c524df1fa5 + } + + WebKitWebContext *webContext = WEBKIT_WEB_CONTEXT(g_object_new(WEBKIT_TYPE_WEB_CONTEXT, "website-data-manager", manager, "process-swap-on-cross-site-navigation-enabled", TRUE, NULL)); ++ persistentWebContext = webContext; + g_object_unref(manager); if (cookiesPolicy) { auto* cookieManager = webkit_web_context_get_cookie_manager(webContext); -@@ -280,6 +358,9 @@ int main(int argc, char *argv[]) - delete static_cast(data); - }, backend.release()); - -+ if (inspectorPipe) -+ configureBrowserInspector(loop, webContext); -+ - auto* webView = WEBKIT_WEB_VIEW(g_object_new(WEBKIT_TYPE_WEB_VIEW, - "backend", viewBackend, - "web-context", webContext, -@@ -300,7 +381,9 @@ int main(int argc, char *argv[]) +@@ -300,7 +387,9 @@ int main(int argc, char *argv[]) g_signal_connect(webContext, "automation-started", G_CALLBACK(automationStartedCallback), webView); g_signal_connect(webView, "permission-request", G_CALLBACK(decidePermissionRequest), nullptr); g_signal_connect(webView, "create", G_CALLBACK(createWebView), nullptr); @@ -12905,7 +12954,7 @@ index a0ca94ac2dcc005b403180aa11407ff7b33dcbc6..ad155edd606477ecfc4a72c524df1fa5 if (ignoreTLSErrors) webkit_web_context_set_tls_errors_policy(webContext, WEBKIT_TLS_ERRORS_POLICY_IGNORE); -@@ -319,7 +402,7 @@ int main(int argc, char *argv[]) +@@ -319,7 +408,7 @@ int main(int argc, char *argv[]) g_object_unref(file); webkit_web_view_load_uri(webView, url); g_free(url); @@ -12914,7 +12963,7 @@ index a0ca94ac2dcc005b403180aa11407ff7b33dcbc6..ad155edd606477ecfc4a72c524df1fa5 webkit_web_view_load_uri(webView, "about:blank"); else webkit_web_view_load_uri(webView, "https://wpewebkit.org"); -@@ -327,8 +410,7 @@ int main(int argc, char *argv[]) +@@ -327,8 +416,7 @@ int main(int argc, char *argv[]) g_main_loop_run(loop); g_object_unref(webView);