Web Inspector: InspectorInstrumentation::willEvaluateScript should include column...
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jan 2019 04:51:45 +0000 (04:51 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jan 2019 04:51:45 +0000 (04:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=116191
<rdar://problem/13905910>

Reviewed by Joseph Pecoraro.

Source/WebCore:

Test inspector/timeline/line-column.html

* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::evaluateInWorld):
(WebCore::ScriptController::evaluateModule):

* bindings/js/JSExecStateInstrumentation.h:
(WebCore::JSExecState::instrumentFunctionInternal):

* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::willCallFunction):
(WebCore::InspectorInstrumentation::willEvaluateScript):
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::willCallFunctionImpl):
(WebCore::InspectorInstrumentation::willEvaluateScriptImpl):

* inspector/agents/InspectorTimelineAgent.h:
* inspector/agents/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::willCallFunction):
(WebCore::InspectorTimelineAgent::willEvaluateScript):

* inspector/TimelineRecordFactory.h:
* inspector/TimelineRecordFactory.cpp:
(WebCore::TimelineRecordFactory::createFunctionCallData):
(WebCore::TimelineRecordFactory::createEvaluateScriptData):

* bindings/js/ScriptSourceCode.h:
(WebCore::ScriptSourceCode::startColumn const): Added.

Source/WebInspectorUI:

* UserInterface/Controllers/TimelineManager.js:
(WI.TimelineManager.prototype._processRecord):

LayoutTests:

* inspector/timeline/line-column.html: Added.
* inspector/timeline/line-column-expected.txt: Added.

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

15 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/timeline/line-column-expected.txt [new file with mode: 0644]
LayoutTests/inspector/timeline/line-column.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSExecStateInstrumentation.h
Source/WebCore/bindings/js/ScriptController.cpp
Source/WebCore/bindings/js/ScriptSourceCode.h
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/inspector/TimelineRecordFactory.cpp
Source/WebCore/inspector/TimelineRecordFactory.h
Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp
Source/WebCore/inspector/agents/InspectorTimelineAgent.h
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js

index 501477a..a0165f4 100644 (file)
@@ -1,5 +1,16 @@
 2019-01-22  Devin Rousso  <drousso@apple.com>
 
+        Web Inspector: InspectorInstrumentation::willEvaluateScript should include column number
+        https://bugs.webkit.org/show_bug.cgi?id=116191
+        <rdar://problem/13905910>
+
+        Reviewed by Joseph Pecoraro.
+
+        * inspector/timeline/line-column.html: Added.
+        * inspector/timeline/line-column-expected.txt: Added.
+
+2019-01-22  Devin Rousso  <drousso@apple.com>
+
         Web Inspector: expose Audit and Recording versions to the frontend
         https://bugs.webkit.org/show_bug.cgi?id=193262
         <rdar://problem/47130684>
diff --git a/LayoutTests/inspector/timeline/line-column-expected.txt b/LayoutTests/inspector/timeline/line-column-expected.txt
new file mode 100644 (file)
index 0000000..532ff95
--- /dev/null
@@ -0,0 +1,238 @@
+Test that script Timeline records have column numbers.
+
+
+
+== Running test suite: Timeline.LineColumn
+-- Running test case: Timeline.LineColumn.willCallFunction
+Evaluating in page...
+PASS: Capturing started.
+{
+  "startTime": "<filtered>",
+  "data": {},
+  "children": [
+    {
+      "startTime": "<filtered>",
+      "stackTrace": [
+        {
+          "functionName": "click",
+          "url": "[native code]",
+          "scriptId": "<filtered>",
+          "lineNumber": 0,
+          "columnNumber": 0
+        },
+        {
+          "functionName": "willCallFunctionTest",
+          "url": "timeline/line-column.html",
+          "scriptId": "<filtered>",
+          "lineNumber": 26,
+          "columnNumber": 44
+        },
+        {
+          "functionName": "global code",
+          "url": "",
+          "scriptId": "<filtered>",
+          "lineNumber": 1,
+          "columnNumber": 21
+        },
+        {
+          "functionName": "evaluateWithScopeExtension",
+          "url": "[native code]",
+          "scriptId": "<filtered>",
+          "lineNumber": 0,
+          "columnNumber": 0
+        },
+        {
+          "functionName": "",
+          "url": "",
+          "scriptId": "<filtered>",
+          "lineNumber": 134,
+          "columnNumber": 97
+        }
+      ],
+      "data": {},
+      "frameId": "<filtered>",
+      "type": "ScheduleStyleRecalculation"
+    },
+    {
+      "startTime": "<filtered>",
+      "frameId": "<filtered>",
+      "data": {
+        "type": "click"
+      },
+      "children": [],
+      "endTime": "<filtered>",
+      "type": "EventDispatch"
+    },
+    {
+      "startTime": "<filtered>",
+      "frameId": "<filtered>",
+      "data": {
+        "type": "click"
+      },
+      "children": [
+        {
+          "startTime": "<filtered>",
+          "stackTrace": [
+            {
+              "functionName": "click",
+              "url": "[native code]",
+              "scriptId": "<filtered>",
+              "lineNumber": 0,
+              "columnNumber": 0
+            },
+            {
+              "functionName": "willCallFunctionTest",
+              "url": "timeline/line-column.html",
+              "scriptId": "<filtered>",
+              "lineNumber": 26,
+              "columnNumber": 44
+            },
+            {
+              "functionName": "global code",
+              "url": "",
+              "scriptId": "<filtered>",
+              "lineNumber": 1,
+              "columnNumber": 21
+            },
+            {
+              "functionName": "evaluateWithScopeExtension",
+              "url": "[native code]",
+              "scriptId": "<filtered>",
+              "lineNumber": 0,
+              "columnNumber": 0
+            },
+            {
+              "functionName": "",
+              "url": "",
+              "scriptId": "<filtered>",
+              "lineNumber": 134,
+              "columnNumber": 97
+            }
+          ],
+          "frameId": "<filtered>",
+          "data": {
+            "scriptName": "timeline/line-column.html",
+            "scriptLine": 17,
+            "scriptColumn": 65
+          },
+          "children": [],
+          "endTime": "<filtered>",
+          "type": "FunctionCall"
+        }
+      ],
+      "endTime": "<filtered>",
+      "type": "EventDispatch"
+    },
+    {
+      "startTime": "<filtered>",
+      "stackTrace": [
+        {
+          "functionName": "profile",
+          "url": "[native code]",
+          "scriptId": "<filtered>",
+          "lineNumber": 0,
+          "columnNumber": 0
+        },
+        {
+          "functionName": "willCallFunctionTest",
+          "url": "timeline/line-column.html",
+          "scriptId": "<filtered>",
+          "lineNumber": 25,
+          "columnNumber": 20
+        },
+        {
+          "functionName": "global code",
+          "url": "",
+          "scriptId": "<filtered>",
+          "lineNumber": 1,
+          "columnNumber": 21
+        },
+        {
+          "functionName": "evaluateWithScopeExtension",
+          "url": "[native code]",
+          "scriptId": "<filtered>",
+          "lineNumber": 0,
+          "columnNumber": 0
+        },
+        {
+          "functionName": "",
+          "url": "",
+          "scriptId": "<filtered>",
+          "lineNumber": 134,
+          "columnNumber": 97
+        }
+      ],
+      "frameId": "<filtered>",
+      "data": {
+        "title": ""
+      },
+      "children": [],
+      "endTime": "<filtered>",
+      "type": "ConsoleProfile"
+    }
+  ],
+  "endTime": "<filtered>",
+  "type": "RenderingFrame"
+}
+PASS: Capturing stopped.
+
+-- Running test case: Timeline.LineColumn.willEvaluateScript
+Evaluating in page...
+PASS: Capturing started.
+{
+  "startTime": "<filtered>",
+  "data": {},
+  "children": [
+    {
+      "startTime": "<filtered>",
+      "stackTrace": [
+        {
+          "functionName": "profile",
+          "url": "[native code]",
+          "scriptId": "<filtered>",
+          "lineNumber": 0,
+          "columnNumber": 0
+        },
+        {
+          "functionName": "willEvaluateScriptTest",
+          "url": "timeline/line-column.html",
+          "scriptId": "<filtered>",
+          "lineNumber": 31,
+          "columnNumber": 20
+        },
+        {
+          "functionName": "global code",
+          "url": "",
+          "scriptId": "<filtered>",
+          "lineNumber": 1,
+          "columnNumber": 23
+        },
+        {
+          "functionName": "evaluateWithScopeExtension",
+          "url": "[native code]",
+          "scriptId": "<filtered>",
+          "lineNumber": 0,
+          "columnNumber": 0
+        },
+        {
+          "functionName": "",
+          "url": "",
+          "scriptId": "<filtered>",
+          "lineNumber": 134,
+          "columnNumber": 97
+        }
+      ],
+      "frameId": "<filtered>",
+      "data": {
+        "title": ""
+      },
+      "children": [],
+      "endTime": "<filtered>",
+      "type": "ConsoleProfile"
+    }
+  ],
+  "endTime": "<filtered>",
+  "type": "RenderingFrame"
+}
+PASS: Capturing stopped.
+
diff --git a/LayoutTests/inspector/timeline/line-column.html b/LayoutTests/inspector/timeline/line-column.html
new file mode 100644 (file)
index 0000000..dd9c5ae
--- /dev/null
@@ -0,0 +1,107 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../http/tests/inspector/resources/protocol-test.js"></script>
+<script>
+
+function bar(x)
+{
+    return x * 10;
+}
+
+function foo() {
+    bar(42);
+}
+
+function load() {
+    document.querySelector("#button").addEventListener("click", (event) => {
+        foo();
+    });
+
+    runTest();
+}
+
+function willCallFunctionTest() {
+    console.profile();
+    document.querySelector("#button").click();
+    console.profileEnd();
+}
+
+function willEvaluateScriptTest() {
+    console.profile();
+    foo();
+    console.profileEnd();
+}
+
+function test() {
+    ProtocolTest.debug();
+
+    let suite = ProtocolTest.createAsyncSuite("Timeline.LineColumn");
+
+    function replacer(key, value) {
+        if (key === "startTime" || key === "endTime" || key === "scriptId" || key === "frameId")
+            return "<filtered>";
+        if (key === "url" || key === "scriptName")
+            return value.replace(/^.+LayoutTests\/inspector\//, "");
+        return value;
+    }
+
+    const tests = [
+        {
+            name: "Timeline.LineColumn.willCallFunction",
+            description: "Test that column numbers are passed through the willCallFunction instrumentation point.",
+            expression: `willCallFunctionTest()`,
+        },
+        {
+            name: "Timeline.LineColumn.willEvaluateScript",
+            description: "Test that column numbers are passed through the willEvaluateScript instrumentation point.",
+            expression: `willEvaluateScriptTest()`,
+        },
+    ];
+
+    for (let {name, description, expression} of tests) {
+        suite.addTestCase({
+            name,
+            description,
+            test(resolve, reject) {
+                let eventNames = [];
+
+                function handleEvent(eventName, handler) {
+                    eventNames.push(eventName);
+                    InspectorProtocol.eventHandler[eventName] = handler;
+                }
+
+                handleEvent("Timeline.eventRecorded", (event) => {
+                    ProtocolTest.log(JSON.stringify(event.params.record, replacer, 2));
+                });
+
+                handleEvent("Timeline.programmaticCaptureStarted", () => {
+                    ProtocolTest.pass("Capturing started.");
+                });
+
+                handleEvent("Timeline.programmaticCaptureStopped", () => {
+                    ProtocolTest.pass("Capturing stopped.");
+
+                    for (let eventName of eventNames)
+                        delete InspectorProtocol.eventHandler[eventName];
+
+                    resolve();
+                });
+
+                ProtocolTest.log("Evaluating in page...");
+                ProtocolTest.evaluateInPage(expression)
+                .catch(reject);
+            },
+        });
+    }
+
+    suite.runTestCasesAndFinish();
+}
+
+</script>
+</head>
+<body onload="load()">
+    <p>Test that script Timeline records have column numbers.</p>
+    <button id="button"></button>
+</body>
+</html>
index a8de73f..6591a43 100644 (file)
@@ -1,5 +1,42 @@
 2019-01-22  Devin Rousso  <drousso@apple.com>
 
+        Web Inspector: InspectorInstrumentation::willEvaluateScript should include column number
+        https://bugs.webkit.org/show_bug.cgi?id=116191
+        <rdar://problem/13905910>
+
+        Reviewed by Joseph Pecoraro.
+
+        Test inspector/timeline/line-column.html
+
+        * bindings/js/ScriptController.cpp:
+        (WebCore::ScriptController::evaluateInWorld):
+        (WebCore::ScriptController::evaluateModule):
+
+        * bindings/js/JSExecStateInstrumentation.h:
+        (WebCore::JSExecState::instrumentFunctionInternal):
+
+        * inspector/InspectorInstrumentation.h:
+        (WebCore::InspectorInstrumentation::willCallFunction):
+        (WebCore::InspectorInstrumentation::willEvaluateScript):
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore::InspectorInstrumentation::willCallFunctionImpl):
+        (WebCore::InspectorInstrumentation::willEvaluateScriptImpl):
+
+        * inspector/agents/InspectorTimelineAgent.h:
+        * inspector/agents/InspectorTimelineAgent.cpp:
+        (WebCore::InspectorTimelineAgent::willCallFunction):
+        (WebCore::InspectorTimelineAgent::willEvaluateScript):
+
+        * inspector/TimelineRecordFactory.h:
+        * inspector/TimelineRecordFactory.cpp:
+        (WebCore::TimelineRecordFactory::createFunctionCallData):
+        (WebCore::TimelineRecordFactory::createEvaluateScriptData):
+
+        * bindings/js/ScriptSourceCode.h:
+        (WebCore::ScriptSourceCode::startColumn const): Added.
+
+2019-01-22  Devin Rousso  <drousso@apple.com>
+
         Web Inspector: expose Audit and Recording versions to the frontend
         https://bugs.webkit.org/show_bug.cgi?id=193262
         <rdar://problem/47130684>
index 7a653e5..553dc3d 100644 (file)
@@ -39,12 +39,14 @@ inline InspectorInstrumentationCookie JSExecState::instrumentFunctionInternal(Sc
         return InspectorInstrumentationCookie();
     String resourceName;
     int lineNumber = 1;
+    int columnNumber = 1;
     if (callType == jsType) {
         resourceName = callData.js.functionExecutable->sourceURL();
         lineNumber = callData.js.functionExecutable->firstLine();
+        columnNumber = callData.js.functionExecutable->startColumn();
     } else
         resourceName = "undefined";
-    return InspectorInstrumentation::willCallFunction(context, resourceName, lineNumber);
+    return InspectorInstrumentation::willCallFunction(context, resourceName, lineNumber, columnNumber);
 }
 
 inline InspectorInstrumentationCookie JSExecState::instrumentFunctionCall(ScriptExecutionContext* context, JSC::CallType type, const JSC::CallData& data)
index 785c66e..784ae54 100644 (file)
@@ -125,7 +125,7 @@ JSValue ScriptController::evaluateInWorld(const ScriptSourceCode& sourceCode, DO
 
     Ref<Frame> protector(m_frame);
 
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvaluateScript(m_frame, sourceURL, sourceCode.startLine());
+    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvaluateScript(m_frame, sourceURL, sourceCode.startLine(), sourceCode.startColumn());
 
     NakedPtr<JSC::Exception> evaluationException;
     JSValue returnValue = JSExecState::profiledEvaluate(&exec, JSC::ProfilingReason::Other, jsSourceCode, &proxy, evaluationException);
@@ -218,7 +218,7 @@ JSC::JSValue ScriptController::evaluateModule(const URL& sourceURL, JSModuleReco
 
     Ref<Frame> protector(m_frame);
 
-    auto cookie = InspectorInstrumentation::willEvaluateScript(m_frame, sourceURL, jsSourceCode.firstLine().oneBasedInt());
+    auto cookie = InspectorInstrumentation::willEvaluateScript(m_frame, sourceURL, jsSourceCode.firstLine().oneBasedInt(), jsSourceCode.startColumn().oneBasedInt());
 
     auto returnValue = moduleRecord.evaluate(&state);
     InspectorInstrumentation::didEvaluateScript(cookie, m_frame);
index 286a344..fca574c 100644 (file)
@@ -70,6 +70,7 @@ public:
     StringView source() const { return m_provider->source(); }
 
     int startLine() const { return m_code.firstLine().oneBasedInt(); }
+    int startColumn() const { return m_code.startColumn().oneBasedInt(); }
 
     CachedScript* cachedScript() const { return m_cachedScript.get(); }
 
index cc8f1f0..b50303c 100644 (file)
@@ -368,11 +368,11 @@ void InspectorInstrumentation::didDispatchPostMessageImpl(InstrumentingAgents& i
         pageDebuggerAgent->didDispatchPostMessage(timer);
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willCallFunctionImpl(InstrumentingAgents& instrumentingAgents, const String& scriptName, int scriptLine, ScriptExecutionContext* context)
+InspectorInstrumentationCookie InspectorInstrumentation::willCallFunctionImpl(InstrumentingAgents& instrumentingAgents, const String& scriptName, int scriptLine, int scriptColumn, ScriptExecutionContext* context)
 {
     int timelineAgentId = 0;
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) {
-        timelineAgent->willCallFunction(scriptName, scriptLine, frameForScriptExecutionContext(context));
+        timelineAgent->willCallFunction(scriptName, scriptLine, scriptColumn, frameForScriptExecutionContext(context));
         timelineAgentId = timelineAgent->id();
     }
     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
@@ -441,11 +441,11 @@ void InspectorInstrumentation::eventDidResetAfterDispatchImpl(InstrumentingAgent
         domAgent->eventDidResetAfterDispatch(event);
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScriptImpl(InstrumentingAgents& instrumentingAgents, Frame& frame, const String& url, int lineNumber)
+InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScriptImpl(InstrumentingAgents& instrumentingAgents, Frame& frame, const String& url, int lineNumber, int columnNumber)
 {
     int timelineAgentId = 0;
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) {
-        timelineAgent->willEvaluateScript(url, lineNumber, frame);
+        timelineAgent->willEvaluateScript(url, lineNumber, columnNumber, frame);
         timelineAgentId = timelineAgent->id();
     }
     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
index fdaea62..d559c86 100644 (file)
@@ -146,7 +146,7 @@ public:
     static void willDispatchPostMessage(Frame&, TimerBase&);
     static void didDispatchPostMessage(Frame&, TimerBase&);
 
-    static InspectorInstrumentationCookie willCallFunction(ScriptExecutionContext*, const String& scriptName, int scriptLine);
+    static InspectorInstrumentationCookie willCallFunction(ScriptExecutionContext*, const String& scriptName, int scriptLine, int scriptColumn);
     static void didCallFunction(const InspectorInstrumentationCookie&, ScriptExecutionContext*);
     static void didAddEventListener(EventTarget&, const AtomicString& eventType, EventListener&, bool capture);
     static void willRemoveEventListener(EventTarget&, const AtomicString& eventType, EventListener&, bool capture);
@@ -158,7 +158,7 @@ public:
     static InspectorInstrumentationCookie willDispatchEventOnWindow(Frame*, const Event&, DOMWindow&);
     static void didDispatchEventOnWindow(const InspectorInstrumentationCookie&);
     static void eventDidResetAfterDispatch(const Event&);
-    static InspectorInstrumentationCookie willEvaluateScript(Frame&, const String& url, int lineNumber);
+    static InspectorInstrumentationCookie willEvaluateScript(Frame&, const String& url, int lineNumber, int columnNumber);
     static void didEvaluateScript(const InspectorInstrumentationCookie&, Frame&);
     static InspectorInstrumentationCookie willFireTimer(ScriptExecutionContext&, int timerId, bool oneShot);
     static void didFireTimer(const InspectorInstrumentationCookie&);
@@ -338,7 +338,7 @@ private:
     static void willDispatchPostMessageImpl(InstrumentingAgents&, const TimerBase&);
     static void didDispatchPostMessageImpl(InstrumentingAgents&, const TimerBase&);
 
-    static InspectorInstrumentationCookie willCallFunctionImpl(InstrumentingAgents&, const String& scriptName, int scriptLine, ScriptExecutionContext*);
+    static InspectorInstrumentationCookie willCallFunctionImpl(InstrumentingAgents&, const String& scriptName, int scriptLine, int scriptColumn, ScriptExecutionContext*);
     static void didCallFunctionImpl(const InspectorInstrumentationCookie&, ScriptExecutionContext*);
     static void didAddEventListenerImpl(InstrumentingAgents&, EventTarget&, const AtomicString& eventType, EventListener&, bool capture);
     static void willRemoveEventListenerImpl(InstrumentingAgents&, EventTarget&, const AtomicString& eventType, EventListener&, bool capture);
@@ -350,7 +350,7 @@ private:
     static InspectorInstrumentationCookie willDispatchEventOnWindowImpl(InstrumentingAgents&, const Event&, DOMWindow&);
     static void didDispatchEventOnWindowImpl(const InspectorInstrumentationCookie&);
     static void eventDidResetAfterDispatchImpl(InstrumentingAgents&, const Event&);
-    static InspectorInstrumentationCookie willEvaluateScriptImpl(InstrumentingAgents&, Frame&, const String& url, int lineNumber);
+    static InspectorInstrumentationCookie willEvaluateScriptImpl(InstrumentingAgents&, Frame&, const String& url, int lineNumber, int columnNumber);
     static void didEvaluateScriptImpl(const InspectorInstrumentationCookie&, Frame&);
     static InspectorInstrumentationCookie willFireTimerImpl(InstrumentingAgents&, int timerId, bool oneShot, ScriptExecutionContext&);
     static void didFireTimerImpl(const InspectorInstrumentationCookie&);
@@ -768,11 +768,11 @@ inline void InspectorInstrumentation::didDispatchPostMessage(Frame& frame, Timer
         didDispatchPostMessageImpl(*instrumentingAgents, timer);
 }
 
-inline InspectorInstrumentationCookie InspectorInstrumentation::willCallFunction(ScriptExecutionContext* context, const String& scriptName, int scriptLine)
+inline InspectorInstrumentationCookie InspectorInstrumentation::willCallFunction(ScriptExecutionContext* context, const String& scriptName, int scriptLine, int scriptColumn)
 {
     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        return willCallFunctionImpl(*instrumentingAgents, scriptName, scriptLine, context);
+        return willCallFunctionImpl(*instrumentingAgents, scriptName, scriptLine, scriptColumn, context);
     return InspectorInstrumentationCookie();
 }
 
@@ -839,11 +839,11 @@ inline void InspectorInstrumentation::eventDidResetAfterDispatch(const Event& ev
         return eventDidResetAfterDispatchImpl(*instrumentingAgents, event);
 }
 
-inline InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScript(Frame& frame, const String& url, int lineNumber)
+inline InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScript(Frame& frame, const String& url, int lineNumber, int columnNumber)
 {
     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        return willEvaluateScriptImpl(*instrumentingAgents, frame, url, lineNumber);
+        return willEvaluateScriptImpl(*instrumentingAgents, frame, url, lineNumber, columnNumber);
     return InspectorInstrumentationCookie();
 }
 
index 0cab454..cc45b1f 100644 (file)
@@ -57,11 +57,12 @@ Ref<JSON::Object> TimelineRecordFactory::createGenericRecord(double startTime, i
     return record;
 }
 
-Ref<JSON::Object> TimelineRecordFactory::createFunctionCallData(const String& scriptName, int scriptLine)
+Ref<JSON::Object> TimelineRecordFactory::createFunctionCallData(const String& scriptName, int scriptLine, int scriptColumn)
 {
     Ref<JSON::Object> data = JSON::Object::create();
     data->setString("scriptName"_s, scriptName);
     data->setInteger("scriptLine"_s, scriptLine);
+    data->setInteger("scriptColumn"_s, scriptColumn);
     return data;
 }
 
@@ -103,11 +104,12 @@ Ref<JSON::Object> TimelineRecordFactory::createTimerInstallData(int timerId, Sec
     return data;
 }
 
-Ref<JSON::Object> TimelineRecordFactory::createEvaluateScriptData(const String& url, double lineNumber)
+Ref<JSON::Object> TimelineRecordFactory::createEvaluateScriptData(const String& url, int lineNumber, int columnNumber)
 {
     Ref<JSON::Object> data = JSON::Object::create();
     data->setString("url"_s, url);
     data->setInteger("lineNumber"_s, lineNumber);
+    data->setInteger("columnNumber"_s, columnNumber);
     return data;
 }
 
index d5c13ff..5307558 100644 (file)
@@ -49,13 +49,13 @@ class TimelineRecordFactory {
 public:
     static Ref<JSON::Object> createGenericRecord(double startTime, int maxCallStackDepth);
 
-    static Ref<JSON::Object> createFunctionCallData(const String& scriptName, int scriptLine);
+    static Ref<JSON::Object> createFunctionCallData(const String& scriptName, int scriptLine, int scriptColumn);
     static Ref<JSON::Object> createConsoleProfileData(const String& title);
     static Ref<JSON::Object> createProbeSampleData(const Inspector::ScriptBreakpointAction&, unsigned sampleId);
     static Ref<JSON::Object> createEventDispatchData(const Event&);
     static Ref<JSON::Object> createGenericTimerData(int timerId);
     static Ref<JSON::Object> createTimerInstallData(int timerId, Seconds timeout, bool singleShot);
-    static Ref<JSON::Object> createEvaluateScriptData(const String&, double lineNumber);
+    static Ref<JSON::Object> createEvaluateScriptData(const String&, int lineNumber, int columnNumber);
     static Ref<JSON::Object> createTimeStampData(const String&);
     static Ref<JSON::Object> createAnimationFrameData(int callbackId);
     static Ref<JSON::Object> createObserverCallbackData(const String& callbackType);
index be02661..2e270d4 100644 (file)
@@ -293,9 +293,9 @@ void InspectorTimelineAgent::stopFromConsole(JSC::ExecState*, const String& titl
     }
 }
 
-void InspectorTimelineAgent::willCallFunction(const String& scriptName, int scriptLine, Frame* frame)
+void InspectorTimelineAgent::willCallFunction(const String& scriptName, int scriptLine, int scriptColumn, Frame* frame)
 {
-    pushCurrentRecord(TimelineRecordFactory::createFunctionCallData(scriptName, scriptLine), TimelineRecordType::FunctionCall, true, frame);
+    pushCurrentRecord(TimelineRecordFactory::createFunctionCallData(scriptName, scriptLine, scriptColumn), TimelineRecordType::FunctionCall, true, frame);
 }
 
 void InspectorTimelineAgent::didCallFunction(Frame*)
@@ -402,9 +402,9 @@ void InspectorTimelineAgent::didFireTimer()
     didCompleteCurrentRecord(TimelineRecordType::TimerFire);
 }
 
-void InspectorTimelineAgent::willEvaluateScript(const String& url, int lineNumber, Frame& frame)
+void InspectorTimelineAgent::willEvaluateScript(const String& url, int lineNumber, int columnNumber, Frame& frame)
 {
-    pushCurrentRecord(TimelineRecordFactory::createEvaluateScriptData(url, lineNumber), TimelineRecordType::EvaluateScript, true, &frame);
+    pushCurrentRecord(TimelineRecordFactory::createEvaluateScriptData(url, lineNumber, columnNumber), TimelineRecordType::EvaluateScript, true, &frame);
 }
 
 void InspectorTimelineAgent::didEvaluateScript(Frame&)
index cf2635e..4033cdf 100644 (file)
@@ -118,11 +118,11 @@ public:
     void didRemoveTimer(int timerId, Frame*);
     void willFireTimer(int timerId, Frame*);
     void didFireTimer();
-    void willCallFunction(const String& scriptName, int scriptLine, Frame*);
+    void willCallFunction(const String& scriptName, int scriptLine, int scriptColumn, Frame*);
     void didCallFunction(Frame*);
     void willDispatchEvent(const Event&, Frame*);
     void didDispatchEvent();
-    void willEvaluateScript(const String&, int, Frame&);
+    void willEvaluateScript(const String&, int lineNumber, int columnNumber, Frame&);
     void didEvaluateScript(Frame&);
     void didInvalidateLayout(Frame&);
     void willLayout(Frame&);
index 2e5a48d..12e2457 100644 (file)
@@ -1,5 +1,16 @@
 2019-01-22  Devin Rousso  <drousso@apple.com>
 
+        Web Inspector: InspectorInstrumentation::willEvaluateScript should include column number
+        https://bugs.webkit.org/show_bug.cgi?id=116191
+        <rdar://problem/13905910>
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Controllers/TimelineManager.js:
+        (WI.TimelineManager.prototype._processRecord):
+
+2019-01-22  Devin Rousso  <drousso@apple.com>
+
         Web Inspector: expose Audit and Recording versions to the frontend
         https://bugs.webkit.org/show_bug.cgi?id=193262
         <rdar://problem/47130684>
index a254f00..df8d04f 100644 (file)
@@ -532,10 +532,9 @@ WI.TimelineManager = class TimelineManager extends WI.Object
                 var scriptResource = mainFrame.url === recordPayload.data.url ? mainFrame.mainResource : mainFrame.resourceForURL(recordPayload.data.url, true);
                 if (scriptResource) {
                     // The lineNumber is 1-based, but we expect 0-based.
-                    var lineNumber = recordPayload.data.lineNumber - 1;
-
-                    // FIXME: No column number is provided.
-                    sourceCodeLocation = scriptResource.createSourceCodeLocation(lineNumber, 0);
+                    let lineNumber = recordPayload.data.lineNumber - 1;
+                    let columnNumber = "columnNumber" in recordPayload.data ? recordPayload.data.columnNumber - 1 : 0;
+                    sourceCodeLocation = scriptResource.createSourceCodeLocation(lineNumber, columnNumber);
                 }
             }
 
@@ -586,10 +585,9 @@ WI.TimelineManager = class TimelineManager extends WI.Object
                 var scriptResource = mainFrame.url === recordPayload.data.scriptName ? mainFrame.mainResource : mainFrame.resourceForURL(recordPayload.data.scriptName, true);
                 if (scriptResource) {
                     // The lineNumber is 1-based, but we expect 0-based.
-                    var lineNumber = recordPayload.data.scriptLine - 1;
-
-                    // FIXME: No column number is provided.
-                    sourceCodeLocation = scriptResource.createSourceCodeLocation(lineNumber, 0);
+                    let lineNumber = recordPayload.data.scriptLine - 1;
+                    let columnNumber = "scriptColumn" in recordPayload.data ? recordPayload.data.scriptColumn - 1 : 0;
+                    sourceCodeLocation = scriptResource.createSourceCodeLocation(lineNumber, columnNumber);
                 }
             }