Web Inspector: Remove unused / duplicated XHR timeline instrumentation
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Oct 2015 22:08:03 +0000 (22:08 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Oct 2015 22:08:03 +0000 (22:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=150605

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2015-10-27
Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

* inspector/protocol/Timeline.json:

Source/WebCore:

These records are just duplicates of "EventDispatch" records for XHR
load and readystatechange events. Due to the nesting, the XHR records
were themselves never getting looked at, and their data (URL / readyState)
not shown in the frontend.

* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::willDispatchXHRReadyStateChangeEventImpl): Deleted.
(WebCore::InspectorInstrumentation::didDispatchXHRReadyStateChangeEventImpl): Deleted.
(WebCore::InspectorInstrumentation::willDispatchXHRLoadEventImpl): Deleted.
(WebCore::InspectorInstrumentation::didDispatchXHRLoadEventImpl): Deleted.
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::willDispatchXHRReadyStateChangeEvent): Deleted.
(WebCore::InspectorInstrumentation::didDispatchXHRReadyStateChangeEvent): Deleted.
(WebCore::InspectorInstrumentation::willDispatchXHRLoadEvent): Deleted.
(WebCore::InspectorInstrumentation::didDispatchXHRLoadEvent): Deleted.
* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::willDispatchXHRReadyStateChangeEvent): Deleted.
(WebCore::InspectorTimelineAgent::didDispatchXHRReadyStateChangeEvent): Deleted.
(WebCore::InspectorTimelineAgent::willDispatchXHRLoadEvent): Deleted.
(WebCore::InspectorTimelineAgent::didDispatchXHRLoadEvent): Deleted.
(WebCore::toProtocol): Deleted.
* inspector/InspectorTimelineAgent.h:
* inspector/TimelineRecordFactory.cpp:
(WebCore::TimelineRecordFactory::createXHRReadyStateChangeData): Deleted.
(WebCore::TimelineRecordFactory::createXHRLoadData): Deleted.
* inspector/TimelineRecordFactory.h:
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::callReadyStateChangeListener): Deleted.

Source/WebInspectorUI:

* UserInterface/Controllers/TimelineManager.js:
(WebInspector.TimelineManager.prototype._processRecord):
Remove unused events and add an assert that we don't miss
any script embedders.

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

12 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/protocol/Timeline.json
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/inspector/InspectorTimelineAgent.cpp
Source/WebCore/inspector/InspectorTimelineAgent.h
Source/WebCore/inspector/TimelineRecordFactory.cpp
Source/WebCore/inspector/TimelineRecordFactory.h
Source/WebCore/xml/XMLHttpRequest.cpp
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js

index 3149ffb..13ef788 100644 (file)
@@ -1,3 +1,12 @@
+2015-10-27  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Remove unused / duplicated XHR timeline instrumentation
+        https://bugs.webkit.org/show_bug.cgi?id=150605
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/protocol/Timeline.json:
+
 2015-10-27  Michael Saboff  <msaboff@apple.com>
 
         REGRESSION (r191360): Crash: com.apple.WebKit.WebContent at com.apple.JavaScriptCore: JSC::FTL:: + 386
index d6b41c5..eadf275 100644 (file)
@@ -25,8 +25,6 @@
                 "TimeStamp",
                 "Time",
                 "TimeEnd",
-                "XHRReadyStateChange",
-                "XHRLoad",
                 "FunctionCall",
                 "ProbeSample",
                 "ConsoleProfile",
index ed77b5b..fd84169 100644 (file)
@@ -1,5 +1,41 @@
 2015-10-27  Joseph Pecoraro  <pecoraro@apple.com>
 
+        Web Inspector: Remove unused / duplicated XHR timeline instrumentation
+        https://bugs.webkit.org/show_bug.cgi?id=150605
+
+        Reviewed by Timothy Hatcher.
+
+        These records are just duplicates of "EventDispatch" records for XHR
+        load and readystatechange events. Due to the nesting, the XHR records
+        were themselves never getting looked at, and their data (URL / readyState)
+        not shown in the frontend.
+
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore::InspectorInstrumentation::willDispatchXHRReadyStateChangeEventImpl): Deleted.
+        (WebCore::InspectorInstrumentation::didDispatchXHRReadyStateChangeEventImpl): Deleted.
+        (WebCore::InspectorInstrumentation::willDispatchXHRLoadEventImpl): Deleted.
+        (WebCore::InspectorInstrumentation::didDispatchXHRLoadEventImpl): Deleted.
+        * inspector/InspectorInstrumentation.h:
+        (WebCore::InspectorInstrumentation::willDispatchXHRReadyStateChangeEvent): Deleted.
+        (WebCore::InspectorInstrumentation::didDispatchXHRReadyStateChangeEvent): Deleted.
+        (WebCore::InspectorInstrumentation::willDispatchXHRLoadEvent): Deleted.
+        (WebCore::InspectorInstrumentation::didDispatchXHRLoadEvent): Deleted.
+        * inspector/InspectorTimelineAgent.cpp:
+        (WebCore::InspectorTimelineAgent::willDispatchXHRReadyStateChangeEvent): Deleted.
+        (WebCore::InspectorTimelineAgent::didDispatchXHRReadyStateChangeEvent): Deleted.
+        (WebCore::InspectorTimelineAgent::willDispatchXHRLoadEvent): Deleted.
+        (WebCore::InspectorTimelineAgent::didDispatchXHRLoadEvent): Deleted.
+        (WebCore::toProtocol): Deleted.
+        * inspector/InspectorTimelineAgent.h:
+        * inspector/TimelineRecordFactory.cpp:
+        (WebCore::TimelineRecordFactory::createXHRReadyStateChangeData): Deleted.
+        (WebCore::TimelineRecordFactory::createXHRLoadData): Deleted.
+        * inspector/TimelineRecordFactory.h:
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::callReadyStateChangeListener): Deleted.
+
+2015-10-27  Joseph Pecoraro  <pecoraro@apple.com>
+
         Web Inspector: Do not send RenderingFrame TimelineRecords that have no children
         https://bugs.webkit.org/show_bug.cgi?id=150600
 
index fdbec7c..06b5548 100644 (file)
@@ -345,23 +345,6 @@ void InspectorInstrumentation::didCallFunctionImpl(const InspectorInstrumentatio
         timelineAgent->didCallFunction(frameForScriptExecutionContext(context));
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willDispatchXHRReadyStateChangeEventImpl(InstrumentingAgents& instrumentingAgents, XMLHttpRequest& request, ScriptExecutionContext* context)
-{
-    int timelineAgentId = 0;
-    InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent();
-    if (timelineAgent && request.hasEventListeners(eventNames().readystatechangeEvent)) {
-        timelineAgent->willDispatchXHRReadyStateChangeEvent(request.url().string(), request.readyState(), frameForScriptExecutionContext(context));
-        timelineAgentId = timelineAgent->id();
-    }
-    return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
-}
-
-void InspectorInstrumentation::didDispatchXHRReadyStateChangeEventImpl(const InspectorInstrumentationCookie& cookie)
-{
-    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
-        timelineAgent->didDispatchXHRReadyStateChangeEvent();
-}
-
 InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventImpl(InstrumentingAgents& instrumentingAgents, Document& document, const Event& event, bool hasEventListeners)
 {
     int timelineAgentId = 0;
@@ -484,23 +467,6 @@ void InspectorInstrumentation::didLayoutImpl(const InspectorInstrumentationCooki
         pageAgent->didLayout();
 }
 
-InspectorInstrumentationCookie InspectorInstrumentation::willDispatchXHRLoadEventImpl(InstrumentingAgents& instrumentingAgents, XMLHttpRequest& request, ScriptExecutionContext* context)
-{
-    int timelineAgentId = 0;
-    InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent();
-    if (timelineAgent && request.hasEventListeners(eventNames().loadEvent)) {
-        timelineAgent->willDispatchXHRLoadEvent(request.url(), frameForScriptExecutionContext(context));
-        timelineAgentId = timelineAgent->id();
-    }
-    return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
-}
-
-void InspectorInstrumentation::didDispatchXHRLoadEventImpl(const InspectorInstrumentationCookie& cookie)
-{
-    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
-        timelineAgent->didDispatchXHRLoadEvent();
-}
-
 void InspectorInstrumentation::willCompositeImpl(InstrumentingAgents& instrumentingAgents, Frame& frame)
 {
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
index 97ff364..4a3bda5 100644 (file)
@@ -146,8 +146,6 @@ public:
 
     static InspectorInstrumentationCookie willCallFunction(ScriptExecutionContext*, const String& scriptName, int scriptLine);
     static void didCallFunction(const InspectorInstrumentationCookie&, ScriptExecutionContext*);
-    static InspectorInstrumentationCookie willDispatchXHRReadyStateChangeEvent(ScriptExecutionContext*, XMLHttpRequest&);
-    static void didDispatchXHRReadyStateChangeEvent(const InspectorInstrumentationCookie&);
     static InspectorInstrumentationCookie willDispatchEvent(Document&, const Event&, bool hasEventListeners);
     static void didDispatchEvent(const InspectorInstrumentationCookie&);
     static InspectorInstrumentationCookie willHandleEvent(ScriptExecutionContext*, const Event&);
@@ -163,8 +161,6 @@ public:
     static InspectorInstrumentationCookie willLayout(Frame&);
     static void didLayout(const InspectorInstrumentationCookie&, RenderObject*);
     static void didScroll(Page&);
-    static InspectorInstrumentationCookie willDispatchXHRLoadEvent(ScriptExecutionContext*, XMLHttpRequest&);
-    static void didDispatchXHRLoadEvent(const InspectorInstrumentationCookie&);
     static void willComposite(Frame&);
     static void didComposite(Frame&);
     static void willPaint(RenderObject*);
@@ -327,8 +323,6 @@ private:
 
     static InspectorInstrumentationCookie willCallFunctionImpl(InstrumentingAgents&, const String& scriptName, int scriptLine, ScriptExecutionContext*);
     static void didCallFunctionImpl(const InspectorInstrumentationCookie&, ScriptExecutionContext*);
-    static InspectorInstrumentationCookie willDispatchXHRReadyStateChangeEventImpl(InstrumentingAgents&, XMLHttpRequest&, ScriptExecutionContext*);
-    static void didDispatchXHRReadyStateChangeEventImpl(const InspectorInstrumentationCookie&);
     static InspectorInstrumentationCookie willDispatchEventImpl(InstrumentingAgents&, Document&, const Event&, bool hasEventListeners);
     static InspectorInstrumentationCookie willHandleEventImpl(InstrumentingAgents&, const Event&);
     static void didHandleEventImpl(const InspectorInstrumentationCookie&);
@@ -344,8 +338,6 @@ private:
     static InspectorInstrumentationCookie willLayoutImpl(InstrumentingAgents&, Frame&);
     static void didLayoutImpl(const InspectorInstrumentationCookie&, RenderObject*);
     static void didScrollImpl(InstrumentingAgents&);
-    static InspectorInstrumentationCookie willDispatchXHRLoadEventImpl(InstrumentingAgents&, XMLHttpRequest&, ScriptExecutionContext*);
-    static void didDispatchXHRLoadEventImpl(const InspectorInstrumentationCookie&);
     static void willCompositeImpl(InstrumentingAgents&, Frame&);
     static void didCompositeImpl(InstrumentingAgents&);
     static void willPaintImpl(InstrumentingAgents&, RenderObject*);
@@ -705,21 +697,6 @@ inline void InspectorInstrumentation::didCallFunction(const InspectorInstrumenta
         didCallFunctionImpl(cookie, context);
 }
 
-inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchXHRReadyStateChangeEvent(ScriptExecutionContext* context, XMLHttpRequest& request)
-{
-    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        return willDispatchXHRReadyStateChangeEventImpl(*instrumentingAgents, request, context);
-    return InspectorInstrumentationCookie();
-}
-
-inline void InspectorInstrumentation::didDispatchXHRReadyStateChangeEvent(const InspectorInstrumentationCookie& cookie)
-{
-    FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.isValid())
-        didDispatchXHRReadyStateChangeEventImpl(cookie);
-}
-
 inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEvent(Document& document, const Event& event, bool hasEventListeners)
 {
     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
@@ -829,21 +806,6 @@ inline void InspectorInstrumentation::didScroll(Page& page)
     didScrollImpl(instrumentingAgentsForPage(page));
 }
 
-inline InspectorInstrumentationCookie InspectorInstrumentation::willDispatchXHRLoadEvent(ScriptExecutionContext* context, XMLHttpRequest& request)
-{
-    FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
-        return willDispatchXHRLoadEventImpl(*instrumentingAgents, request, context);
-    return InspectorInstrumentationCookie();
-}
-
-inline void InspectorInstrumentation::didDispatchXHRLoadEvent(const InspectorInstrumentationCookie& cookie)
-{
-    FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (cookie.isValid())
-        didDispatchXHRLoadEventImpl(cookie);
-}
-
 inline void InspectorInstrumentation::willComposite(Frame& frame)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
index f633334..f57c25c 100644 (file)
@@ -449,26 +449,6 @@ void InspectorTimelineAgent::didFireTimer()
     didCompleteCurrentRecord(TimelineRecordType::TimerFire);
 }
 
-void InspectorTimelineAgent::willDispatchXHRReadyStateChangeEvent(const String& url, int readyState, Frame* frame)
-{
-    pushCurrentRecord(TimelineRecordFactory::createXHRReadyStateChangeData(url, readyState), TimelineRecordType::XHRReadyStateChange, false, frame);
-}
-
-void InspectorTimelineAgent::didDispatchXHRReadyStateChangeEvent()
-{
-    didCompleteCurrentRecord(TimelineRecordType::XHRReadyStateChange);
-}
-
-void InspectorTimelineAgent::willDispatchXHRLoadEvent(const String& url, Frame* frame)
-{
-    pushCurrentRecord(TimelineRecordFactory::createXHRLoadData(url), TimelineRecordType::XHRLoad, true, frame);
-}
-
-void InspectorTimelineAgent::didDispatchXHRLoadEvent()
-{
-    didCompleteCurrentRecord(TimelineRecordType::XHRLoad);
-}
-
 void InspectorTimelineAgent::willEvaluateScript(const String& url, int lineNumber, Frame& frame)
 {
     pushCurrentRecord(TimelineRecordFactory::createEvaluateScriptData(url, lineNumber), TimelineRecordType::EvaluateScript, true, &frame);
@@ -628,11 +608,6 @@ static Inspector::Protocol::Timeline::EventType toProtocol(TimelineRecordType ty
     case TimelineRecordType::TimeEnd:
         return Inspector::Protocol::Timeline::EventType::TimeEnd;
 
-    case TimelineRecordType::XHRReadyStateChange:
-        return Inspector::Protocol::Timeline::EventType::XHRReadyStateChange;
-    case TimelineRecordType::XHRLoad:
-        return Inspector::Protocol::Timeline::EventType::XHRLoad;
-
     case TimelineRecordType::FunctionCall:
         return Inspector::Protocol::Timeline::EventType::FunctionCall;
     case TimelineRecordType::ProbeSample:
index 95c9745..c240bae 100644 (file)
@@ -89,9 +89,6 @@ enum class TimelineRecordType {
     Time,
     TimeEnd,
 
-    XHRReadyStateChange,
-    XHRLoad,
-
     FunctionCall,
     ProbeSample,
     ConsoleProfile,
@@ -141,8 +138,6 @@ public:
     void didFireTimer();
     void willCallFunction(const String& scriptName, int scriptLine, Frame*);
     void didCallFunction(Frame*);
-    void willDispatchXHRReadyStateChangeEvent(const String&, int, Frame*);
-    void didDispatchXHRReadyStateChangeEvent();
     void willDispatchEvent(const Event&, Frame*);
     void didDispatchEvent();
     void willEvaluateScript(const String&, int, Frame&);
@@ -150,8 +145,6 @@ public:
     void didInvalidateLayout(Frame&);
     void willLayout(Frame&);
     void didLayout(RenderObject*);
-    void willDispatchXHRLoadEvent(const String&, Frame*);
-    void didDispatchXHRLoadEvent();
     void willComposite(Frame&);
     void didComposite();
     void willPaint(Frame&);
index ccdb9cb..5dc3394 100644 (file)
@@ -116,21 +116,6 @@ Ref<InspectorObject> TimelineRecordFactory::createTimerInstallData(int timerId,
     return WTF::move(data);
 }
 
-Ref<InspectorObject> TimelineRecordFactory::createXHRReadyStateChangeData(const String& url, int readyState)
-{
-    Ref<InspectorObject> data = InspectorObject::create();
-    data->setString("url", url);
-    data->setInteger("readyState", readyState);
-    return WTF::move(data);
-}
-
-Ref<InspectorObject> TimelineRecordFactory::createXHRLoadData(const String& url)
-{
-    Ref<InspectorObject> data = InspectorObject::create();
-    data->setString("url", url);
-    return WTF::move(data);
-}
-
 Ref<InspectorObject> TimelineRecordFactory::createEvaluateScriptData(const String& url, double lineNumber)
 {
     Ref<InspectorObject> data = InspectorObject::create();
index 6bd19fb..5a90fe3 100644 (file)
@@ -69,10 +69,6 @@ namespace WebCore {
 
         static Ref<Inspector::InspectorObject> createTimerInstallData(int timerId, int timeout, bool singleShot);
 
-        static Ref<Inspector::InspectorObject> createXHRReadyStateChangeData(const String& url, int readyState);
-
-        static Ref<Inspector::InspectorObject> createXHRLoadData(const String& url);
-
         static Ref<Inspector::InspectorObject> createEvaluateScriptData(const String&, double lineNumber);
 
         static Ref<Inspector::InspectorObject> createTimeStampData(const String&);
index d6428fe..0e27b25 100644 (file)
@@ -373,16 +373,11 @@ void XMLHttpRequest::callReadyStateChangeListener()
     if (!scriptExecutionContext())
         return;
 
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchXHRReadyStateChangeEvent(scriptExecutionContext(), *this);
-
     if (m_async || (m_state <= OPENED || m_state == DONE))
         m_progressEventThrottle.dispatchReadyStateChangeEvent(Event::create(eventNames().readystatechangeEvent, false, false), m_state == DONE ? FlushProgressEvent : DoNotFlushProgressEvent);
 
-    InspectorInstrumentation::didDispatchXHRReadyStateChangeEvent(cookie);
     if (m_state == DONE && !m_error) {
-        InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchXHRLoadEvent(scriptExecutionContext(), *this);
         m_progressEventThrottle.dispatchProgressEvent(eventNames().loadEvent);
-        InspectorInstrumentation::didDispatchXHRLoadEvent(cookie);
         m_progressEventThrottle.dispatchProgressEvent(eventNames().loadendEvent);
     }
 }
index 41afd11..9085573 100644 (file)
@@ -1,3 +1,15 @@
+2015-10-27  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Remove unused / duplicated XHR timeline instrumentation
+        https://bugs.webkit.org/show_bug.cgi?id=150605
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Controllers/TimelineManager.js:
+        (WebInspector.TimelineManager.prototype._processRecord):
+        Remove unused events and add an assert that we don't miss
+        any script embedders.
+
 2015-10-27  Matt Baker  <mattbaker@apple.com>
 
         REGRESSION: Web Inspector: DOM path bar blinks when modifying inline styles
index 2d4cd55..21b9569 100644 (file)
@@ -343,12 +343,10 @@ WebInspector.TimelineManager = class TimelineManager extends WebInspector.Object
                 return new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.TimerFired, startTime, endTime, callFrames, sourceCodeLocation, parentRecordPayload.data.timerId, profileData);
             case TimelineAgent.EventType.EventDispatch:
                 return new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.EventDispatched, startTime, endTime, callFrames, sourceCodeLocation, parentRecordPayload.data.type, profileData);
-            case TimelineAgent.EventType.XHRLoad:
-                return new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.EventDispatched, startTime, endTime, callFrames, sourceCodeLocation, "load", profileData);
-            case TimelineAgent.EventType.XHRReadyStateChange:
-                return new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.EventDispatched, startTime, endTime, callFrames, sourceCodeLocation, "readystatechange", profileData);
             case TimelineAgent.EventType.FireAnimationFrame:
                 return new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.AnimationFrameFired, startTime, endTime, callFrames, sourceCodeLocation, parentRecordPayload.data.id, profileData);
+            default:
+                console.assert(false, "Missed FunctionCall embedded inside of: " + parentRecordPayload.type);
             }
 
             break;