Diff
Modified: trunk/Source/WebCore/ChangeLog (107459 => 107460)
--- trunk/Source/WebCore/ChangeLog 2012-02-11 00:42:38 UTC (rev 107459)
+++ trunk/Source/WebCore/ChangeLog 2012-02-11 00:55:05 UTC (rev 107460)
@@ -1,3 +1,25 @@
+2012-02-10 Brian Weinstein <bweinst...@apple.com>
+
+ Web Inspector: Add the ability to jump to the source for a given frame
+ https://bugs.webkit.org/show_bug.cgi?id=78396
+
+ Reviewed by Tim Hatcher.
+
+ * WebCore.exp.in: Add a new exported function.
+ * inspector/InspectorController.cpp: Add and expose the InspectorPageAgent.
+ (WebCore::InspectorController::InspectorController): Set m_pageAgent.
+ * inspector/InspectorController.h: Add m_pageAgent.
+ (WebCore::InspectorController::pageAgent): Return m_pageAgent.
+
+ * inspector/InspectorFrontendClientLocal.cpp:
+ (WebCore::InspectorFrontendClientLocal::showMainResourceForFrame): Get the inspector's frame ID
+ of the frame that was passed in, and add a call to evaluate on load.
+ * inspector/InspectorFrontendClientLocal.h:
+
+ * inspector/front-end/InspectorFrontendAPI.js:
+ (InspectorFrontendAPI.showMainResourceForFrame): Add a FIXME to show the source code for the main
+ resource of the given frame.
+
2012-02-10 Vineet Chaudhary <rgf...@motorola.com>
https://bugs.webkit.org/show_bug.cgi?id=72756
Modified: trunk/Source/WebCore/WebCore.exp.in (107459 => 107460)
--- trunk/Source/WebCore/WebCore.exp.in 2012-02-11 00:42:38 UTC (rev 107459)
+++ trunk/Source/WebCore/WebCore.exp.in 2012-02-11 00:55:05 UTC (rev 107460)
@@ -1718,6 +1718,7 @@
__ZN7WebCore28InspectorFrontendClientLocal20sendMessageToBackendERKN3WTF6StringE
__ZN7WebCore28InspectorFrontendClientLocal21isProfilingJavaScriptEv
__ZN7WebCore28InspectorFrontendClientLocal23stopProfilingJavaScriptEv
+__ZN7WebCore28InspectorFrontendClientLocal24showMainResourceForFrameEPNS_5FrameE
__ZN7WebCore28InspectorFrontendClientLocal24startProfilingJavaScriptEv
__ZN7WebCore28InspectorFrontendClientLocal26changeAttachedWindowHeightEj
__ZN7WebCore28InspectorFrontendClientLocal26isTimelineProfilingEnabledEv
Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (107459 => 107460)
--- trunk/Source/WebCore/inspector/InspectorController.cpp 2012-02-11 00:42:38 UTC (rev 107459)
+++ trunk/Source/WebCore/inspector/InspectorController.cpp 2012-02-11 00:55:05 UTC (rev 107460)
@@ -85,6 +85,7 @@
OwnPtr<InspectorPageAgent> pageAgentPtr(InspectorPageAgent::create(m_instrumentingAgents.get(), page, m_state.get(), m_injectedScriptManager.get()));
InspectorPageAgent* pageAgent = pageAgentPtr.get();
+ m_pageAgent = pageAgentPtr.get();
m_agents.append(pageAgentPtr.release());
OwnPtr<InspectorDOMAgent> domAgentPtr(InspectorDOMAgent::create(m_instrumentingAgents.get(), pageAgent, inspectorClient, m_state.get(), m_injectedScriptManager.get()));
Modified: trunk/Source/WebCore/inspector/InspectorController.h (107459 => 107460)
--- trunk/Source/WebCore/inspector/InspectorController.h 2012-02-11 00:42:38 UTC (rev 107459)
+++ trunk/Source/WebCore/inspector/InspectorController.h 2012-02-11 00:55:05 UTC (rev 107460)
@@ -51,6 +51,7 @@
class InspectorDebuggerAgent;
class InspectorFrontend;
class InspectorFrontendClient;
+class InspectorPageAgent;
class InspectorProfilerAgent;
class InspectorResourceAgent;
class InspectorState;
@@ -108,6 +109,8 @@
void setResourcesDataSizeLimitsFromInternals(int maximumResourcesContentSize, int maximumSingleResourceContentSize);
+ InspectorPageAgent* pageAgent() const { return m_pageAgent; }
+
private:
InspectorController(Page*, InspectorClient*);
@@ -121,6 +124,7 @@
InspectorAgent* m_inspectorAgent;
InspectorDOMAgent* m_domAgent;
InspectorResourceAgent* m_resourceAgent;
+ InspectorPageAgent* m_pageAgent;
#if ENABLE(_javascript__DEBUGGER)
InspectorDebuggerAgent* m_debuggerAgent;
InspectorProfilerAgent* m_profilerAgent;
Modified: trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp (107459 => 107460)
--- trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp 2012-02-11 00:42:38 UTC (rev 107459)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp 2012-02-11 00:55:05 UTC (rev 107460)
@@ -42,6 +42,7 @@
#include "InspectorBackendDispatcher.h"
#include "InspectorController.h"
#include "InspectorFrontendHost.h"
+#include "InspectorPageAgent.h"
#include "Page.h"
#include "PlatformString.h"
#include "ScriptFunctionCall.h"
@@ -265,6 +266,12 @@
evaluateOnLoad("[\"showConsole\"]");
}
+void InspectorFrontendClientLocal::showMainResourceForFrame(Frame* frame)
+{
+ String frameId = m_inspectorController->pageAgent()->frameId(frame);
+ evaluateOnLoad(String::format("[\"showMainResourceForFrame\", \"%s\"]", frameId.ascii().data()));
+}
+
unsigned InspectorFrontendClientLocal::constrainedAttachedWindowHeight(unsigned preferredHeight, unsigned totalWindowHeight)
{
using namespace std;
Modified: trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h (107459 => 107460)
--- trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h 2012-02-11 00:42:38 UTC (rev 107459)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h 2012-02-11 00:55:05 UTC (rev 107460)
@@ -93,6 +93,8 @@
void showConsole();
+ void showMainResourceForFrame(Frame*);
+
protected:
virtual void setAttachedWindowHeight(unsigned) = 0;
void setAttachedWindow(bool);
Modified: trunk/Source/WebCore/inspector/front-end/InspectorFrontendAPI.js (107459 => 107460)
--- trunk/Source/WebCore/inspector/front-end/InspectorFrontendAPI.js 2012-02-11 00:42:38 UTC (rev 107459)
+++ trunk/Source/WebCore/inspector/front-end/InspectorFrontendAPI.js 2012-02-11 00:55:05 UTC (rev 107460)
@@ -85,6 +85,11 @@
WebInspector.inspectorView.setCurrentPanel(WebInspector.panels.console);
},
+ showMainResourceForFrame: function(frameId)
+ {
+ // FIXME: Implement this to show the source code for the main resource of a given frame.
+ },
+
dispatch: function(signature)
{
if (WebInspector.panels) {
Modified: trunk/Source/WebKit2/ChangeLog (107459 => 107460)
--- trunk/Source/WebKit2/ChangeLog 2012-02-11 00:42:38 UTC (rev 107459)
+++ trunk/Source/WebKit2/ChangeLog 2012-02-11 00:55:05 UTC (rev 107460)
@@ -1,3 +1,29 @@
+2012-02-10 Brian Weinstein <bweinst...@apple.com>
+
+ Web Inspector: Add the ability to jump to the source for a given frame
+ https://bugs.webkit.org/show_bug.cgi?id=78396
+
+ Add WebKit2 API for the ability to show the source of a frame in the web inspector. This calls down
+ from the WK API all the way to InspectorFrontendClientLocal::showMainResourceForFrame.
+
+ Reviewed by Tim Hatcher.
+
+ * UIProcess/API/C/WKInspector.cpp:
+ (WKInspectorShowMainResourceForFrame): Call WebInspectorProxy::showMainResourceForFrame.
+ * UIProcess/API/C/WKInspector.h:
+
+ * UIProcess/WebInspectorProxy.cpp:
+ (WebKit::WebInspectorProxy::showMainResourceForFrame): Send a message to the web process, passing
+ the frame ID of the frame we want to show the main resource of.
+ * UIProcess/WebInspectorProxy.h:
+
+ * WebProcess/WebPage/WebInspector.cpp:
+ (WebKit::WebInspector::showMainResourceForFrame): Get the WebFrame for the frame we want to show the
+ main resource of from its ID. If we found a frame, call InspectorFrontendClientLocal::showMainResourceForFrame.
+ * WebProcess/WebPage/WebInspector.h:
+
+ * WebProcess/WebPage/WebInspector.messages.in: Add a new message.
+
2012-02-10 Adam Klein <ad...@chromium.org>
Enable MUTATION_OBSERVERS by default on all platforms
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKInspector.cpp (107459 => 107460)
--- trunk/Source/WebKit2/UIProcess/API/C/WKInspector.cpp 2012-02-11 00:42:38 UTC (rev 107459)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKInspector.cpp 2012-02-11 00:55:05 UTC (rev 107460)
@@ -63,6 +63,11 @@
toImpl(inspectorRef)->showConsole();
}
+void WKInspectorShowMainResourceForFrame(WKInspectorRef inspectorRef, WKFrameRef frameRef)
+{
+ toImpl(inspectorRef)->showMainResourceForFrame(toImpl(frameRef));
+}
+
bool WKInspectorIsAttached(WKInspectorRef inspectorRef)
{
return toImpl(inspectorRef)->isAttached();
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKInspector.h (107459 => 107460)
--- trunk/Source/WebKit2/UIProcess/API/C/WKInspector.h 2012-02-11 00:42:38 UTC (rev 107459)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKInspector.h 2012-02-11 00:55:05 UTC (rev 107460)
@@ -47,6 +47,7 @@
WK_EXPORT void WKInspectorClose(WKInspectorRef inspector);
WK_EXPORT void WKInspectorShowConsole(WKInspectorRef inspector);
+WK_EXPORT void WKInspectorShowMainResourceForFrame(WKInspectorRef inspector, WKFrameRef frame);
WK_EXPORT bool WKInspectorIsAttached(WKInspectorRef inspector);
WK_EXPORT void WKInspectorAttach(WKInspectorRef inspector);
Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp (107459 => 107460)
--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp 2012-02-11 00:42:38 UTC (rev 107459)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp 2012-02-11 00:55:05 UTC (rev 107460)
@@ -29,6 +29,7 @@
#if ENABLE(INSPECTOR)
+#include "WebFrameProxy.h"
#include "WebInspectorMessages.h"
#include "WebPageCreationParameters.h"
#include "WebPageGroup.h"
@@ -123,6 +124,14 @@
m_page->process()->send(Messages::WebInspector::ShowConsole(), m_page->pageID());
}
+void WebInspectorProxy::showMainResourceForFrame(WebFrameProxy* frame)
+{
+ if (!m_page)
+ return;
+
+ m_page->process()->send(Messages::WebInspector::ShowMainResourceForFrame(frame->frameID()), m_page->pageID());
+}
+
void WebInspectorProxy::attach()
{
if (!canAttach())
Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h (107459 => 107460)
--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h 2012-02-11 00:42:38 UTC (rev 107459)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h 2012-02-11 00:55:05 UTC (rev 107460)
@@ -50,6 +50,7 @@
namespace WebKit {
+class WebFrameProxy;
class WebPageGroup;
class WebPageProxy;
struct WebPageCreationParameters;
@@ -91,6 +92,7 @@
#endif
void showConsole();
+ void showMainResourceForFrame(WebFrameProxy*);
bool isAttached() const { return m_isAttached; }
void attach();
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp (107459 => 107460)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp 2012-02-11 00:42:38 UTC (rev 107459)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp 2012-02-11 00:55:05 UTC (rev 107460)
@@ -28,6 +28,7 @@
#if ENABLE(INSPECTOR)
+#include "WebFrame.h"
#include "WebInspectorFrontendClient.h"
#include "WebInspectorProxyMessages.h"
#include "WebPage.h"
@@ -139,6 +140,17 @@
m_frontendClient->showConsole();
}
+void WebInspector::showMainResourceForFrame(uint64_t frameID)
+{
+ WebFrame* frame = WebProcess::shared().webFrame(frameID);
+ if (!frame)
+ return;
+
+ m_page->corePage()->inspectorController()->show();
+ if (m_frontendClient)
+ m_frontendClient->showMainResourceForFrame(frame->coreFrame());
+}
+
void WebInspector::startJavaScriptDebugging()
{
#if ENABLE(_javascript__DEBUGGER)
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h (107459 => 107460)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h 2012-02-11 00:42:38 UTC (rev 107459)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h 2012-02-11 00:55:05 UTC (rev 107460)
@@ -92,6 +92,8 @@
void showConsole();
+ void showMainResourceForFrame(uint64_t frameID);
+
void startJavaScriptDebugging();
void stopJavaScriptDebugging();
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.messages.in (107459 => 107460)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.messages.in 2012-02-11 00:42:38 UTC (rev 107459)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.messages.in 2012-02-11 00:55:05 UTC (rev 107460)
@@ -26,6 +26,7 @@
Show()
Close()
ShowConsole()
+ ShowMainResourceForFrame(uint64_t frameID)
StartJavaScriptDebugging()
StopJavaScriptDebugging()
StartJavaScriptProfiling()