Changeset 240323 in webkit


Ignore:
Timestamp:
Jan 22, 2019 8:51:45 PM (5 years ago)
Author:
Devin Rousso
Message:

Web Inspector: InspectorInstrumentation::willEvaluateScript should include column number
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.
Location:
trunk
Files:
2 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r240318 r240323  
     12019-01-22  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: InspectorInstrumentation::willEvaluateScript should include column number
     4        https://bugs.webkit.org/show_bug.cgi?id=116191
     5        <rdar://problem/13905910>
     6
     7        Reviewed by Joseph Pecoraro.
     8
     9        * inspector/timeline/line-column.html: Added.
     10        * inspector/timeline/line-column-expected.txt: Added.
     11
    1122019-01-22  Devin Rousso  <drousso@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r240318 r240323  
     12019-01-22  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: InspectorInstrumentation::willEvaluateScript should include column number
     4        https://bugs.webkit.org/show_bug.cgi?id=116191
     5        <rdar://problem/13905910>
     6
     7        Reviewed by Joseph Pecoraro.
     8
     9        Test inspector/timeline/line-column.html
     10
     11        * bindings/js/ScriptController.cpp:
     12        (WebCore::ScriptController::evaluateInWorld):
     13        (WebCore::ScriptController::evaluateModule):
     14
     15        * bindings/js/JSExecStateInstrumentation.h:
     16        (WebCore::JSExecState::instrumentFunctionInternal):
     17
     18        * inspector/InspectorInstrumentation.h:
     19        (WebCore::InspectorInstrumentation::willCallFunction):
     20        (WebCore::InspectorInstrumentation::willEvaluateScript):
     21        * inspector/InspectorInstrumentation.cpp:
     22        (WebCore::InspectorInstrumentation::willCallFunctionImpl):
     23        (WebCore::InspectorInstrumentation::willEvaluateScriptImpl):
     24
     25        * inspector/agents/InspectorTimelineAgent.h:
     26        * inspector/agents/InspectorTimelineAgent.cpp:
     27        (WebCore::InspectorTimelineAgent::willCallFunction):
     28        (WebCore::InspectorTimelineAgent::willEvaluateScript):
     29
     30        * inspector/TimelineRecordFactory.h:
     31        * inspector/TimelineRecordFactory.cpp:
     32        (WebCore::TimelineRecordFactory::createFunctionCallData):
     33        (WebCore::TimelineRecordFactory::createEvaluateScriptData):
     34
     35        * bindings/js/ScriptSourceCode.h:
     36        (WebCore::ScriptSourceCode::startColumn const): Added.
     37
    1382019-01-22  Devin Rousso  <drousso@apple.com>
    239
  • trunk/Source/WebCore/bindings/js/JSExecStateInstrumentation.h

    r234586 r240323  
    4040    String resourceName;
    4141    int lineNumber = 1;
     42    int columnNumber = 1;
    4243    if (callType == jsType) {
    4344        resourceName = callData.js.functionExecutable->sourceURL();
    4445        lineNumber = callData.js.functionExecutable->firstLine();
     46        columnNumber = callData.js.functionExecutable->startColumn();
    4547    } else
    4648        resourceName = "undefined";
    47     return InspectorInstrumentation::willCallFunction(context, resourceName, lineNumber);
     49    return InspectorInstrumentation::willCallFunction(context, resourceName, lineNumber, columnNumber);
    4850}
    4951
  • trunk/Source/WebCore/bindings/js/ScriptController.cpp

    r239569 r240323  
    126126    Ref<Frame> protector(m_frame);
    127127
    128     InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvaluateScript(m_frame, sourceURL, sourceCode.startLine());
     128    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvaluateScript(m_frame, sourceURL, sourceCode.startLine(), sourceCode.startColumn());
    129129
    130130    NakedPtr<JSC::Exception> evaluationException;
     
    219219    Ref<Frame> protector(m_frame);
    220220
    221     auto cookie = InspectorInstrumentation::willEvaluateScript(m_frame, sourceURL, jsSourceCode.firstLine().oneBasedInt());
     221    auto cookie = InspectorInstrumentation::willEvaluateScript(m_frame, sourceURL, jsSourceCode.firstLine().oneBasedInt(), jsSourceCode.startColumn().oneBasedInt());
    222222
    223223    auto returnValue = moduleRecord.evaluate(&state);
  • trunk/Source/WebCore/bindings/js/ScriptSourceCode.h

    r239569 r240323  
    7171
    7272    int startLine() const { return m_code.firstLine().oneBasedInt(); }
     73    int startColumn() const { return m_code.startColumn().oneBasedInt(); }
    7374
    7475    CachedScript* cachedScript() const { return m_cachedScript.get(); }
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp

    r239703 r240323  
    369369}
    370370
    371 InspectorInstrumentationCookie InspectorInstrumentation::willCallFunctionImpl(InstrumentingAgents& instrumentingAgents, const String& scriptName, int scriptLine, ScriptExecutionContext* context)
     371InspectorInstrumentationCookie InspectorInstrumentation::willCallFunctionImpl(InstrumentingAgents& instrumentingAgents, const String& scriptName, int scriptLine, int scriptColumn, ScriptExecutionContext* context)
    372372{
    373373    int timelineAgentId = 0;
    374374    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) {
    375         timelineAgent->willCallFunction(scriptName, scriptLine, frameForScriptExecutionContext(context));
     375        timelineAgent->willCallFunction(scriptName, scriptLine, scriptColumn, frameForScriptExecutionContext(context));
    376376        timelineAgentId = timelineAgent->id();
    377377    }
     
    442442}
    443443
    444 InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScriptImpl(InstrumentingAgents& instrumentingAgents, Frame& frame, const String& url, int lineNumber)
     444InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScriptImpl(InstrumentingAgents& instrumentingAgents, Frame& frame, const String& url, int lineNumber, int columnNumber)
    445445{
    446446    int timelineAgentId = 0;
    447447    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) {
    448         timelineAgent->willEvaluateScript(url, lineNumber, frame);
     448        timelineAgent->willEvaluateScript(url, lineNumber, columnNumber, frame);
    449449        timelineAgentId = timelineAgent->id();
    450450    }
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.h

    r239703 r240323  
    147147    static void didDispatchPostMessage(Frame&, TimerBase&);
    148148
    149     static InspectorInstrumentationCookie willCallFunction(ScriptExecutionContext*, const String& scriptName, int scriptLine);
     149    static InspectorInstrumentationCookie willCallFunction(ScriptExecutionContext*, const String& scriptName, int scriptLine, int scriptColumn);
    150150    static void didCallFunction(const InspectorInstrumentationCookie&, ScriptExecutionContext*);
    151151    static void didAddEventListener(EventTarget&, const AtomicString& eventType, EventListener&, bool capture);
     
    159159    static void didDispatchEventOnWindow(const InspectorInstrumentationCookie&);
    160160    static void eventDidResetAfterDispatch(const Event&);
    161     static InspectorInstrumentationCookie willEvaluateScript(Frame&, const String& url, int lineNumber);
     161    static InspectorInstrumentationCookie willEvaluateScript(Frame&, const String& url, int lineNumber, int columnNumber);
    162162    static void didEvaluateScript(const InspectorInstrumentationCookie&, Frame&);
    163163    static InspectorInstrumentationCookie willFireTimer(ScriptExecutionContext&, int timerId, bool oneShot);
     
    339339    static void didDispatchPostMessageImpl(InstrumentingAgents&, const TimerBase&);
    340340
    341     static InspectorInstrumentationCookie willCallFunctionImpl(InstrumentingAgents&, const String& scriptName, int scriptLine, ScriptExecutionContext*);
     341    static InspectorInstrumentationCookie willCallFunctionImpl(InstrumentingAgents&, const String& scriptName, int scriptLine, int scriptColumn, ScriptExecutionContext*);
    342342    static void didCallFunctionImpl(const InspectorInstrumentationCookie&, ScriptExecutionContext*);
    343343    static void didAddEventListenerImpl(InstrumentingAgents&, EventTarget&, const AtomicString& eventType, EventListener&, bool capture);
     
    351351    static void didDispatchEventOnWindowImpl(const InspectorInstrumentationCookie&);
    352352    static void eventDidResetAfterDispatchImpl(InstrumentingAgents&, const Event&);
    353     static InspectorInstrumentationCookie willEvaluateScriptImpl(InstrumentingAgents&, Frame&, const String& url, int lineNumber);
     353    static InspectorInstrumentationCookie willEvaluateScriptImpl(InstrumentingAgents&, Frame&, const String& url, int lineNumber, int columnNumber);
    354354    static void didEvaluateScriptImpl(const InspectorInstrumentationCookie&, Frame&);
    355355    static InspectorInstrumentationCookie willFireTimerImpl(InstrumentingAgents&, int timerId, bool oneShot, ScriptExecutionContext&);
     
    769769}
    770770
    771 inline InspectorInstrumentationCookie InspectorInstrumentation::willCallFunction(ScriptExecutionContext* context, const String& scriptName, int scriptLine)
     771inline InspectorInstrumentationCookie InspectorInstrumentation::willCallFunction(ScriptExecutionContext* context, const String& scriptName, int scriptLine, int scriptColumn)
    772772{
    773773    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
    774774    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
    775         return willCallFunctionImpl(*instrumentingAgents, scriptName, scriptLine, context);
     775        return willCallFunctionImpl(*instrumentingAgents, scriptName, scriptLine, scriptColumn, context);
    776776    return InspectorInstrumentationCookie();
    777777}
     
    840840}
    841841
    842 inline InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScript(Frame& frame, const String& url, int lineNumber)
     842inline InspectorInstrumentationCookie InspectorInstrumentation::willEvaluateScript(Frame& frame, const String& url, int lineNumber, int columnNumber)
    843843{
    844844    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
    845845    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
    846         return willEvaluateScriptImpl(*instrumentingAgents, frame, url, lineNumber);
     846        return willEvaluateScriptImpl(*instrumentingAgents, frame, url, lineNumber, columnNumber);
    847847    return InspectorInstrumentationCookie();
    848848}
  • trunk/Source/WebCore/inspector/TimelineRecordFactory.cpp

    r239397 r240323  
    5858}
    5959
    60 Ref<JSON::Object> TimelineRecordFactory::createFunctionCallData(const String& scriptName, int scriptLine)
     60Ref<JSON::Object> TimelineRecordFactory::createFunctionCallData(const String& scriptName, int scriptLine, int scriptColumn)
    6161{
    6262    Ref<JSON::Object> data = JSON::Object::create();
    6363    data->setString("scriptName"_s, scriptName);
    6464    data->setInteger("scriptLine"_s, scriptLine);
     65    data->setInteger("scriptColumn"_s, scriptColumn);
    6566    return data;
    6667}
     
    104105}
    105106
    106 Ref<JSON::Object> TimelineRecordFactory::createEvaluateScriptData(const String& url, double lineNumber)
     107Ref<JSON::Object> TimelineRecordFactory::createEvaluateScriptData(const String& url, int lineNumber, int columnNumber)
    107108{
    108109    Ref<JSON::Object> data = JSON::Object::create();
    109110    data->setString("url"_s, url);
    110111    data->setInteger("lineNumber"_s, lineNumber);
     112    data->setInteger("columnNumber"_s, columnNumber);
    111113    return data;
    112114}
  • trunk/Source/WebCore/inspector/TimelineRecordFactory.h

    r239397 r240323  
    5050    static Ref<JSON::Object> createGenericRecord(double startTime, int maxCallStackDepth);
    5151
    52     static Ref<JSON::Object> createFunctionCallData(const String& scriptName, int scriptLine);
     52    static Ref<JSON::Object> createFunctionCallData(const String& scriptName, int scriptLine, int scriptColumn);
    5353    static Ref<JSON::Object> createConsoleProfileData(const String& title);
    5454    static Ref<JSON::Object> createProbeSampleData(const Inspector::ScriptBreakpointAction&, unsigned sampleId);
     
    5656    static Ref<JSON::Object> createGenericTimerData(int timerId);
    5757    static Ref<JSON::Object> createTimerInstallData(int timerId, Seconds timeout, bool singleShot);
    58     static Ref<JSON::Object> createEvaluateScriptData(const String&, double lineNumber);
     58    static Ref<JSON::Object> createEvaluateScriptData(const String&, int lineNumber, int columnNumber);
    5959    static Ref<JSON::Object> createTimeStampData(const String&);
    6060    static Ref<JSON::Object> createAnimationFrameData(int callbackId);
  • trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp

    r239427 r240323  
    294294}
    295295
    296 void InspectorTimelineAgent::willCallFunction(const String& scriptName, int scriptLine, Frame* frame)
    297 {
    298     pushCurrentRecord(TimelineRecordFactory::createFunctionCallData(scriptName, scriptLine), TimelineRecordType::FunctionCall, true, frame);
     296void InspectorTimelineAgent::willCallFunction(const String& scriptName, int scriptLine, int scriptColumn, Frame* frame)
     297{
     298    pushCurrentRecord(TimelineRecordFactory::createFunctionCallData(scriptName, scriptLine, scriptColumn), TimelineRecordType::FunctionCall, true, frame);
    299299}
    300300
     
    403403}
    404404
    405 void InspectorTimelineAgent::willEvaluateScript(const String& url, int lineNumber, Frame& frame)
    406 {
    407     pushCurrentRecord(TimelineRecordFactory::createEvaluateScriptData(url, lineNumber), TimelineRecordType::EvaluateScript, true, &frame);
     405void InspectorTimelineAgent::willEvaluateScript(const String& url, int lineNumber, int columnNumber, Frame& frame)
     406{
     407    pushCurrentRecord(TimelineRecordFactory::createEvaluateScriptData(url, lineNumber, columnNumber), TimelineRecordType::EvaluateScript, true, &frame);
    408408}
    409409
  • trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.h

    r239397 r240323  
    119119    void willFireTimer(int timerId, Frame*);
    120120    void didFireTimer();
    121     void willCallFunction(const String& scriptName, int scriptLine, Frame*);
     121    void willCallFunction(const String& scriptName, int scriptLine, int scriptColumn, Frame*);
    122122    void didCallFunction(Frame*);
    123123    void willDispatchEvent(const Event&, Frame*);
    124124    void didDispatchEvent();
    125     void willEvaluateScript(const String&, int, Frame&);
     125    void willEvaluateScript(const String&, int lineNumber, int columnNumber, Frame&);
    126126    void didEvaluateScript(Frame&);
    127127    void didInvalidateLayout(Frame&);
  • trunk/Source/WebInspectorUI/ChangeLog

    r240318 r240323  
     12019-01-22  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: InspectorInstrumentation::willEvaluateScript should include column number
     4        https://bugs.webkit.org/show_bug.cgi?id=116191
     5        <rdar://problem/13905910>
     6
     7        Reviewed by Joseph Pecoraro.
     8
     9        * UserInterface/Controllers/TimelineManager.js:
     10        (WI.TimelineManager.prototype._processRecord):
     11
    1122019-01-22  Devin Rousso  <drousso@apple.com>
    213
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js

    r239397 r240323  
    533533                if (scriptResource) {
    534534                    // The lineNumber is 1-based, but we expect 0-based.
    535                     var lineNumber = recordPayload.data.lineNumber - 1;
    536 
    537                     // FIXME: No column number is provided.
    538                     sourceCodeLocation = scriptResource.createSourceCodeLocation(lineNumber, 0);
     535                    let lineNumber = recordPayload.data.lineNumber - 1;
     536                    let columnNumber = "columnNumber" in recordPayload.data ? recordPayload.data.columnNumber - 1 : 0;
     537                    sourceCodeLocation = scriptResource.createSourceCodeLocation(lineNumber, columnNumber);
    539538                }
    540539            }
     
    587586                if (scriptResource) {
    588587                    // The lineNumber is 1-based, but we expect 0-based.
    589                     var lineNumber = recordPayload.data.scriptLine - 1;
    590 
    591                     // FIXME: No column number is provided.
    592                     sourceCodeLocation = scriptResource.createSourceCodeLocation(lineNumber, 0);
     588                    let lineNumber = recordPayload.data.scriptLine - 1;
     589                    let columnNumber = "scriptColumn" in recordPayload.data ? recordPayload.data.scriptColumn - 1 : 0;
     590                    sourceCodeLocation = scriptResource.createSourceCodeLocation(lineNumber, columnNumber);
    593591                }
    594592            }
Note: See TracChangeset for help on using the changeset viewer.