Diff
Modified: trunk/Source/WebKit/ChangeLog (266717 => 266718)
--- trunk/Source/WebKit/ChangeLog 2020-09-08 08:48:38 UTC (rev 266717)
+++ trunk/Source/WebKit/ChangeLog 2020-09-08 08:52:26 UTC (rev 266718)
@@ -1,3 +1,49 @@
+2020-09-08 Pablo Saavedra <[email protected]>
+
+ [GLIB] RemoteInspectorServer is not started if WebKitWebContext is not created already created
+ https://bugs.webkit.org/show_bug.cgi?id=216120
+
+ Reviewed by Carlos Garcia Campos.
+
+ Added a WebKit/UIProcess/API/glib/WebKitInitialize what implements
+ its own webkitInitialize() to ensure the inspector server is
+ initialized as early as possible, before other api calls that would
+ depend on the inspector server being running.
+
+ The RemoteInspectorServer initialization is not longer
+ asociated to the initialization of the WebProcessPoolGLib.
+
+ The webkitInitialize() extends the shared InitializeWebKit2();
+ and also includes the initialization of the RemoteInspectorServer
+ so the initialization of the remote inspector server can be now
+ triggered by the initialization of many other API objects too:
+ WebKitInputMethodContext, WebKitSettings, WebKitUserContentManager,
+ WebKitWebContext, WebKitWebsiteDataManager,
+ WebKitUserContentFilterStore, WebKitWebViewBase.
+
+ * SourcesGTK.txt:
+ * SourcesWPE.txt:
+ * UIProcess/API/glib/WebKitInitialize.cpp: Added.
+ (WebKit::initializeRemoteInspectorServer):
+ (WebKit::webkitInitialize):
+ * UIProcess/API/glib/WebKitInitialize.h: Added.
+ * UIProcess/API/glib/WebKitInputMethodContext.cpp:
+ (webkit_input_method_context_class_init):
+ * UIProcess/API/glib/WebKitSettings.cpp:
+ (webkit_settings_class_init):
+ * UIProcess/API/glib/WebKitUserContentFilterStore.cpp:
+ (webkit_user_content_filter_store_class_init):
+ * UIProcess/API/glib/WebKitUserContentManager.cpp:
+ * UIProcess/API/glib/WebKitWebContext.cpp:
+ (webkit_web_context_class_init):
+ * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
+ (webkit_website_data_manager_class_init):
+ * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+ (webkit_web_view_base_class_init):
+ * UIProcess/glib/WebProcessPoolGLib.cpp:
+ (WebKit::WebProcessPool::platformInitialize):
+ (WebKit::initializeRemoteInspectorServer): Deleted.
+
2020-09-07 Commit Queue <[email protected]>
Unreviewed, reverting r266645.
Modified: trunk/Source/WebKit/SourcesGTK.txt (266717 => 266718)
--- trunk/Source/WebKit/SourcesGTK.txt 2020-09-08 08:48:38 UTC (rev 266717)
+++ trunk/Source/WebKit/SourcesGTK.txt 2020-09-08 08:52:26 UTC (rev 266718)
@@ -141,6 +141,7 @@
UIProcess/API/glib/WebKitGeolocationManager.cpp @no-unify
UIProcess/API/glib/WebKitGeolocationPermissionRequest.cpp @no-unify
UIProcess/API/glib/WebKitIconLoadingClient.cpp @no-unify
+UIProcess/API/glib/WebKitInitialize.cpp @no-unify
UIProcess/API/glib/WebKitInjectedBundleClient.cpp @no-unify
UIProcess/API/glib/WebKitInputMethodContext.cpp @no-unify
UIProcess/API/glib/WebKitInstallMissingMediaPluginsPermissionRequest.cpp @no-unify
Modified: trunk/Source/WebKit/SourcesWPE.txt (266717 => 266718)
--- trunk/Source/WebKit/SourcesWPE.txt 2020-09-08 08:48:38 UTC (rev 266717)
+++ trunk/Source/WebKit/SourcesWPE.txt 2020-09-08 08:52:26 UTC (rev 266718)
@@ -132,6 +132,7 @@
UIProcess/API/glib/WebKitFormSubmissionRequest.cpp @no-unify
UIProcess/API/glib/WebKitGeolocationManager.cpp @no-unify
UIProcess/API/glib/WebKitGeolocationPermissionRequest.cpp @no-unify
+UIProcess/API/glib/WebKitInitialize.cpp @no-unify
UIProcess/API/glib/WebKitInjectedBundleClient.cpp @no-unify
UIProcess/API/glib/WebKitInputMethodContext.cpp @no-unify
UIProcess/API/glib/WebKitInstallMissingMediaPluginsPermissionRequest.cpp @no-unify
Added: trunk/Source/WebKit/UIProcess/API/glib/WebKitInitialize.cpp (0 => 266718)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitInitialize.cpp (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitInitialize.cpp 2020-09-08 08:52:26 UTC (rev 266718)
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2020 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebKitInitialize.h"
+
+#include <_javascript_Core/RemoteInspectorServer.h>
+#include <WebKit/Shared/WebKit2Initialize.h>
+#include <wtf/glib/GUniquePtr.h>
+
+namespace WebKit {
+
+#if ENABLE(REMOTE_INSPECTOR)
+static void initializeRemoteInspectorServer(const char* address)
+{
+ if (Inspector::RemoteInspectorServer::singleton().isRunning())
+ return;
+
+ if (!address[0])
+ return;
+
+ GUniquePtr<char> inspectorAddress(g_strdup(address));
+ char* portPtr = g_strrstr(inspectorAddress.get(), ":");
+ if (!portPtr)
+ return;
+
+ *portPtr = '\0';
+ portPtr++;
+ guint64 port = g_ascii_strtoull(portPtr, nullptr, 10);
+ if (!port)
+ return;
+
+ Inspector::RemoteInspectorServer::singleton().start(inspectorAddress.get(), port);
+}
+#endif
+
+void webkitInitialize()
+{
+ static std::once_flag onceFlag;
+
+ std::call_once(onceFlag, [] {
+ InitializeWebKit2();
+#if ENABLE(REMOTE_INSPECTOR)
+ if (const char* address = g_getenv("WEBKIT_INSPECTOR_SERVER"))
+ initializeRemoteInspectorServer(address);
+#endif
+ });
+}
+
+} // namespace WebKit
Added: trunk/Source/WebKit/UIProcess/API/glib/WebKitInitialize.h (0 => 266718)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitInitialize.h (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitInitialize.h 2020-09-08 08:52:26 UTC (rev 266718)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2020 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+namespace WebKit {
+
+void webkitInitialize();
+
+}
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitInputMethodContext.cpp (266717 => 266718)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitInputMethodContext.cpp 2020-09-08 08:48:38 UTC (rev 266717)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitInputMethodContext.cpp 2020-09-08 08:52:26 UTC (rev 266718)
@@ -21,6 +21,7 @@
#include "WebKitInputMethodContext.h"
#include "WebKitEnumTypes.h"
+#include "WebKitInitialize.h"
#include "WebKitInputMethodContextPrivate.h"
#include "WebKitWebView.h"
#include <glib/gi18n-lib.h>
@@ -203,6 +204,8 @@
static void webkit_input_method_context_class_init(WebKitInputMethodContextClass* klass)
{
+ WebKit::webkitInitialize();
+
GObjectClass* gObjectClass = G_OBJECT_CLASS(klass);
gObjectClass->set_property = webkitInputMethodContextSetProperty;
gObjectClass->get_property = webkitInputMethodContextGetProperty;
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp (266717 => 266718)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp 2020-09-08 08:48:38 UTC (rev 266717)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp 2020-09-08 08:52:26 UTC (rev 266718)
@@ -32,6 +32,7 @@
#include "WebKitSettings.h"
#include "WebKitEnumTypes.h"
+#include "WebKitInitialize.h"
#include "WebKitSettingsPrivate.h"
#include "WebPageProxy.h"
#include "WebPreferences.h"
@@ -606,6 +607,8 @@
static void webkit_settings_class_init(WebKitSettingsClass* klass)
{
+ webkitInitialize();
+
GObjectClass* gObjectClass = G_OBJECT_CLASS(klass);
gObjectClass->constructed = webKitSettingsConstructed;
gObjectClass->dispose = webKitSettingsDispose;
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitUserContentFilterStore.cpp (266717 => 266718)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitUserContentFilterStore.cpp 2020-09-08 08:48:38 UTC (rev 266717)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitUserContentFilterStore.cpp 2020-09-08 08:52:26 UTC (rev 266718)
@@ -29,6 +29,7 @@
#include "APIContentRuleList.h"
#include "APIContentRuleListStore.h"
#include "WebKitError.h"
+#include "WebKitInitialize.h"
#include "WebKitUserContent.h"
#include "WebKitUserContentPrivate.h"
#include <WebCore/ContentExtensionError.h>
@@ -40,6 +41,8 @@
#include <wtf/glib/GUniquePtr.h>
#include <wtf/glib/WTFGType.h>
+using namespace WebKit;
+
/**
* SECTION: WebKitUserContentFilterStore
* @Short_description: Handles storage of user content filters on disk.
@@ -116,6 +119,8 @@
static void webkit_user_content_filter_store_class_init(WebKitUserContentFilterStoreClass* storeClass)
{
+ webkitInitialize();
+
GObjectClass* gObjectClass = G_OBJECT_CLASS(storeClass);
gObjectClass->get_property = webkitUserContentFilterStoreGetProperty;
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitUserContentManager.cpp (266717 => 266718)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitUserContentManager.cpp 2020-09-08 08:48:38 UTC (rev 266717)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitUserContentManager.cpp 2020-09-08 08:52:26 UTC (rev 266718)
@@ -22,6 +22,7 @@
#include "APISerializedScriptValue.h"
#include "InjectUserScriptImmediately.h"
+#include "WebKitInitialize.h"
#include "WebKitJavascriptResultPrivate.h"
#include "WebKitUserContentManagerPrivate.h"
#include "WebKitUserContentPrivate.h"
@@ -78,6 +79,8 @@
static void webkit_user_content_manager_class_init(WebKitUserContentManagerClass* klass)
{
+ webkitInitialize();
+
GObjectClass* gObjectClass = G_OBJECT_CLASS(klass);
/**
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp (266717 => 266718)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp 2020-09-08 08:48:38 UTC (rev 266717)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp 2020-09-08 08:52:26 UTC (rev 266718)
@@ -32,12 +32,12 @@
#include "TextCheckerState.h"
#include "WebAutomationSession.h"
#include "WebCertificateInfo.h"
-#include "WebKit2Initialize.h"
#include "WebKitAutomationSessionPrivate.h"
#include "WebKitDownloadClient.h"
#include "WebKitDownloadPrivate.h"
#include "WebKitFaviconDatabasePrivate.h"
#include "WebKitGeolocationManagerPrivate.h"
+#include "WebKitInitialize.h"
#include "WebKitInjectedBundleClient.h"
#include "WebKitNetworkProxySettingsPrivate.h"
#include "WebKitNotificationProvider.h"
@@ -463,13 +463,13 @@
static void webkit_web_context_class_init(WebKitWebContextClass* webContextClass)
{
+ webkitInitialize();
+
GObjectClass* gObjectClass = G_OBJECT_CLASS(webContextClass);
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
- InitializeWebKit2();
-
gObjectClass->get_property = webkitWebContextGetProperty;
gObjectClass->set_property = webkitWebContextSetProperty;
gObjectClass->constructed = webkitWebContextConstructed;
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitWebsiteDataManager.cpp (266717 => 266718)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitWebsiteDataManager.cpp 2020-09-08 08:48:38 UTC (rev 266717)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitWebsiteDataManager.cpp 2020-09-08 08:52:26 UTC (rev 266718)
@@ -21,6 +21,7 @@
#include "WebKitWebsiteDataManager.h"
#include "WebKitCookieManagerPrivate.h"
+#include "WebKitInitialize.h"
#include "WebKitPrivate.h"
#include "WebKitWebsiteDataManagerPrivate.h"
#include "WebKitWebsiteDataPrivate.h"
@@ -244,6 +245,8 @@
static void webkit_website_data_manager_class_init(WebKitWebsiteDataManagerClass* findClass)
{
+ webkitInitialize();
+
GObjectClass* gObjectClass = G_OBJECT_CLASS(findClass);
gObjectClass->get_property = webkitWebsiteDataManagerGetProperty;
Modified: trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp (266717 => 266718)
--- trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp 2020-09-08 08:48:38 UTC (rev 266717)
+++ trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp 2020-09-08 08:52:26 UTC (rev 266718)
@@ -46,6 +46,7 @@
#include "WebInspectorProxy.h"
#include "WebKit2Initialize.h"
#include "WebKitEmojiChooser.h"
+#include "WebKitInitialize.h"
#include "WebKitInputMethodContextImplGtk.h"
#include "WebKitWebViewAccessible.h"
#include "WebKitWebViewBaseInternal.h"
@@ -2024,9 +2025,9 @@
#endif
// Before creating a WebKitWebViewBasePriv we need to be sure that WebKit is started.
- // Usually starting a context triggers InitializeWebKit2, but in case
+ // Usually starting a context triggers webkitInitialize, but in case
// we create a view without asking before for a default_context we get a crash.
- WebKit::InitializeWebKit2();
+ WebKit::webkitInitialize();
gtk_widget_class_set_css_name(widgetClass, "webkitwebview");
}
Modified: trunk/Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp (266717 => 266718)
--- trunk/Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp 2020-09-08 08:48:38 UTC (rev 266717)
+++ trunk/Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp 2020-09-08 08:52:26 UTC (rev 266718)
@@ -31,10 +31,8 @@
#include "LegacyGlobalSettings.h"
#include "WebMemoryPressureHandler.h"
#include "WebProcessCreationParameters.h"
-#include <_javascript_Core/RemoteInspectorServer.h>
#include <WebCore/PlatformDisplay.h>
#include <wtf/FileSystem.h>
-#include <wtf/glib/GUniquePtr.h>
#if USE(GSTREAMER)
#include <WebCore/GStreamerCommon.h>
@@ -54,30 +52,6 @@
namespace WebKit {
-#if ENABLE(REMOTE_INSPECTOR)
-static void initializeRemoteInspectorServer(const char* address)
-{
- if (Inspector::RemoteInspectorServer::singleton().isRunning())
- return;
-
- if (!address[0])
- return;
-
- GUniquePtr<char> inspectorAddress(g_strdup(address));
- char* portPtr = g_strrstr(inspectorAddress.get(), ":");
- if (!portPtr)
- return;
-
- *portPtr = '\0';
- portPtr++;
- guint64 port = g_ascii_strtoull(portPtr, nullptr, 10);
- if (!port)
- return;
-
- Inspector::RemoteInspectorServer::singleton().start(inspectorAddress.get(), port);
-}
-#endif
-
static bool memoryPressureMonitorDisabled()
{
static const char* disableMemoryPressureMonitor = getenv("WEBKIT_DISABLE_MEMORY_PRESSURE_MONITOR");
@@ -92,11 +66,6 @@
if (const char* forceComplexText = getenv("WEBKIT_FORCE_COMPLEX_TEXT"))
m_alwaysUsesComplexTextCodePath = !strcmp(forceComplexText, "1");
-#if ENABLE(REMOTE_INSPECTOR)
- if (const char* address = g_getenv("WEBKIT_INSPECTOR_SERVER"))
- initializeRemoteInspectorServer(address);
-#endif
-
if (!memoryPressureMonitorDisabled())
installMemoryPressureHandler();
}