Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[GLIB] RemoteInspectorServer is not started if WebKitWebContext is no…
…t 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. Canonical link: https://commits.webkit.org/229087@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266718 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
13 changed files
with
175 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <JavaScriptCore/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters