Diff
Modified: trunk/ChangeLog (137034 => 137035)
--- trunk/ChangeLog 2012-12-08 17:13:56 UTC (rev 137034)
+++ trunk/ChangeLog 2012-12-08 17:16:05 UTC (rev 137035)
@@ -1,3 +1,14 @@
+2012-12-08 Seokju Kwon <[email protected]>
+
+ [EFL][WK2] Add Remote Web Inspector
+ https://bugs.webkit.org/show_bug.cgi?id=98705
+
+ Reviewed by Gyuyoung Kim.
+
+ Prepare inspectorPageIndex.html for remote web inspector.
+
+ * Source/PlatformEfl.cmake:
+
2012-12-06 Rick Byers <[email protected]>
CSS cursor property should support webkit-image-set
Modified: trunk/Source/PlatformEfl.cmake (137034 => 137035)
--- trunk/Source/PlatformEfl.cmake 2012-12-08 17:13:56 UTC (rev 137034)
+++ trunk/Source/PlatformEfl.cmake 2012-12-08 17:16:05 UTC (rev 137035)
@@ -5,6 +5,7 @@
web-inspector-resources ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory ${WEBCORE_DIR}/inspector/front-end ${WEB_INSPECTOR_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${WEBCORE_DIR}/English.lproj/localizedStrings.js ${WEB_INSPECTOR_DIR}
+ COMMAND ${CMAKE_COMMAND} -E copy ${WEBKIT2_DIR}/UIProcess/InspectorServer/front-end/inspectorPageIndex.html ${WEB_INSPECTOR_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorBackendCommands.js ${WEB_INSPECTOR_DIR}
DEPENDS ${WebCore_LIBRARY_NAME}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
Modified: trunk/Source/WebKit2/CMakeLists.txt (137034 => 137035)
--- trunk/Source/WebKit2/CMakeLists.txt 2012-12-08 17:13:56 UTC (rev 137034)
+++ trunk/Source/WebKit2/CMakeLists.txt 2012-12-08 17:16:05 UTC (rev 137035)
@@ -18,6 +18,7 @@
"${WEBKIT2_DIR}/UIProcess/Authentication"
"${WEBKIT2_DIR}/UIProcess/CoordinatedGraphics"
"${WEBKIT2_DIR}/UIProcess/Downloads"
+ "${WEBKIT2_DIR}/UIProcess/InspectorServer"
"${WEBKIT2_DIR}/UIProcess/Launcher"
"${WEBKIT2_DIR}/UIProcess/Notifications"
"${WEBKIT2_DIR}/UIProcess/Plugins"
@@ -60,6 +61,7 @@
"${WEBCORE_DIR}/dom"
"${WEBCORE_DIR}/dom/default"
"${WEBCORE_DIR}/editing"
+ "${WEBCORE_DIR}/fileapi"
"${WEBCORE_DIR}/history"
"${WEBCORE_DIR}/html"
"${WEBCORE_DIR}/html/shadow"
Modified: trunk/Source/WebKit2/ChangeLog (137034 => 137035)
--- trunk/Source/WebKit2/ChangeLog 2012-12-08 17:13:56 UTC (rev 137034)
+++ trunk/Source/WebKit2/ChangeLog 2012-12-08 17:16:05 UTC (rev 137035)
@@ -1,3 +1,33 @@
+2012-12-08 Seokju Kwon <[email protected]>
+
+ [EFL][WK2] Add Remote Web Inspector
+ https://bugs.webkit.org/show_bug.cgi?id=98705
+
+ Reviewed by Gyuyoung Kim.
+
+ Add Remote Web Inspector to EFL port.
+ The WebInspectorSever will be started during WebKit context initialization.
+ The IP address and port number for the server can be set in WEBKIT_INSPECTOR_SERVER.
+
+ * CMakeLists.txt:
+ * PlatformEfl.cmake:
+ * UIProcess/InspectorServer/WebInspectorServer.h:
+ (WebInspectorServer):
+ * UIProcess/InspectorServer/WebSocketServer.h:
+ (WebSocketServer):
+ * UIProcess/InspectorServer/efl/WebInspectorServerEfl.cpp: Added.
+ (WebKit):
+ (WebKit::inspectorResourcePath):
+ (WebKit::WebInspectorServer::platformResourceForPath):
+ (WebKit::WebInspectorServer::buildPageList):
+ * UIProcess/InspectorServer/soup/WebSocketServerSoup.cpp:
+ (WebKit::connectionCallback):
+ * UIProcess/efl/WebContextEfl.cpp:
+ (WebKit::initializeInspectorServer):
+ (WebKit):
+ (WebKit::WebContext::platformInitializeWebProcess):
+ * config.h:
+
2012-12-08 Gustavo Noronha Silva <[email protected]>
Unreviewed. Make building the WebKit2 GIR file conditional on building the WebKit2 library.
Modified: trunk/Source/WebKit2/PlatformEfl.cmake (137034 => 137035)
--- trunk/Source/WebKit2/PlatformEfl.cmake 2012-12-08 17:13:56 UTC (rev 137034)
+++ trunk/Source/WebKit2/PlatformEfl.cmake 2012-12-08 17:16:05 UTC (rev 137035)
@@ -106,6 +106,9 @@
UIProcess/efl/WebPreferencesEfl.cpp
UIProcess/efl/WebProcessProxyEfl.cpp
+ UIProcess/InspectorServer/efl/WebInspectorServerEfl.cpp
+ UIProcess/InspectorServer/soup/WebSocketServerSoup.cpp
+
UIProcess/soup/WebCookieManagerProxySoup.cpp
UIProcess/soup/WebSoupRequestManagerClient.cpp
UIProcess/soup/WebSoupRequestManagerProxy.cpp
Modified: trunk/Source/WebKit2/UIProcess/InspectorServer/WebInspectorServer.h (137034 => 137035)
--- trunk/Source/WebKit2/UIProcess/InspectorServer/WebInspectorServer.h 2012-12-08 17:13:56 UTC (rev 137034)
+++ trunk/Source/WebKit2/UIProcess/InspectorServer/WebInspectorServer.h 2012-12-08 17:16:05 UTC (rev 137035)
@@ -61,7 +61,7 @@
virtual void didCloseWebSocketConnection(WebSocketServerConnection*);
bool platformResourceForPath(const String& path, Vector<char>& data, String& contentType);
-#if PLATFORM(QT) || PLATFORM(GTK)
+#if PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL)
void buildPageList(Vector<char>& data, String& contentType);
#endif
Modified: trunk/Source/WebKit2/UIProcess/InspectorServer/WebSocketServer.h (137034 => 137035)
--- trunk/Source/WebKit2/UIProcess/InspectorServer/WebSocketServer.h 2012-12-08 17:13:56 UTC (rev 137034)
+++ trunk/Source/WebKit2/UIProcess/InspectorServer/WebSocketServer.h 2012-12-08 17:16:05 UTC (rev 137035)
@@ -29,15 +29,14 @@
#if ENABLE(INSPECTOR_SERVER)
-#if PLATFORM(GTK)
-#include <gio/gio.h>
-#endif
#include <wtf/Deque.h>
#include <wtf/OwnPtr.h>
-#if PLATFORM(GTK)
+#include <wtf/text/WTFString.h>
+
+#if USE(SOUP)
+#include <gio/gio.h>
#include <wtf/gobject/GRefPtr.h>
#endif
-#include <wtf/text/WTFString.h>
#if PLATFORM(QT)
namespace WebKit {
@@ -84,7 +83,7 @@
unsigned short m_port;
#if PLATFORM(QT)
OwnPtr<QtTcpServerHandler> m_tcpServerHandler;
-#elif PLATFORM(GTK)
+#elif USE(SOUP)
GRefPtr<GSocketService> m_socketService;
#endif
friend class WebSocketServerConnection;
Added: trunk/Source/WebKit2/UIProcess/InspectorServer/efl/WebInspectorServerEfl.cpp (0 => 137035)
--- trunk/Source/WebKit2/UIProcess/InspectorServer/efl/WebInspectorServerEfl.cpp (rev 0)
+++ trunk/Source/WebKit2/UIProcess/InspectorServer/efl/WebInspectorServerEfl.cpp 2012-12-08 17:16:05 UTC (rev 137035)
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2012 Seokju Kwon ([email protected])
+ *
+ * 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT OWNER OR 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 "WebInspectorServer.h"
+
+#include "WebInspectorProxy.h"
+#include "WebPageProxy.h"
+#include <WebCore/MIMETypeRegistry.h>
+#include <sys/stat.h>
+
+namespace WebKit {
+
+static String inspectorResourcePath()
+{
+ String inspectorFilesPath = String::fromUTF8(WEB_INSPECTOR_INSTALL_DIR);
+ if (access(inspectorFilesPath.utf8().data(), R_OK))
+ inspectorFilesPath = String::fromUTF8(WEB_INSPECTOR_DIR);
+
+ return inspectorFilesPath;
+}
+
+bool WebInspectorServer::platformResourceForPath(const String& path, Vector<char>& data, String& contentType)
+{
+ // The page list contains an unformated list of pages that can be inspected with a link to open a session.
+ if (path == "/pagelist.json") {
+ buildPageList(data, contentType);
+ return true;
+ }
+
+ // Point the default path to a formatted page that queries the page list and display them.
+ String localPath = inspectorResourcePath() + ((path == "/") ? ASCIILiteral("/inspectorPageIndex.html") : path);
+
+ FILE* fileHandle = fopen(localPath.utf8().data(), "r");
+ if (!fileHandle)
+ return false;
+
+ struct stat fileStat;
+ if (fstat(fileno(fileHandle), &fileStat)) {
+ fclose(fileHandle);
+ return false;
+ }
+
+ data.grow(fileStat.st_size);
+ int bytesRead = fread(data.data(), 1, fileStat.st_size, fileHandle);
+ fclose(fileHandle);
+
+ if (bytesRead < fileStat.st_size)
+ return false;
+
+ size_t extStart = localPath.reverseFind('.');
+ if (extStart == notFound)
+ return false;
+
+ String ext = localPath.substring(extStart + 1);
+ if (ext.isEmpty())
+ return false;
+
+ contentType = WebCore::MIMETypeRegistry::getMIMETypeForExtension(ext);
+
+ return true;
+}
+
+void WebInspectorServer::buildPageList(Vector<char>& data, String& contentType)
+{
+ StringBuilder builder;
+ builder.append('[');
+
+ ClientMap::iterator end = m_clientMap.end();
+ for (ClientMap::iterator it = m_clientMap.begin(); it != end; ++it) {
+ WebPageProxy* webPage = it->value->page();
+ if (it != m_clientMap.begin())
+ builder.appendLiteral(", ");
+ builder.appendLiteral("{ \"id\": ");
+ builder.appendNumber(it->key);
+ builder.appendLiteral(", \"title\": \"");
+ builder.append(webPage->pageTitle());
+ builder.appendLiteral("\", \"url\": \"");
+ builder.append(webPage->activeURL());
+ builder.appendLiteral("\", \"inspectorUrl\": \"");
+ builder.appendLiteral("/inspector.html?page=");
+ builder.appendNumber(it->key);
+ builder.appendLiteral("\" }");
+ }
+
+ builder.append(']');
+ CString clientList = builder.toString().utf8();
+ data.append(clientList.data(), clientList.length());
+ contentType = String("application/json; charset=utf-8", String::ConstructFromLiteral);
+}
+
+}
Modified: trunk/Source/WebKit2/UIProcess/InspectorServer/soup/WebSocketServerSoup.cpp (137034 => 137035)
--- trunk/Source/WebKit2/UIProcess/InspectorServer/soup/WebSocketServerSoup.cpp 2012-12-08 17:13:56 UTC (rev 137034)
+++ trunk/Source/WebKit2/UIProcess/InspectorServer/soup/WebSocketServerSoup.cpp 2012-12-08 17:16:05 UTC (rev 137035)
@@ -39,7 +39,7 @@
namespace WebKit {
-static gboolean connectionCallback(GSocketService* service, GSocketConnection* connection, GObject* sourceObject, WebSocketServer* server)
+static gboolean connectionCallback(GSocketService* /*service*/, GSocketConnection* connection, GObject* /*sourceObject*/, WebSocketServer* server)
{
#if !LOG_DISABLED
GRefPtr<GSocketAddress> socketAddress = adoptGRef(g_socket_connection_get_remote_address(connection, 0));
Modified: trunk/Source/WebKit2/UIProcess/efl/WebContextEfl.cpp (137034 => 137035)
--- trunk/Source/WebKit2/UIProcess/efl/WebContextEfl.cpp 2012-12-08 17:13:56 UTC (rev 137034)
+++ trunk/Source/WebKit2/UIProcess/efl/WebContextEfl.cpp 2012-12-08 17:16:05 UTC (rev 137035)
@@ -25,9 +25,11 @@
#include "config.h"
#include "WebContext.h"
+
+#include "Logging.h"
+#include "WebInspectorServer.h"
#include "WebProcessCreationParameters.h"
#include "WebSoupRequestManagerProxy.h"
-
#include <Efreet.h>
#include <WebCore/ApplicationCacheStorage.h>
#include <WebCore/IconDatabase.h>
@@ -35,6 +37,47 @@
namespace WebKit {
+static void initializeInspectorServer()
+{
+#if ENABLE(INSPECTOR_SERVER)
+ static bool initialized = false;
+ if (initialized)
+ return;
+
+ // It should be set to true always.
+ // Because it is to ensure initializeInspectorServer() is executed only once,
+ // even if the server fails to run.
+ initialized = true;
+
+ String serverAddress(getenv("WEBKIT_INSPECTOR_SERVER"));
+ if (!serverAddress.isNull()) {
+ String bindAddress = ASCIILiteral("127.0.0.1");
+ unsigned short port = 2999;
+
+ Vector<String> result;
+ serverAddress.split(':', result);
+
+ if (result.size() == 2) {
+ bindAddress = result[0];
+ bool ok = false;
+ port = result[1].toUInt(&ok);
+ if (!ok) {
+ port = 2999;
+ LOG_ERROR("Couldn't parse the port. Using 2999 instead.");
+ }
+ } else
+ LOG_ERROR("Couldn't parse %s, wrong format? Using 127.0.0.1:2999 instead.", serverAddress.utf8().data());
+
+ if (!WebInspectorServer::shared().listen(bindAddress, port))
+ LOG_ERROR("Couldn't start listening on: IP address=%s, port=%d.", bindAddress.utf8().data(), port);
+
+ return;
+ }
+
+ LOG(InspectorServer, "To start inspector server set WEBKIT_INSPECTOR_SERVER to 127.0.0.1:2999 for example.");
+#endif
+}
+
String WebContext::applicationCacheDirectory()
{
return String::fromUTF8(efreet_cache_home_get()) + "/WebKitEfl/Applications";
@@ -42,6 +85,8 @@
void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& parameters)
{
+ initializeInspectorServer();
+
parameters.urlSchemesRegistered = m_soupRequestManagerProxy->registeredURISchemes();
}
Modified: trunk/Source/WebKit2/config.h (137034 => 137035)
--- trunk/Source/WebKit2/config.h 2012-12-08 17:13:56 UTC (rev 137034)
+++ trunk/Source/WebKit2/config.h 2012-12-08 17:16:05 UTC (rev 137035)
@@ -120,7 +120,7 @@
#define PLUGIN_ARCHITECTURE(ARCH) (defined PLUGIN_ARCHITECTURE_##ARCH && PLUGIN_ARCHITECTURE_##ARCH)
#ifndef ENABLE_INSPECTOR_SERVER
-#if PLATFORM(QT) || PLATFORM(GTK)
+#if PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL)
#define ENABLE_INSPECTOR_SERVER 1
#endif
#endif