Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (250678 => 250679)
--- trunk/Source/_javascript_Core/ChangeLog 2019-10-03 21:29:43 UTC (rev 250678)
+++ trunk/Source/_javascript_Core/ChangeLog 2019-10-03 21:37:48 UTC (rev 250679)
@@ -1,3 +1,18 @@
+2019-10-03 Ross Kirsling <[email protected]>
+
+ Socket RWI client should acquire backend commands from server
+ https://bugs.webkit.org/show_bug.cgi?id=202421
+
+ Reviewed by Devin Rousso.
+
+ * inspector/remote/socket/RemoteInspectorServer.cpp:
+ (Inspector::RemoteInspectorServer::setupInspectorClient):
+ (Inspector::RemoteInspectorServer::backendCommands const):
+ * inspector/remote/socket/RemoteInspectorServer.h:
+ (Inspector::RemoteInspectorServer::setBackendCommandsPath):
+ Assuming a path to InspectorBackendCommands.js has been provided,
+ read the file and send off its base64-encoded contents in a "BackendCommands" message when setting up a client.
+
2019-10-03 Yury Semikhatsky <[email protected]>
Web Inspector: tests under LayoutTests/inspector/debugger are flaky
Modified: trunk/Source/_javascript_Core/inspector/remote/socket/RemoteInspectorServer.cpp (250678 => 250679)
--- trunk/Source/_javascript_Core/inspector/remote/socket/RemoteInspectorServer.cpp 2019-10-03 21:29:43 UTC (rev 250678)
+++ trunk/Source/_javascript_Core/inspector/remote/socket/RemoteInspectorServer.cpp 2019-10-03 21:37:48 UTC (rev 250679)
@@ -29,9 +29,10 @@
#if ENABLE(REMOTE_INSPECTOR)
#include "RemoteInspectorMessageParser.h"
-
+#include <wtf/FileSystem.h>
#include <wtf/JSONValues.h>
#include <wtf/MainThread.h>
+#include <wtf/text/Base64.h>
namespace Inspector {
@@ -150,6 +151,11 @@
{
ASSERT(isMainThread());
+ auto backendCommandsEvent = JSON::Object::create();
+ backendCommandsEvent->setString("event"_s, "BackendCommands"_s);
+ backendCommandsEvent->setString("message"_s, base64Encode(backendCommands().utf8()));
+ sendWebInspectorEvent(m_clientConnection.value(), backendCommandsEvent->toJSONString());
+
auto setupEvent = JSON::Object::create();
setupEvent->setString("event"_s, "GetTargetList"_s);
@@ -249,6 +255,26 @@
sendWebInspectorEvent(m_clientConnection.value(), sendEvent->toJSONString());
}
+String RemoteInspectorServer::backendCommands() const
+{
+ if (m_backendCommandsPath.isEmpty())
+ return { };
+
+ auto handle = FileSystem::openFile(m_backendCommandsPath, FileSystem::FileOpenMode::Read);
+ if (!FileSystem::isHandleValid(handle))
+ return { };
+
+ String result;
+ long long size;
+ if (FileSystem::getFileSize(handle, size)) {
+ Vector<LChar> buffer(size);
+ if (FileSystem::readFromFile(handle, reinterpret_cast<char*>(buffer.data()), size) == size)
+ result = String::adopt(WTFMove(buffer));
+ }
+ FileSystem::closeFile(handle);
+ return result;
+}
+
} // namespace Inspector
#endif // ENABLE(REMOTE_INSPECTOR)
Modified: trunk/Source/_javascript_Core/inspector/remote/socket/RemoteInspectorServer.h (250678 => 250679)
--- trunk/Source/_javascript_Core/inspector/remote/socket/RemoteInspectorServer.h 2019-10-03 21:29:43 UTC (rev 250678)
+++ trunk/Source/_javascript_Core/inspector/remote/socket/RemoteInspectorServer.h 2019-10-03 21:37:48 UTC (rev 250679)
@@ -46,6 +46,8 @@
JS_EXPORT_PRIVATE Optional<uint16_t> listenForTargets();
JS_EXPORT_PRIVATE Optional<PlatformSocketType> connect();
+ void setBackendCommandsPath(const String& backendCommandsPath) { m_backendCommandsPath = backendCommandsPath; }
+
private:
friend class NeverDestroyed<RemoteInspectorServer>;
RemoteInspectorServer() { Socket::init(); }
@@ -67,6 +69,8 @@
void sendWebInspectorEvent(ConnectionID, const String&);
+ String backendCommands() const;
+
HashMap<String, CallHandler>& dispatchMap() override;
HashSet<std::pair<ConnectionID, TargetID>> m_inspectionTargets;
@@ -82,6 +86,8 @@
// Connection from RemoteInspectorClient.
Optional<ConnectionID> m_clientConnection;
+
+ String m_backendCommandsPath;
};
} // namespace Inspector
Modified: trunk/Source/WebKit/ChangeLog (250678 => 250679)
--- trunk/Source/WebKit/ChangeLog 2019-10-03 21:29:43 UTC (rev 250678)
+++ trunk/Source/WebKit/ChangeLog 2019-10-03 21:37:48 UTC (rev 250679)
@@ -1,3 +1,21 @@
+2019-10-03 Ross Kirsling <[email protected]>
+
+ Socket RWI client should acquire backend commands from server
+ https://bugs.webkit.org/show_bug.cgi?id=202421
+
+ Reviewed by Devin Rousso.
+
+ * UIProcess/socket/RemoteInspectorClient.cpp:
+ (WebKit::RemoteInspectorClient::dispatchMap):
+ (WebKit::RemoteInspectorClient::setBackendCommands):
+ * UIProcess/socket/RemoteInspectorClient.h:
+ Receive "BackendCommands" message from server (which is already base64-encoded) and hand it over to RWIProxy.
+
+ * UIProcess/win/WebProcessPoolWin.cpp:
+ (WebKit::backendCommandsPath):
+ (WebKit::initializeRemoteInspectorServer):
+ On Windows, initialize server with the path to InspectorBackendCommands.js from the CFBundle.
+
2019-10-03 Alex Christensen <[email protected]>
Replace _WKProcessPoolConfiguration.suppressesConnectionTerminationOnSystemChange with SPI on _WKWebsiteDataStoreConfiguration
Modified: trunk/Source/WebKit/UIProcess/socket/RemoteInspectorClient.cpp (250678 => 250679)
--- trunk/Source/WebKit/UIProcess/socket/RemoteInspectorClient.cpp 2019-10-03 21:29:43 UTC (rev 250678)
+++ trunk/Source/WebKit/UIProcess/socket/RemoteInspectorClient.cpp 2019-10-03 21:37:48 UTC (rev 250679)
@@ -54,7 +54,7 @@
void load()
{
- m_proxy->load(m_debuggableType, String());
+ m_proxy->load(m_debuggableType, m_inspectorClient.backendCommandsURL());
}
void show()
@@ -117,6 +117,7 @@
HashMap<String, Inspector::RemoteInspectorConnectionClient::CallHandler>& RemoteInspectorClient::dispatchMap()
{
static NeverDestroyed<HashMap<String, CallHandler>> dispatchMap = HashMap<String, CallHandler>({
+ { "BackendCommands"_s, static_cast<CallHandler>(&RemoteInspectorClient::setBackendCommands) },
{ "SetTargetList"_s, static_cast<CallHandler>(&RemoteInspectorClient::setTargetList) },
{ "SendMessageToFrontend"_s, static_cast<CallHandler>(&RemoteInspectorClient::sendMessageToFrontend) },
});
@@ -187,6 +188,14 @@
m_inspectorProxyMap.remove(std::make_pair(connectionID, targetID));
}
+void RemoteInspectorClient::setBackendCommands(const Event& event)
+{
+ if (!event.message || event.message->isEmpty())
+ return;
+
+ m_backendCommandsURL = makeString("data:text/_javascript_;base64,", event.message.value());
+}
+
void RemoteInspectorClient::setTargetList(const Event& event)
{
if (!event.connectionID || !event.message)
Modified: trunk/Source/WebKit/UIProcess/socket/RemoteInspectorClient.h (250678 => 250679)
--- trunk/Source/WebKit/UIProcess/socket/RemoteInspectorClient.h 2019-10-03 21:29:43 UTC (rev 250678)
+++ trunk/Source/WebKit/UIProcess/socket/RemoteInspectorClient.h 2019-10-03 21:37:48 UTC (rev 250679)
@@ -63,6 +63,7 @@
};
const HashMap<ConnectionID, Vector<Target>>& targets() const { return m_targets; }
+ const String& backendCommandsURL() const { return m_backendCommandsURL; }
void inspect(ConnectionID, TargetID, const String&);
void sendMessageToBackend(ConnectionID, TargetID, const String&);
@@ -83,6 +84,7 @@
void sendWebInspectorEvent(const String&);
+ String m_backendCommandsURL;
RemoteInspectorObserver& m_observer;
Optional<ConnectionID> m_connectionID;
HashMap<ConnectionID, Vector<Target>> m_targets;
Modified: trunk/Source/WebKit/UIProcess/win/WebProcessPoolWin.cpp (250678 => 250679)
--- trunk/Source/WebKit/UIProcess/win/WebProcessPoolWin.cpp 2019-10-03 21:29:43 UTC (rev 250678)
+++ trunk/Source/WebKit/UIProcess/win/WebProcessPoolWin.cpp 2019-10-03 21:37:48 UTC (rev 250679)
@@ -29,15 +29,28 @@
#include "WebProcessCreationParameters.h"
#include <WebCore/NotImplemented.h>
-#include <wtf/FileSystem.h>
#if ENABLE(REMOTE_INSPECTOR)
#include <_javascript_Core/RemoteInspectorServer.h>
+#include <WebCore/WebCoreBundleWin.h>
#endif
namespace WebKit {
#if ENABLE(REMOTE_INSPECTOR)
+static String backendCommandsPath()
+{
+ RetainPtr<CFURLRef> urlRef = adoptCF(CFBundleCopyResourceURL(WebCore::webKitBundle(), CFSTR("InspectorBackendCommands"), CFSTR("js"), CFSTR("WebInspectorUI\\Protocol")));
+ if (!urlRef)
+ return { };
+
+ char path[MAX_PATH];
+ if (!CFURLGetFileSystemRepresentation(urlRef.get(), false, reinterpret_cast<UInt8*>(path), MAX_PATH))
+ return { };
+
+ return path;
+}
+
static void initializeRemoteInspectorServer(StringView address)
{
if (Inspector::RemoteInspectorServer::singleton().isRunning())
@@ -46,12 +59,13 @@
auto pos = address.find(':');
if (pos == notFound)
return;
+
auto host = address.substring(0, pos);
auto port = address.substring(pos + 1).toUInt64Strict();
-
if (!port)
return;
+ Inspector::RemoteInspectorServer::singleton().setBackendCommandsPath(backendCommandsPath());
Inspector::RemoteInspectorServer::singleton().start(host.utf8().data(), port.value());
}
#endif