Title: [158935] trunk/Source/WebCore
Revision
158935
Author
[email protected]
Date
2013-11-08 11:45:41 -0800 (Fri, 08 Nov 2013)

Log Message

InspectorConsoleAgent::didFinishXHRLoading ConsoleMessage should include a column number
https://bugs.webkit.org/show_bug.cgi?id=114316

Patch by László Langó <[email protected]> on 2013-11-08
Reviewed by Timothy Hatcher.

InspectorConsoleAgent::didFinishXHRLoading creates a ConsoleMessage with a line number,
but it should also include a column number. It looks like ultimately the line number comes from
JSXMLHttpRequest::send, it should also be possible to get the column number at the time.
The column number would be needed by the Web Inspector to jump to the proper place in source code
to show where the XHR originated from.

* bindings/js/JSXMLHttpRequestCustom.cpp:
(WebCore::SendFunctor::SendFunctor):
(WebCore::SendFunctor::column):
(WebCore::SendFunctor::operator()):
(WebCore::JSXMLHttpRequest::send):
* inspector/InspectorConsoleAgent.cpp:
(WebCore::InspectorConsoleAgent::didFinishXHRLoading):
* inspector/InspectorConsoleAgent.h:
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didFinishXHRLoadingImpl):
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::didFinishXHRLoading):
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::XMLHttpRequest):
(WebCore::XMLHttpRequest::setLastSendLineAndColumnNumber):
(WebCore::XMLHttpRequest::didFinishLoading):
* xml/XMLHttpRequest.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (158934 => 158935)


--- trunk/Source/WebCore/ChangeLog	2013-11-08 19:38:58 UTC (rev 158934)
+++ trunk/Source/WebCore/ChangeLog	2013-11-08 19:45:41 UTC (rev 158935)
@@ -1,3 +1,34 @@
+2013-11-08  László Langó  <[email protected]>
+
+        InspectorConsoleAgent::didFinishXHRLoading ConsoleMessage should include a column number
+        https://bugs.webkit.org/show_bug.cgi?id=114316
+
+        Reviewed by Timothy Hatcher.
+
+        InspectorConsoleAgent::didFinishXHRLoading creates a ConsoleMessage with a line number, 
+        but it should also include a column number. It looks like ultimately the line number comes from
+        JSXMLHttpRequest::send, it should also be possible to get the column number at the time.
+        The column number would be needed by the Web Inspector to jump to the proper place in source code 
+        to show where the XHR originated from.
+
+        * bindings/js/JSXMLHttpRequestCustom.cpp:
+        (WebCore::SendFunctor::SendFunctor):
+        (WebCore::SendFunctor::column):
+        (WebCore::SendFunctor::operator()):
+        (WebCore::JSXMLHttpRequest::send):
+        * inspector/InspectorConsoleAgent.cpp:
+        (WebCore::InspectorConsoleAgent::didFinishXHRLoading):
+        * inspector/InspectorConsoleAgent.h:
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore::InspectorInstrumentation::didFinishXHRLoadingImpl):
+        * inspector/InspectorInstrumentation.h:
+        (WebCore::InspectorInstrumentation::didFinishXHRLoading):
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::XMLHttpRequest):
+        (WebCore::XMLHttpRequest::setLastSendLineAndColumnNumber):
+        (WebCore::XMLHttpRequest::didFinishLoading):
+        * xml/XMLHttpRequest.h:
+
 2013-11-08  Simon Fraser  <[email protected]>
 
         Left sidebar on cubic-bezier.com flickers

Modified: trunk/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp (158934 => 158935)


--- trunk/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp	2013-11-08 19:38:58 UTC (rev 158934)
+++ trunk/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp	2013-11-08 19:45:41 UTC (rev 158935)
@@ -116,10 +116,12 @@
     SendFunctor()
         : m_hasSkippedFirstFrame(false)
         , m_line(0)
+        , m_column(0)
     {
     }
 
     unsigned line() const { return m_line; }
+    unsigned column() const { return m_column; }
     String url() const { return m_url; }
 
     StackVisitor::Status operator()(StackVisitor& visitor)
@@ -130,9 +132,10 @@
         }
 
         unsigned line = 0;
-        unsigned unusedColumn = 0;
-        visitor->computeLineAndColumn(line, unusedColumn);
+        unsigned column = 0;
+        visitor->computeLineAndColumn(line, column);
         m_line = line;
+        m_column = column;
         m_url = visitor->sourceURL();
         return StackVisitor::Done;
     }
@@ -140,6 +143,7 @@
 private:
     bool m_hasSkippedFirstFrame;
     unsigned m_line;
+    unsigned m_column;
     String m_url;
 };
 
@@ -167,7 +171,7 @@
 
     SendFunctor functor;
     exec->iterate(functor);
-    impl().setLastSendLineNumber(functor.line());
+    impl().setLastSendLineAndColumnNumber(functor.line(), functor.column());
     impl().setLastSendURL(functor.url());
     setDOMException(exec, ec);
     return jsUndefined();

Modified: trunk/Source/WebCore/inspector/InspectorConsoleAgent.cpp (158934 => 158935)


--- trunk/Source/WebCore/inspector/InspectorConsoleAgent.cpp	2013-11-08 19:38:58 UTC (rev 158934)
+++ trunk/Source/WebCore/inspector/InspectorConsoleAgent.cpp	2013-11-08 19:45:41 UTC (rev 158935)
@@ -245,14 +245,13 @@
     m_injectedScriptManager->discardInjectedScriptsFor(window);
 }
 
-void InspectorConsoleAgent::didFinishXHRLoading(unsigned long requestIdentifier, const String& url, const String& sendURL, unsigned sendLineNumber)
+void InspectorConsoleAgent::didFinishXHRLoading(unsigned long requestIdentifier, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber)
 {
     if (!developerExtrasEnabled())
         return;
     if (m_frontend && m_monitoringXHREnabled) {
         String message = "XHR finished loading: \"" + url + "\".";
-        // FIXME: <http://webkit.org/b/114316> InspectorConsoleAgent::didFinishXHRLoading ConsoleMessage should include a column number
-        addMessageToConsole(NetworkMessageSource, LogMessageType, DebugMessageLevel, message, sendURL, sendLineNumber, 0, 0, requestIdentifier);
+        addMessageToConsole(NetworkMessageSource, LogMessageType, DebugMessageLevel, message, sendURL, sendLineNumber, sendColumnNumber, 0, requestIdentifier);
     }
 }
 

Modified: trunk/Source/WebCore/inspector/InspectorConsoleAgent.h (158934 => 158935)


--- trunk/Source/WebCore/inspector/InspectorConsoleAgent.h	2013-11-08 19:38:58 UTC (rev 158934)
+++ trunk/Source/WebCore/inspector/InspectorConsoleAgent.h	2013-11-08 19:45:41 UTC (rev 158935)
@@ -82,7 +82,7 @@
 
     void frameWindowDiscarded(DOMWindow*);
 
-    void didFinishXHRLoading(unsigned long requestIdentifier, const String& url, const String& sendURL, unsigned sendLineNumber);
+    void didFinishXHRLoading(unsigned long requestIdentifier, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber);
     void didReceiveResponse(unsigned long requestIdentifier, const ResourceResponse&);
     void didFailLoading(unsigned long requestIdentifier, const ResourceError&);
 #if ENABLE(_javascript__DEBUGGER)

Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (158934 => 158935)


--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp	2013-11-08 19:38:58 UTC (rev 158934)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp	2013-11-08 19:45:41 UTC (rev 158935)
@@ -806,10 +806,10 @@
         resourceAgent->didFailXHRLoading(client);
 }
 
-void InspectorInstrumentation::didFinishXHRLoadingImpl(InstrumentingAgents* instrumentingAgents, ThreadableLoaderClient* client, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber)
+void InspectorInstrumentation::didFinishXHRLoadingImpl(InstrumentingAgents* instrumentingAgents, ThreadableLoaderClient* client, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber)
 {
     if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent())
-        consoleAgent->didFinishXHRLoading(identifier, url, sendURL, sendLineNumber);
+        consoleAgent->didFinishXHRLoading(identifier, url, sendURL, sendLineNumber, sendColumnNumber);
     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
         resourceAgent->didFinishXHRLoading(client, identifier, sourceString);
 }

Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (158934 => 158935)


--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h	2013-11-08 19:38:58 UTC (rev 158934)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h	2013-11-08 19:45:41 UTC (rev 158935)
@@ -205,7 +205,7 @@
     static void documentThreadableLoaderStartedLoadingForClient(ScriptExecutionContext*, unsigned long identifier, ThreadableLoaderClient*);
     static void willLoadXHR(ScriptExecutionContext*, ThreadableLoaderClient*, const String&, const URL&, bool, PassRefPtr<FormData>, const HTTPHeaderMap&, bool);
     static void didFailXHRLoading(ScriptExecutionContext*, ThreadableLoaderClient*);
-    static void didFinishXHRLoading(ScriptExecutionContext*, ThreadableLoaderClient*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
+    static void didFinishXHRLoading(ScriptExecutionContext*, ThreadableLoaderClient*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber);
     static void didReceiveXHRResponse(ScriptExecutionContext*, unsigned long identifier);
     static void willLoadXHRSynchronously(ScriptExecutionContext*);
     static void didLoadXHRSynchronously(ScriptExecutionContext*);
@@ -411,7 +411,7 @@
     static void documentThreadableLoaderStartedLoadingForClientImpl(InstrumentingAgents*, unsigned long identifier, ThreadableLoaderClient*);
     static void willLoadXHRImpl(InstrumentingAgents*, ThreadableLoaderClient*, const String&, const URL&, bool, PassRefPtr<FormData>, const HTTPHeaderMap&, bool);
     static void didFailXHRLoadingImpl(InstrumentingAgents*, ThreadableLoaderClient*);
-    static void didFinishXHRLoadingImpl(InstrumentingAgents*, ThreadableLoaderClient*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
+    static void didFinishXHRLoadingImpl(InstrumentingAgents*, ThreadableLoaderClient*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber);
     static void didReceiveXHRResponseImpl(InstrumentingAgents*, unsigned long identifier);
     static void willLoadXHRSynchronouslyImpl(InstrumentingAgents*);
     static void didLoadXHRSynchronouslyImpl(InstrumentingAgents*);
@@ -1571,11 +1571,11 @@
 }
 
 
-inline void InspectorInstrumentation::didFinishXHRLoading(ScriptExecutionContext* context, ThreadableLoaderClient* client, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber)
+inline void InspectorInstrumentation::didFinishXHRLoading(ScriptExecutionContext* context, ThreadableLoaderClient* client, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber)
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        didFinishXHRLoadingImpl(instrumentingAgents, client, identifier, sourceString, url, sendURL, sendLineNumber);
+        didFinishXHRLoadingImpl(instrumentingAgents, client, identifier, sourceString, url, sendURL, sendLineNumber, sendColumnNumber);
 #else
     UNUSED_PARAM(context);
     UNUSED_PARAM(client);

Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (158934 => 158935)


--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp	2013-11-08 19:38:58 UTC (rev 158934)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp	2013-11-08 19:45:41 UTC (rev 158935)
@@ -188,6 +188,7 @@
     , m_sameOriginRequest(true)
     , m_receivedLength(0)
     , m_lastSendLineNumber(0)
+    , m_lastSendColumnNumber(0)
     , m_exceptionCode(0)
     , m_progressEventThrottle(this)
     , m_responseTypeCode(ResponseTypeDefault)
@@ -402,6 +403,12 @@
     return "";
 }
 
+void XMLHttpRequest::setLastSendLineAndColumnNumber(unsigned lineNumber, unsigned columnNumber)
+{
+    m_lastSendLineNumber = lineNumber;
+    m_lastSendColumnNumber = columnNumber;
+}
+
 XMLHttpRequestUpload* XMLHttpRequest::upload()
 {
     if (!m_upload)
@@ -1155,7 +1162,7 @@
 
     m_responseBuilder.shrinkToFit();
 
-    InspectorInstrumentation::didFinishXHRLoading(scriptExecutionContext(), this, identifier, m_responseBuilder.toStringPreserveCapacity(), m_url, m_lastSendURL, m_lastSendLineNumber);
+    InspectorInstrumentation::didFinishXHRLoading(scriptExecutionContext(), this, identifier, m_responseBuilder.toStringPreserveCapacity(), m_url, m_lastSendURL, m_lastSendLineNumber, m_lastSendColumnNumber);
 
     bool hadLoader = m_loader;
     m_loader = 0;

Modified: trunk/Source/WebCore/xml/XMLHttpRequest.h (158934 => 158935)


--- trunk/Source/WebCore/xml/XMLHttpRequest.h	2013-11-08 19:38:58 UTC (rev 158934)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.h	2013-11-08 19:45:41 UTC (rev 158935)
@@ -137,7 +137,7 @@
     JSC::ArrayBuffer* responseArrayBuffer();
     JSC::ArrayBuffer* optionalResponseArrayBuffer() const { return m_responseArrayBuffer.get(); }
 
-    void setLastSendLineNumber(unsigned lineNumber) { m_lastSendLineNumber = lineNumber; }
+    void setLastSendLineAndColumnNumber(unsigned lineNumber, unsigned columnNumber);
     void setLastSendURL(const String& url) { m_lastSendURL = url; }
 
     XMLHttpRequestUpload* upload();
@@ -249,6 +249,7 @@
     long long m_receivedLength;
 
     unsigned m_lastSendLineNumber;
+    unsigned m_lastSendColumnNumber;
     String m_lastSendURL;
     ExceptionCode m_exceptionCode;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to