[GTK] Move to the new web inspector
authorkov@webkit.org <kov@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Sep 2013 19:06:11 +0000 (19:06 +0000)
committerkov@webkit.org <kov@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Sep 2013 19:06:11 +0000 (19:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=120647

Patch by Gustavo Noronha Silva <gustavo.noronha@collabora.com> on 2013-09-13
Reviewed by Carlos Garcia Campos.

.:

* GNUmakefile.am: include the new WebInspectorUI GNUmakefile.am.

Source/WebCore:

No tests for the new inspector UI as of yet.

* GNUmakefile.am: no longer install the deprecated inspector UI files.
* WebCore.exp.in: add SchemeRegistry symbol that is now used.

Source/WebInspectorUI:

* GNUmakefile.am: Added. Generate the GResource source and link it into libWebCore.

Source/WebKit/gtk:

* WebCoreSupport/InspectorClientGtk.cpp:
(WebKit::InspectorClient::openInspectorFrontend): update paths to the internal resource ones.
(WebKit::InspectorClient::inspectorFilesPath): ditto.
* tests/testwebinspector.c:
(consoleMessageCallback): the new inspector currently emits an error when loading, so add it to
the list of messages which are not considered failures.
* webkit/webkitglobals.cpp:
(webkitInit): register resource as a local scheme; currently used by the inspector.

Source/WebKit2:

* GNUmakefile.am: bundle the remote inspector page list HTML into libwebkit2gtk as a GResource.
* UIProcess/API/gtk/tests/GNUmakefile.am: no need to set WEBKIT_INSPECTOR_PATH anymore.
* UIProcess/API/gtk/tests/InspectorTestServer.cpp:
(main): ditto.
* UIProcess/API/gtk/tests/TestInspector.cpp:
(beforeAll): ditto.
* UIProcess/API/gtk/tests/TestInspectorServer.cpp:
(testInspectorServerPageList): update paths to the internal resource ones.
* UIProcess/InspectorServer/WebInspectorServer.h:
* UIProcess/InspectorServer/gtk/WebInspectorServerGtk.cpp:
(WebKit::WebInspectorServer::platformResourceForPath): ditto.
(WebKit::WebInspectorServer::buildPageList): ditto.
* UIProcess/WebInspectorProxy.cpp:
(WebKit::isMainInspectorPage): factor out checking for the inspector main resource, to make
the code more readable.
(WebKit::decidePolicyForNavigationAction): use SchemeRegistry to figure out whether the
request is for a local resource instead of KURL::isLocalFile() to allow using schemes
other than file:// for the inspector resources.
* UIProcess/gtk/WebInspectorProxyGtk.cpp:
(WebKit::WebInspectorProxy::inspectorPageURL): use the new internal resource URL; since it's now
static we no longer need to generate and store the string.
(WebKit::WebInspectorProxy::inspectorBaseURL): ditto.
* WebProcess/WebPage/gtk/WebInspectorGtk.cpp:
(WebKit::WebInspector::localizedStringsURL): use the new internal resource URL.
* UIProcess/gtk/WebContextGtk.cpp:
(WebKit::WebContext::platformInitializeWebProcess): register resource as a local scheme.

Tools:

* GtkLauncher/main.c:
(main): no longer set WEBKIT_INSPECTOR_PATH.
* MiniBrowser/gtk/main.c:
(main): ditto.
* Scripts/old-run-webkit-tests:
(openDumpTool): ditto.
* Scripts/run-gtk-tests: ditto.
* Scripts/webkitpy/port/gtk.py:
(GtkPort.setup_environ_for_server): ditto.

LayoutTests:

* platform/gtk/TestExpectations: the new inspector UI does not support the current
inspector testing harness so keep it skipped, a new one will eventually be landed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@155714 268f45cc-cd09-0410-ab3c-d52691b4dbfc

31 files changed:
ChangeLog
GNUmakefile.am
LayoutTests/ChangeLog
LayoutTests/platform/gtk/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.am
Source/WebCore/WebCore.exp.in
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/GNUmakefile.am [new file with mode: 0644]
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
Source/WebKit/gtk/tests/testwebinspector.c
Source/WebKit/gtk/webkit/webkitglobals.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/GNUmakefile.am
Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am
Source/WebKit2/UIProcess/API/gtk/tests/InspectorTestServer.cpp
Source/WebKit2/UIProcess/API/gtk/tests/TestInspector.cpp
Source/WebKit2/UIProcess/API/gtk/tests/TestInspectorServer.cpp
Source/WebKit2/UIProcess/InspectorServer/WebInspectorServer.h
Source/WebKit2/UIProcess/InspectorServer/gtk/WebInspectorServerGtk.cpp
Source/WebKit2/UIProcess/WebInspectorProxy.cpp
Source/WebKit2/UIProcess/gtk/WebContextGtk.cpp
Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp
Source/WebKit2/WebProcess/WebPage/gtk/WebInspectorGtk.cpp
Tools/ChangeLog
Tools/GtkLauncher/main.c
Tools/MiniBrowser/gtk/main.c
Tools/Scripts/old-run-webkit-tests
Tools/Scripts/run-gtk-tests
Tools/Scripts/webkitpy/port/gtk.py

index fde4ada..83ec0f6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2013-09-13  Gustavo Noronha Silva  <gustavo.noronha@collabora.com>
+
+        [GTK] Move to the new web inspector
+        https://bugs.webkit.org/show_bug.cgi?id=120647
+
+        Reviewed by Carlos Garcia Campos.
+
+        * GNUmakefile.am: include the new WebInspectorUI GNUmakefile.am.
+
 2013-09-13  Allan Sandfeld Jensen  <allan.jensen@digia.com>
 
         [Qt] Update sync.profile
index 63f6d57..ec648a4 100644 (file)
@@ -34,6 +34,7 @@ DISTCHECK_CONFIGURE_FLAGS = \
 GENSOURCES := $(top_builddir)/DerivedSources
 GENSOURCES_JAVASCRIPTCORE := $(top_builddir)/DerivedSources/JavaScriptCore
 GENSOURCES_WEBCORE := $(top_builddir)/DerivedSources/WebCore
+GENSOURCES_WEBINSPECTOR_UI := $(top_builddir)/DerivedSources/WebInspectorUI
 GENSOURCES_WEBKIT := $(top_builddir)/DerivedSources/webkit
 GENSOURCES_WEBKIT2 := $(top_builddir)/DerivedSources/WebKit2
 GENSOURCES_WEBKITDOM := $(top_builddir)/DerivedSources/webkitdom
@@ -41,6 +42,7 @@ GENSOURCES_PLATFORM := $(top_builddir)/DerivedSources/Platform
 GENPROGRAMS := $(top_builddir)/Programs
 GENSOURCES_INSPECTOR := $(GENPROGRAMS)/resources/inspector
 WebCore := $(srcdir)/Source/WebCore
+WebInspectorUI := $(srcdir)/Source/WebInspectorUI
 WebKit := $(srcdir)/Source/WebKit/gtk
 WebKit2 := $(srcdir)/Source/WebKit2
 pkgconfigdir := $(libdir)/pkgconfig
@@ -197,6 +199,7 @@ include Source/Platform/GNUmakefile.am
 include Source/WebCore/GNUmakefile.am
 include Source/WebCore/bindings/gobject/GNUmakefile.am
 include Source/WebCore/platform/gtk/po/GNUmakefile.am
+include Source/WebInspectorUI/GNUmakefile.am
 include Source/WebKit/gtk/GNUmakefile.am
 include Tools/GNUmakefile.am
 
index d1f621a..8cf467f 100644 (file)
@@ -1,3 +1,13 @@
+2013-09-13  Gustavo Noronha Silva  <gustavo.noronha@collabora.com>
+
+        [GTK] Move to the new web inspector
+        https://bugs.webkit.org/show_bug.cgi?id=120647
+
+        Reviewed by Carlos Garcia Campos.
+
+        * platform/gtk/TestExpectations: the new inspector UI does not support the current
+        inspector testing harness so keep it skipped, a new one will eventually be landed.
+
 2013-09-13  Chris Fleizach  <cfleizach@apple.com>
 
         AX: AXPress does not work in SVG
index 8c0e15f..1218d28 100644 (file)
@@ -69,7 +69,7 @@ webkit.org/b/71851 http/tests/security/contentTypeOptions [ Skip ]
 fast/repaint/overflow-scroll-touch-repaint.html [ Skip ]
 
 # These test -apple- and -khtml- prefixed CSS properties, which we don't support.
-inspector/styles/vendor-prefixes.html [ WontFix Pass ]
+inspector/styles/vendor-prefixes.html [ Skip ]
 
 # This port doesn't support detecting slow unload handlers.
 fast/dom/Window/slow-unload-handler.html [ WontFix Timeout Failure ]
@@ -967,46 +967,6 @@ Bug(GTK) fast/overflow/scrollbar-restored-and-then-locked.html [ Failure ]
 webkit.org/b/83174 inspector [ Skip ]
 webkit.org/b/83174 http/tests/inspector [ Skip ]
 
-webkit.org/b/82886 inspector/styles/override-screen-size.html [ Failure ]
-webkit.org/b/88780 inspector/debugger/dom-breakpoints.html [ Timeout Failure ]
-webkit.org/b/88780 inspector/debugger/event-listener-breakpoints.html [ Failure ]
-webkit.org/b/88780 inspector/debugger/step-through-event-listeners.html [ Failure ]
-webkit.org/b/89056 inspector/debugger/xhr-breakpoints.html [ Failure Timeout ]
-webkit.org/b/40300 inspector/debugger/live-edit.html [ Timeout Failure ]
-webkit.org/b/40300 inspector/debugger/live-edit-breakpoints.html [ Failure ]
-webkit.org/b/89652 inspector/debugger/debugger-compile-and-run.html [ Failure ]
-webkit.org/b/85709 inspector/extensions/extensions-eval-content-script.html [ Failure ]
-webkit.org/b/85709 inspector/extensions/extensions-audits-content-script.html [ Failure ]
-
-# These inspector tests fell out of the radar after the transition to NRWT
-# Some time out and some are flaky or present different baselines.
-Bug(GTK) inspector/debugger/scripts-panel.html [ Failure Pass ]
-Bug(GTK) inspector/elements/edit-dom-actions.html [ Failure Timeout Pass ]
-Bug(GTK) inspector/timeline/timeline-paint.html [ Failure ]
-Bug(GTK) inspector/timeline/timeline-decode-resize.html [ Failure ]
-Bug(GTK) http/tests/inspector/resource-har-pages.html [ Failure ]
-Bug(GTK) http/tests/inspector/resource-parameters.html [ Timeout ]
-
-webkit.org/b/56691 http/tests/inspector/network/network-size-chunked.html [ Failure ]
-webkit.org/b/56691 http/tests/inspector/network/network-size-sync.html [ Failure ]
-webkit.org/b/56691 http/tests/inspector/network/network-size.html [ Failure ]
-webkit.org/b/51380 http/tests/inspector/console-websocket-error.html [ Failure Timeout ]
-
-# JSC doesn't support heap profiling
-webkit.org/b/50485 inspector/profiler/heap-snapshot-comparison-dom-groups-change.html [ Failure ]
-webkit.org/b/50485 inspector/profiler/heap-snapshot-inspect-dom-wrapper.html [ Timeout Failure ]
-webkit.org/b/50485 inspector/profiler/heap-snapshot-loader.html [ Failure ]
-webkit.org/b/50485 inspector/profiler/heap-snapshot-reveal-in-dominators-view.html [ Failure ]
-webkit.org/b/50485 inspector/profiler/heap-snapshot-summary-retainers.html [ Failure ]
-webkit.org/b/50485 inspector/profiler/heap-snapshot-summary-show-ranges.html [ Failure ]
-webkit.org/b/50485 inspector/profiler/heap-snapshot-summary-sorting-fields.html [ Failure ]
-webkit.org/b/50485 inspector/profiler/heap-snapshot-summary-sorting-instances.html [ Failure ]
-webkit.org/b/50485 inspector-protocol/heap-profiler [ Skip ]
-
-webkit.org/b/73936 inspector/profiler/canvas2d/canvas-has-uninstrumented-canvases.html [ Failure ]
-webkit.org/b/73936 inspector/profiler/canvas2d/canvas-stack-trace.html [ Failure ]
-webkit.org/b/73936 inspector/profiler/canvas2d/canvas-replay-log-grid.html [ Timeout Failure ]
-
 webkit.org/b/37613 webkit.org/b/20011 printing [ Skip ]
 webkit.org/b/37613 editing/execCommand/print.html [ Skip ]
 
index 81ee350..7b3b703 100644 (file)
@@ -1,3 +1,15 @@
+2013-09-13  Gustavo Noronha Silva  <gustavo.noronha@collabora.com>
+
+        [GTK] Move to the new web inspector
+        https://bugs.webkit.org/show_bug.cgi?id=120647
+
+        Reviewed by Carlos Garcia Campos.
+
+        No tests for the new inspector UI as of yet.
+
+        * GNUmakefile.am: no longer install the deprecated inspector UI files.
+        * WebCore.exp.in: add SchemeRegistry symbol that is now used.
+
 2013-09-13  Darin Adler  <darin@apple.com>
 
         Try to fix Qt build.
index 8612e6a..5c65440 100644 (file)
@@ -702,41 +702,6 @@ EXTRA_DIST += \
        Source/WebCore/xml/XMLViewer.js \
        Source/WebCore/xml/XPathGrammar.y
 
-# Installing web inspector files
-webinspectordir = ${datadir}/webkitgtk-@WEBKITGTK_API_VERSION@/webinspector
-dist_webinspector_DATA = \
-       $(WebCore)/English.lproj/localizedStrings.js \
-       DerivedSources/WebCore/InspectorBackendCommands.js \
-       $(shell ls $(WebCore)/inspector/front-end/*.js) \
-       $(shell ls $(WebCore)/inspector/front-end/*.html) \
-       $(shell ls $(WebCore)/inspector/front-end/*.css)
-
-webinspectoruglifyjsdir = ${datadir}/webkitgtk-@WEBKITGTK_API_VERSION@/webinspector/UglifyJS
-dist_webinspectoruglifyjs_DATA = \
-       $(shell ls $(WebCore)/inspector/front-end/UglifyJS/*.js)
-
-webinspectorimagesdir = ${datadir}/webkitgtk-@WEBKITGTK_API_VERSION@/webinspector/Images
-dist_webinspectorimages_DATA = \
-       $(shell ls $(WebCore)/inspector/front-end/Images/*.gif) \
-       $(shell ls $(WebCore)/inspector/front-end/Images/*.png)
-
-# It seems that $(shell) does not expand when it is a rule dependency, so
-# we must redefine this list of copied files with traditional dependency wildcards.
-noinst_DATA += ${GENSOURCES_INSPECTOR}/inspector.html
-${GENSOURCES_INSPECTOR}/inspector.html: $(WebCore)/inspector/front-end/*.html \
-               $(WebCore)/inspector/front-end/*.js \
-               $(WebCore)/inspector/front-end/UglifyJS/*.js \
-               $(WebCore)/inspector/front-end/*.css \
-               $(WebCore)/inspector/front-end/Images/* \
-               DerivedSources/WebCore/InspectorBackendCommands.js \
-               $(WebCore)/English.lproj/localizedStrings.js
-       $(AM_V_GEN)
-       $(AM_V_at)mkdir -p ${GENSOURCES_INSPECTOR}/UglifyJS
-       $(AM_V_at)mkdir -p ${GENSOURCES_INSPECTOR}/Images
-       $(AM_V_at)cp ${dist_webinspector_DATA} ${GENSOURCES_INSPECTOR}
-       $(AM_V_at)cp ${dist_webinspectoruglifyjs_DATA} ${GENSOURCES_INSPECTOR}/UglifyJS
-       $(AM_V_at)cp ${dist_webinspectorimages_DATA} ${GENSOURCES_INSPECTOR}/Images
-
 webresourcesdir = ${datadir}/webkitgtk-@WEBKITGTK_API_VERSION@/images
 dist_webresources_DATA = \
        $(WebCore)/Resources/textAreaResizeCorner.png \
index 7489033..2a1c368 100644 (file)
@@ -2574,6 +2574,7 @@ __ZN7WebCore19InspectorController13didBeginFrameEv
 __ZN7WebCore19InspectorController14didCancelFrameEv
 __ZNK7WebCore19InspectorController13drawHighlightERNS_15GraphicsContextE
 __ZNK7WebCore9DOMWindow8documentEv
+__ZN7WebCore14SchemeRegistry27shouldTreatURLSchemeAsLocalERKN3WTF6StringE
 #endif
 
 #if ENABLE(INSPECTOR) && PLATFORM(IOS)
index 7615058..5edf71b 100644 (file)
@@ -1,3 +1,12 @@
+2013-09-13  Gustavo Noronha Silva  <gustavo.noronha@collabora.com>
+
+        [GTK] Move to the new web inspector
+        https://bugs.webkit.org/show_bug.cgi?id=120647
+
+        Reviewed by Carlos Garcia Campos.
+
+        * GNUmakefile.am: Added. Generate the GResource source and link it into libWebCore.
+
 2013-09-12  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: Duplicated color swatches changing autocompletes color names
diff --git a/Source/WebInspectorUI/GNUmakefile.am b/Source/WebInspectorUI/GNUmakefile.am
new file mode 100644 (file)
index 0000000..68e621a
--- /dev/null
@@ -0,0 +1,42 @@
+${GENSOURCES_WEBINSPECTOR_UI}/GResourceBundle.xml: GNUmakefile \
+       $(WebInspectorUI)/UserInterface/*.html \
+       $(WebInspectorUI)/UserInterface/*.js \
+       $(WebInspectorUI)/UserInterface/*.css \
+       $(WebInspectorUI)/UserInterface/Images/*.png \
+       $(WebInspectorUI)/UserInterface/Images/*.svg \
+       $(WebInspectorUI)/UserInterface/External/CodeMirror/* \
+       $(WebInspectorUI)/Localizations/en.lproj/localizedStrings.js
+       $(AM_V_GEN)
+       $(AM_V_at)mkdir -p ${GENSOURCES_WEBINSPECTOR_UI}
+       $(AM_V_at)echo '<?xml version="1.0" encoding="UTF-8"?>' > ${GENSOURCES_WEBINSPECTOR_UI}/GResourceBundle.xml
+       $(AM_V_at)echo '<gresources>' >> ${GENSOURCES_WEBINSPECTOR_UI}/GResourceBundle.xml
+       $(AM_V_at)echo '  <gresource prefix="/org/webkitgtk/inspector">' >> ${GENSOURCES_WEBINSPECTOR_UI}/GResourceBundle.xml
+       $(AM_V_at)\
+               for file in $^; do \
+                       if [ "$$file" = "GNUmakefile" ]; then continue; fi; \
+                       file=`echo $$file | sed s,$(WebInspectorUI)/,,g`; \
+                       echo "    <file>$$file</file>" >> ${GENSOURCES_WEBINSPECTOR_UI}/GResourceBundle.xml; \
+               done
+       $(AM_V_at)echo '  </gresource>' >> ${GENSOURCES_WEBINSPECTOR_UI}/GResourceBundle.xml
+       $(AM_V_at)echo '</gresources>' >> ${GENSOURCES_WEBINSPECTOR_UI}/GResourceBundle.xml
+
+${GENSOURCES_WEBINSPECTOR_UI}/GResourceBundle.c: DerivedSources/WebInspectorUI/GResourceBundle.xml
+       $(AM_V_GEN)
+       $(AM_V_at)glib-compile-resources --generate --sourcedir=$(WebInspectorUI) \
+               --target=${GENSOURCES_WEBINSPECTOR_UI}/GResourceBundle.c ${GENSOURCES_WEBINSPECTOR_UI}/GResourceBundle.xml
+
+BUILT_SOURCES += \
+       DerivedSources/WebInspectorUI/GResourceBundle.xml
+
+webcore_built_sources += \
+       DerivedSources/WebInspectorUI/GResourceBundle.c
+
+EXTRA_DIST += \
+       $(WebInspectorUI)/Localizations/en.lproj/localizedStrings.js \
+       $(shell ls $(WebInspectorUI)/UserInterface/*.html) \
+       $(shell ls $(WebInspectorUI)/UserInterface/*.js) \
+       $(shell ls $(WebInspectorUI)/UserInterface/*.css) \
+       $(shell ls $(WebInspectorUI)/UserInterface/Images/*.png) \
+       $(shell ls $(WebInspectorUI)/UserInterface/Images/*.svg) \
+       $(shell ls $(WebInspectorUI)/UserInterface/External/CodeMirror/*)
+
index e8a6268..64875b7 100644 (file)
@@ -1,3 +1,19 @@
+2013-09-13  Gustavo Noronha Silva  <gustavo.noronha@collabora.com>
+
+        [GTK] Move to the new web inspector
+        https://bugs.webkit.org/show_bug.cgi?id=120647
+
+        Reviewed by Carlos Garcia Campos.
+
+        * WebCoreSupport/InspectorClientGtk.cpp:
+        (WebKit::InspectorClient::openInspectorFrontend): update paths to the internal resource ones.
+        (WebKit::InspectorClient::inspectorFilesPath): ditto.
+        * tests/testwebinspector.c:
+        (consoleMessageCallback): the new inspector currently emits an error when loading, so add it to
+        the list of messages which are not considered failures.
+        * webkit/webkitglobals.cpp:
+        (webkitInit): register resource as a local scheme; currently used by the inspector.
+
 2013-09-13  Alberto Garcia  <berto@igalia.com>
 
         download-requested arg should be WEBKIT_TYPE_DOWNLOAD not G_TYPE_OBJECT
index fb60f03..38c9b03 100644 (file)
@@ -104,9 +104,7 @@ InspectorFrontendChannel* InspectorClient::openInspectorFrontend(InspectorContro
 
     webkit_web_inspector_set_web_view(webInspector, inspectorWebView);
  
-    GOwnPtr<gchar> inspectorPath(g_build_filename(inspectorFilesPath(), "inspector.html", NULL));
-    GOwnPtr<gchar> inspectorURI(g_filename_to_uri(inspectorPath.get(), 0, 0));
-    webkit_web_view_load_uri(inspectorWebView, inspectorURI.get());
+    webkit_web_view_load_uri(inspectorWebView, "resource:///org/webkitgtk/inspector/UserInterface/Main.html");
 
     gtk_widget_show(GTK_WIDGET(inspectorWebView));
 
@@ -157,20 +155,6 @@ bool InspectorClient::sendMessageToFrontend(const String& message)
     return doDispatchMessageOnFrontendPage(m_frontendPage, message);
 }
 
-const char* InspectorClient::inspectorFilesPath()
-{
-    if (m_inspectorFilesPath)
-        return m_inspectorFilesPath.get();
-
-    const char* environmentPath = getenv("WEBKIT_INSPECTOR_PATH");
-    if (environmentPath && g_file_test(environmentPath, G_FILE_TEST_IS_DIR))
-        m_inspectorFilesPath.set(g_strdup(environmentPath));
-    else
-        m_inspectorFilesPath.set(g_build_filename(sharedResourcesPath().data(), "webinspector", NULL));
-
-    return m_inspectorFilesPath.get();
-}
-
 InspectorFrontendClient::InspectorFrontendClient(WebKitWebView* inspectedWebView, WebKitWebView* inspectorWebView, WebKitWebInspector* webInspector, Page* inspectorPage, InspectorClient* inspectorClient)
     : InspectorFrontendClientLocal(core(inspectedWebView)->inspectorController(), inspectorPage, adoptPtr(new InspectorFrontendSettingsGtk()))
     , m_inspectorWebView(inspectorWebView)
@@ -220,11 +204,8 @@ void InspectorFrontendClient::destroyInspectorWindow(bool notifyInspectorControl
 
 String InspectorFrontendClient::localizedStringsURL()
 {
-    GOwnPtr<gchar> stringsPath(g_build_filename(m_inspectorClient->inspectorFilesPath(), "localizedStrings.js", NULL));
-    GOwnPtr<gchar> stringsURI(g_filename_to_uri(stringsPath.get(), 0, 0));
-
     // FIXME: support l10n of localizedStrings.js
-    return String::fromUTF8(stringsURI.get());
+    return String("resource:///org/webkitgtk/inspector/Localizations/en.lproj/localizedStrings.js");
 }
 
 void InspectorFrontendClient::bringToFront()
index 8de6904..2c6e3a0 100644 (file)
@@ -39,7 +39,8 @@ static gboolean quitLoop(gpointer data)
  */
 static gboolean consoleMessageCallback(WebKitWebView* webView, const char* message, unsigned int line, const char* sourceId)
 {
-    if (strstr(message, "Localized string") || strstr(message, "Protocol Error: the message is for non-existing domain 'Profiler'"))
+    if (strstr(message, "Localized string") || strstr(message, "Protocol Error: the message is for non-existing domain 'Profiler'") ||
+        strstr(message, "Didn't find a TreeElement for a representedObject"))
         return TRUE;
 
     g_warning("Console: %s @%d: %s\n", sourceId, line, message);
index 15017dc..2cb5be5 100644 (file)
@@ -562,6 +562,8 @@ void webkitInit()
 
     WebCore::ResourceHandle::setIgnoreSSLErrors(true);
 
+    WebCore::SchemeRegistry::registerURLSchemeAsLocal("resource");
+
     atexit(webkitExit);
 }
 
index 5e6753a..3a31907 100644 (file)
@@ -1,3 +1,37 @@
+2013-09-13  Gustavo Noronha Silva  <gustavo.noronha@collabora.com>
+
+        [GTK] Move to the new web inspector
+        https://bugs.webkit.org/show_bug.cgi?id=120647
+
+        Reviewed by Carlos Garcia Campos.
+
+        * GNUmakefile.am: bundle the remote inspector page list HTML into libwebkit2gtk as a GResource.
+        * UIProcess/API/gtk/tests/GNUmakefile.am: no need to set WEBKIT_INSPECTOR_PATH anymore.
+        * UIProcess/API/gtk/tests/InspectorTestServer.cpp:
+        (main): ditto.
+        * UIProcess/API/gtk/tests/TestInspector.cpp:
+        (beforeAll): ditto.
+        * UIProcess/API/gtk/tests/TestInspectorServer.cpp:
+        (testInspectorServerPageList): update paths to the internal resource ones.
+        * UIProcess/InspectorServer/WebInspectorServer.h:
+        * UIProcess/InspectorServer/gtk/WebInspectorServerGtk.cpp:
+        (WebKit::WebInspectorServer::platformResourceForPath): ditto.
+        (WebKit::WebInspectorServer::buildPageList): ditto.
+        * UIProcess/WebInspectorProxy.cpp:
+        (WebKit::isMainInspectorPage): factor out checking for the inspector main resource, to make
+        the code more readable.
+        (WebKit::decidePolicyForNavigationAction): use SchemeRegistry to figure out whether the
+        request is for a local resource instead of KURL::isLocalFile() to allow using schemes
+        other than file:// for the inspector resources.
+        * UIProcess/gtk/WebInspectorProxyGtk.cpp:
+        (WebKit::WebInspectorProxy::inspectorPageURL): use the new internal resource URL; since it's now
+        static we no longer need to generate and store the string.
+        (WebKit::WebInspectorProxy::inspectorBaseURL): ditto.
+        * WebProcess/WebPage/gtk/WebInspectorGtk.cpp:
+        (WebKit::WebInspector::localizedStringsURL): use the new internal resource URL.
+        * UIProcess/gtk/WebContextGtk.cpp:
+        (WebKit::WebContext::platformInitializeWebProcess): register resource as a local scheme.
+
 2013-09-13  Allan Sandfeld Jensen  <allan.jensen@digia.com>
 
         Fix build with namespaced Qt.
index b671c3f..6ba884f 100644 (file)
@@ -19,6 +19,28 @@ libexec_PROGRAMS += \
        Programs/WebKitPluginProcess
 endif
 
+${GENSOURCES_WEBINSPECTOR_UI}/WebKit2GResourceBundle.xml: GNUmakefile \
+       $(WebKit2)/UIProcess/InspectorServer/front-end/inspectorPageIndex.html
+       $(AM_V_GEN)
+       $(AM_V_at)mkdir -p ${GENSOURCES_WEBINSPECTOR_UI}
+       $(AM_V_at)echo '<?xml version="1.0" encoding="UTF-8"?>' > ${GENSOURCES_WEBINSPECTOR_UI}/WebKit2GResourceBundle.xml
+       $(AM_V_at)echo '<gresources>' >> ${GENSOURCES_WEBINSPECTOR_UI}/WebKit2GResourceBundle.xml
+       $(AM_V_at)echo '  <gresource prefix="/org/webkitgtk/inspector/UserInterface">' >> ${GENSOURCES_WEBINSPECTOR_UI}/WebKit2GResourceBundle.xml
+       $(AM_V_at)echo "    <file>inspectorPageIndex.html</file>" >> ${GENSOURCES_WEBINSPECTOR_UI}/WebKit2GResourceBundle.xml
+       $(AM_V_at)echo '  </gresource>' >> ${GENSOURCES_WEBINSPECTOR_UI}/WebKit2GResourceBundle.xml
+       $(AM_V_at)echo '</gresources>' >> ${GENSOURCES_WEBINSPECTOR_UI}/WebKit2GResourceBundle.xml
+
+${GENSOURCES_WEBINSPECTOR_UI}/WebKit2GResourceBundle.c: DerivedSources/WebInspectorUI/WebKit2GResourceBundle.xml
+       $(AM_V_GEN)
+       $(AM_V_at)glib-compile-resources --generate --sourcedir=$(WebKit2)/UIProcess/InspectorServer/front-end \
+               --target=${GENSOURCES_WEBINSPECTOR_UI}/WebKit2GResourceBundle.c ${GENSOURCES_WEBINSPECTOR_UI}/WebKit2GResourceBundle.xml
+
+BUILT_SOURCES += \
+       DerivedSources/WebInspectorUI/WebKit2GResourceBundle.xml
+
+webkit2gtk_built_sources += \
+       DerivedSources/WebInspectorUI/WebKit2GResourceBundle.c
+
 # Platform
 libWebKit2Platform_la_SOURCES = \
        $(webkit2platform_sources)
@@ -722,8 +744,3 @@ EXTRA_DIST += \
        $(shell ls $(WebKit2)/WebProcess/WebPage/*.in) \
        $(shell ls $(WebKit2)/WebProcess/soup/*.in)
 
-# Installing remote inspector files
-remoteinspectordir = ${datadir}/webkitgtk-@WEBKITGTK_API_VERSION@/webinspector
-remoteinspector_DATA = \
-       $(WebKit2)/UIProcess/InspectorServer/front-end/inspectorPageIndex.html
-
index abda0ea..e008ad0 100644 (file)
@@ -258,7 +258,6 @@ Programs_WebKit2APITests_TestCookieManager_LDFLAGS = $(webkit2_tests_ldflags)
 Programs_WebKit2APITests_TestInspector_SOURCES = \
         Source/WebKit2/UIProcess/API/gtk/tests/TestInspector.cpp
 Programs_WebKit2APITests_TestInspector_CPPFLAGS = \
-       -DWEBKIT_INSPECTOR_PATH=\"${shell pwd}/${top_builddir}/resources/inspector\" \
        $(webkit2_tests_cppflags)
 Programs_WebKit2APITests_TestInspector_LDADD = $(webkit2_tests_ldadd)
 Programs_WebKit2APITests_TestInspector_LDFLAGS = $(webkit2_tests_ldflags)
index 7c9dc90..f13b043 100644 (file)
@@ -40,10 +40,6 @@ int main(int argc, char** argv)
 
     // Overwrite WEBKIT_INSPECTOR_SERVER variable with default value.
     g_setenv("WEBKIT_INSPECTOR_SERVER", "127.0.0.1:2999", TRUE);
-    
-    // Overwrite WEBKIT_INSPECTOR_SERVER_PATH variable to point to inspector resources folder.
-    const gchar* inspectorResourcesPath = g_getenv("WEBKIT_INSPECTOR_PATH");
-    g_setenv("WEBKIT_INSPECTOR_SERVER_PATH", inspectorResourcesPath, TRUE);
 
     WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
     webkit_settings_set_enable_developer_extras(webkit_web_view_get_settings(webView), TRUE);
index 219e79d..1f04303 100644 (file)
@@ -346,7 +346,6 @@ static void testInspectorCustomContainerDestroyed(CustomInspectorTest* test, gco
 
 void beforeAll()
 {
-    g_setenv("WEBKIT_INSPECTOR_PATH", WEBKIT_INSPECTOR_PATH, FALSE);
     InspectorTest::add("WebKitWebInspector", "default", testInspectorDefault);
     CustomInspectorTest::add("WebKitWebInspector", "manual-attach-detach", testInspectorManualAttachDetach);
     CustomInspectorTest::add("WebKitWebInspector", "custom-container-destroyed", testInspectorCustomContainerDestroyed);
index 0b2354f..b0468bf 100644 (file)
@@ -155,7 +155,7 @@ public:
 };
 
 // Test to get inspector server page list from the test server.
-// Should contain only one entry pointing to http://127.0.0.1:2999/webinspector/inspector.html?page=1
+// Should contain only one entry pointing to http://127.0.0.1:2999/webinspector/Main.html?page=1
 static void testInspectorServerPageList(InspectorServerTest* test, gconstpointer)
 {
     GOwnPtr<GError> error;
@@ -184,7 +184,7 @@ static void testInspectorServerPageList(InspectorServerTest* test, gconstpointer
     g_assert(javascriptResult);
     g_assert(!error.get());
     valueString.set(WebViewTest::javascriptResultToCString(javascriptResult));
-    String validInspectorURL = String("/inspector.html?page=") + String::number(pageId);
+    String validInspectorURL = String("/Main.html?page=") + String::number(pageId);
     ASSERT_CMP_CSTRING(valueString.get(), ==, validInspectorURL.utf8());
 }
 
index fc8ddf4..c419f11 100644 (file)
@@ -67,10 +67,6 @@ private:
 
     void closeConnection(WebInspectorProxy*, WebSocketServerConnection*);
 
-#if PLATFORM(GTK)
-    String inspectorServerFilesPath();
-    String m_inspectorServerFilesPath;
-#endif
     unsigned m_nextAvailablePageId;
     ClientMap m_clientMap;
     HashMap<unsigned, WebSocketServerConnection*> m_connectionMap;
index b4cd214..ba901df 100644 (file)
@@ -36,6 +36,7 @@
 #include <wtf/gobject/GOwnPtr.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/StringBuilder.h>
+#include <wtf/text/StringConcatenate.h>
 
 namespace WebKit {
 
@@ -48,11 +49,11 @@ bool WebInspectorServer::platformResourceForPath(const String& path, Vector<char
     }
 
     // Point the default path to a formatted page that queries the page list and display them.
-    CString localPath = WebCore::fileSystemRepresentation(inspectorServerFilesPath() + ((path == "/") ? "/inspectorPageIndex.html" : path));
-    if (localPath.isNull())
+    CString resourceURI = makeString("resource:///org/webkitgtk/inspector/UserInterface", ((path == "/") ? "/inspectorPageIndex.html" : path)).utf8();
+    if (resourceURI.isNull())
         return false;
 
-    GRefPtr<GFile> file = adoptGRef(g_file_new_for_path(localPath.data()));
+    GRefPtr<GFile> file = adoptGRef(g_file_new_for_uri(resourceURI.data()));
     GOwnPtr<GError> error;
     GRefPtr<GFileInfo> fileInfo = adoptGRef(g_file_query_info(file.get(), G_FILE_ATTRIBUTE_STANDARD_SIZE "," G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE, G_FILE_QUERY_INFO_NONE, 0, &error.outPtr()));
     if (!fileInfo) {
@@ -61,7 +62,7 @@ bool WebInspectorServer::platformResourceForPath(const String& path, Vector<char
         builder.appendNumber(error->code);
         builder.appendLiteral(", ");
         builder.append(error->message);
-        builder.appendLiteral(" occurred during fetching webinspector resource files.<br>Make sure you ran make install or have set WEBKIT_INSPECTOR_SERVER_PATH in your environment to point to webinspector folder.</body></html>");
+        builder.appendLiteral(" occurred during fetching inspector resource files.</body></html>");
         CString cstr = builder.toString().utf8();
         data.append(cstr.data(), cstr.length());
         contentType = "text/html; charset=utf-8";
@@ -97,7 +98,7 @@ void WebInspectorServer::buildPageList(Vector<char>& data, String& contentType)
         builder.appendLiteral("\", \"url\": \"");
         builder.append(webPage->activeURL());
         builder.appendLiteral("\", \"inspectorUrl\": \"");
-        builder.appendLiteral("/inspector.html?page=");
+        builder.appendLiteral("/Main.html?page=");
         builder.appendNumber(it->key);
         builder.appendLiteral("\" }");
     }
@@ -107,19 +108,5 @@ void WebInspectorServer::buildPageList(Vector<char>& data, String& contentType)
     contentType = "application/json; charset=utf-8";
 }
 
-String WebInspectorServer::inspectorServerFilesPath()
-{
-    if (!m_inspectorServerFilesPath.isNull())
-        return m_inspectorServerFilesPath;
-
-    const char* environmentPath = g_getenv("WEBKIT_INSPECTOR_SERVER_PATH");
-    if (environmentPath && g_file_test(environmentPath, G_FILE_TEST_IS_DIR))
-        m_inspectorServerFilesPath = String(environmentPath);
-    else
-        m_inspectorServerFilesPath = String(WebCore::sharedResourcesPath().data()) + "/webinspector";
-
-    return m_inspectorServerFilesPath;
-}
-
 }
 #endif
index 18e2aee..f2b8135 100644 (file)
@@ -39,6 +39,7 @@
 #include "WebPreferences.h"
 #include "WebProcessProxy.h"
 #include "WebURLRequest.h"
+#include <WebCore/SchemeRegistry.h>
 
 #if ENABLE(INSPECTOR_SERVER)
 #include "WebInspectorServer.h"
@@ -313,6 +314,17 @@ bool WebInspectorProxy::isInspectorPage(WebPageProxy* page)
     return page->pageGroup() == inspectorPageGroup();
 }
 
+static bool isMainInspectorPage(const WebInspectorProxy* webInspectorProxy, WKURLRequestRef requestRef)
+{
+    // Use KURL so we can compare just the paths.
+    KURL inspectorURL(KURL(), webInspectorProxy->inspectorPageURL());
+    KURL requestURL(KURL(), toImpl(requestRef)->url());
+
+    ASSERT(WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal(inspectorURL.protocol()));
+
+    return WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal(requestURL.protocol()) && decodeURLEscapeSequences(requestURL.path()) == decodeURLEscapeSequences(inspectorURL.path());
+}
+
 static void decidePolicyForNavigationAction(WKPageRef, WKFrameRef frameRef, WKFrameNavigationType, WKEventModifiers, WKEventMouseButton, WKURLRequestRef requestRef, WKFramePolicyListenerRef listenerRef, WKTypeRef, const void* clientInfo)
 {
     // Allow non-main frames to navigate anywhere.
@@ -324,14 +336,8 @@ static void decidePolicyForNavigationAction(WKPageRef, WKFrameRef frameRef, WKFr
     const WebInspectorProxy* webInspectorProxy = static_cast<const WebInspectorProxy*>(clientInfo);
     ASSERT(webInspectorProxy);
 
-    // Use KURL so we can compare just the fileSystemPaths.
-    KURL inspectorURL(KURL(), webInspectorProxy->inspectorPageURL());
-    KURL requestURL(KURL(), toImpl(requestRef)->url());
-
-    ASSERT(inspectorURL.isLocalFile());
-
     // Allow loading of the main inspector file.
-    if (requestURL.isLocalFile() && requestURL.fileSystemPath() == inspectorURL.fileSystemPath()) {
+    if (isMainInspectorPage(webInspectorProxy, requestRef)) {
         toImpl(listenerRef)->use();
         return;
     }
index 22ba2f1..530aa1c 100644 (file)
@@ -36,6 +36,7 @@
 #include "WebSoupRequestManagerProxy.h"
 #include <WebCore/FileSystem.h>
 #include <WebCore/NotImplemented.h>
+#include <WebCore/SchemeRegistry.h>
 #include <wtf/gobject/GOwnPtr.h>
 #include <wtf/text/CString.h>
 
@@ -88,6 +89,11 @@ void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& para
 {
     initInspectorServer();
 
+    if (!parameters.urlSchemesRegisteredAsLocal.contains("resource")) {
+        WebCore::SchemeRegistry::registerURLSchemeAsLocal("resource");
+        parameters.urlSchemesRegisteredAsLocal.append("resource");
+    }
+
     parameters.urlSchemesRegistered = supplement<WebSoupRequestManagerProxy>()->registeredURISchemes();
     supplement<WebCookieManagerProxy>()->getCookiePersistentStorage(parameters.cookiePersistentStoragePath, parameters.cookiePersistentStorageType);
     parameters.cookieAcceptPolicy = m_initialHTTPCookieAcceptPolicy;
index a93275d..21fc947 100644 (file)
 
 namespace WebKit {
 
-static const char* inspectorFilesBasePath()
-{
-    const gchar* environmentPath = g_getenv("WEBKIT_INSPECTOR_PATH");
-    if (environmentPath && g_file_test(environmentPath, G_FILE_TEST_IS_DIR))
-        return environmentPath;
-
-    static const char* inspectorFilesPath = DATA_DIR G_DIR_SEPARATOR_S "webkitgtk-" WEBKITGTK_API_VERSION_STRING
-        G_DIR_SEPARATOR_S "webinspector" G_DIR_SEPARATOR_S;
-    return inspectorFilesPath;
-}
-
 static void inspectorViewDestroyed(GtkWidget*, gpointer userData)
 {
     WebInspectorProxy* inspectorProxy = static_cast<WebInspectorProxy*>(userData);
@@ -160,15 +149,12 @@ void WebInspectorProxy::platformInspectedURLChanged(const String& url)
 
 String WebInspectorProxy::inspectorPageURL() const
 {
-    GOwnPtr<gchar> filePath(g_build_filename(inspectorFilesBasePath(), "inspector.html", NULL));
-    GOwnPtr<gchar> fileURI(g_filename_to_uri(filePath.get(), 0, 0));
-    return WebCore::filenameToString(fileURI.get());
+    return String("resource:///org/webkitgtk/inspector/UserInterface/Main.html");
 }
 
 String WebInspectorProxy::inspectorBaseURL() const
 {
-    GOwnPtr<gchar> fileURI(g_filename_to_uri(inspectorFilesBasePath(), 0, 0));
-    return WebCore::filenameToString(fileURI.get());
+    return String("resource:///org/webkitgtk/inspector/UserInterface/");
 }
 
 unsigned WebInspectorProxy::platformInspectedWindowHeight()
index 12a4639..e77e4be 100644 (file)
@@ -43,15 +43,7 @@ bool WebInspector::canSave() const
 
 String WebInspector::localizedStringsURL() const
 {
-    GOwnPtr<gchar> filePath;
-    const gchar* environmentPath = g_getenv("WEBKIT_INSPECTOR_PATH");
-    if (environmentPath && g_file_test(environmentPath, G_FILE_TEST_IS_DIR))
-        filePath.set(g_build_filename(environmentPath, "localizedStrings.js", NULL));
-    else
-        filePath.set(g_build_filename(WebCore::sharedResourcesPath().data(), "webinspector", "localizedStrings.js", NULL));
-
-    GOwnPtr<gchar> fileURI(g_filename_to_uri(filePath.get(), 0, 0));
-    return WebCore::filenameToString(fileURI.get());
+    return String("resource:///org/webkitgtk/inspector/Localizations/en.lproj/localizedStrings.js");
 }
 
 } // namespace WebKit
index fb6e3fe..451ac00 100644 (file)
@@ -1,3 +1,20 @@
+2013-09-13  Gustavo Noronha Silva  <gustavo.noronha@collabora.com>
+
+        [GTK] Move to the new web inspector
+        https://bugs.webkit.org/show_bug.cgi?id=120647
+
+        Reviewed by Carlos Garcia Campos.
+
+        * GtkLauncher/main.c:
+        (main): no longer set WEBKIT_INSPECTOR_PATH.
+        * MiniBrowser/gtk/main.c:
+        (main): ditto.
+        * Scripts/old-run-webkit-tests:
+        (openDumpTool): ditto.
+        * Scripts/run-gtk-tests: ditto.
+        * Scripts/webkitpy/port/gtk.py:
+        (GtkPort.setup_environ_for_server): ditto.
+
 2013-09-13  Allan Sandfeld Jensen  <allan.jensen@digia.com>
 
         [Qt] REGRESSION(r154444): xss-DENIED test results changed
index cef7cd3..cbbfed1 100644 (file)
@@ -534,10 +534,6 @@ int main(int argc, char* argv[])
     }
 #endif
 
-#ifdef WEBKIT_EXEC_PATH
-    g_setenv("WEBKIT_INSPECTOR_PATH", WEBKIT_EXEC_PATH "resources/inspector", FALSE);
-#endif /* WEBKIT_EXEC_PATH */
-
     WebKitWebView *webView;
     GtkWidget *main_window = createWindow(&webView);
 
index 51ffb90..5049cf2 100644 (file)
@@ -263,9 +263,6 @@ int main(int argc, char *argv[])
     }
     g_option_context_free (context);
 
-#ifdef WEBKIT_EXEC_PATH
-    g_setenv("WEBKIT_INSPECTOR_PATH", WEBKIT_EXEC_PATH "resources/inspector", FALSE);
-#endif /* WEBKIT_EXEC_PATH */
     g_setenv("WEBKIT_INJECTED_BUNDLE_PATH", WEBKIT_INJECTED_BUNDLE_PATH, FALSE);
 
     // Enable the favicon database, by specifying the default directory.
index ed201ac..5605414 100755 (executable)
@@ -1505,7 +1505,6 @@ sub openDumpTool()
     if (isGtk()) {
         $CLEAN_ENV{LIBOVERLAY_SCROLLBAR} = "0";
         $CLEAN_ENV{GTK_MODULES} = "gail";
-        $CLEAN_ENV{WEBKIT_INSPECTOR_PATH} = "$productDir/resources/inspector";
 
         if ($useWebKitTestRunner) {
             my $injectedBundlePath = productDir() . "/Libraries/.libs/libTestRunnerInjectedBundle";
index aa8432f..fdf0d8a 100755 (executable)
@@ -188,7 +188,6 @@ class TestRunner:
 
     def _setup_testing_environment(self):
         self._test_env = os.environ
-        self._test_env["WEBKIT_INSPECTOR_PATH"] = os.path.abspath(os.path.join(self._programs_path, 'resources', 'inspector'))
         self._test_env['GSETTINGS_BACKEND'] = 'memory'
         self._test_env["TEST_WEBKIT_API_WEBKIT2_RESOURCES_PATH"] = common.top_level_path("Tools", "TestWebKitAPI", "Tests", "WebKit2")
         self._test_env["TEST_WEBKIT_API_WEBKIT2_INJECTED_BUNDLE_PATH"] = common.build_path_for_build_types((self._build_type,), "Libraries")
index b497808..fefe3b4 100644 (file)
@@ -91,7 +91,6 @@ class GtkPort(Port):
         environment['LIBOVERLAY_SCROLLBAR'] = '0'
         environment['TEST_RUNNER_INJECTED_BUNDLE_FILENAME'] = self._build_path('Libraries', 'libTestRunnerInjectedBundle.la')
         environment['TEST_RUNNER_TEST_PLUGIN_PATH'] = self._build_path('TestNetscapePlugin', '.libs')
-        environment['WEBKIT_INSPECTOR_PATH'] = self._build_path('Programs', 'resources', 'inspector')
         environment['AUDIO_RESOURCES_PATH'] = self.path_from_webkit_base('Source', 'WebCore', 'platform', 'audio', 'resources')
         self._copy_value_from_environ_if_set(environment, 'WEBKIT_OUTPUTDIR')
         if self.get_option("leaks"):