https://bugs.webkit.org/show_bug.cgi?id=150660
Patch by Joseph Pecoraro <pecoraro@apple.com> on 2015-10-29
Reviewed by Brian Burg.
Source/WebCore:
Cleanup included removing unused methods and payload data that the
frontend wasn't likely to use. Also added ASCIILiteral and removed
unnecessary includes.
* inspector/InspectorNetworkAgent.cpp:
* inspector/InspectorPageAgent.cpp:
* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::willLayout):
* inspector/InspectorTimelineAgent.h:
* inspector/TimelineRecordFactory.cpp:
(WebCore::TimelineRecordFactory::createGenericRecord):
(WebCore::TimelineRecordFactory::createFunctionCallData):
(WebCore::TimelineRecordFactory::createConsoleProfileData):
(WebCore::TimelineRecordFactory::createEventDispatchData):
(WebCore::TimelineRecordFactory::createGenericTimerData):
(WebCore::TimelineRecordFactory::createTimerInstallData):
(WebCore::TimelineRecordFactory::createEvaluateScriptData):
(WebCore::TimelineRecordFactory::createTimeStampData):
(WebCore::TimelineRecordFactory::createParseHTMLData):
(WebCore::TimelineRecordFactory::createAnimationFrameData):
(WebCore::TimelineRecordFactory::createPaintData):
(WebCore::TimelineRecordFactory::appendLayoutRoot):
(WebCore::TimelineRecordFactory::createBackgroundRecord): Deleted.
(WebCore::TimelineRecordFactory::createLayoutData): Deleted.
* inspector/TimelineRecordFactory.h:
(WebCore::TimelineRecordFactory::TimelineRecordFactory):
Source/WebInspectorUI:
* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Controllers/TimelineManager.js:
(WebInspector.TimelineManager.prototype._processRecord):
(WebInspector.TimelineManager.prototype._processEvent):
Add FIXME for payload data which we are not yet using but could.
Fix typo in some rAF records where we were mistakenly using "timerId"
instead of "id" for the request identifier.
* UserInterface/Models/ScriptTimelineRecord.js:
(WebInspector.ScriptTimelineRecord.EventType.displayName):
Display the now correctly accessed rAF identifier in the Scripts timeline.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191732
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2015-10-29 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Clean up and audit TimelineRecordFactory records
+ https://bugs.webkit.org/show_bug.cgi?id=150660
+
+ Reviewed by Brian Burg.
+
+ Cleanup included removing unused methods and payload data that the
+ frontend wasn't likely to use. Also added ASCIILiteral and removed
+ unnecessary includes.
+
+ * inspector/InspectorNetworkAgent.cpp:
+ * inspector/InspectorPageAgent.cpp:
+ * inspector/InspectorTimelineAgent.cpp:
+ (WebCore::InspectorTimelineAgent::willLayout):
+ * inspector/InspectorTimelineAgent.h:
+ * inspector/TimelineRecordFactory.cpp:
+ (WebCore::TimelineRecordFactory::createGenericRecord):
+ (WebCore::TimelineRecordFactory::createFunctionCallData):
+ (WebCore::TimelineRecordFactory::createConsoleProfileData):
+ (WebCore::TimelineRecordFactory::createEventDispatchData):
+ (WebCore::TimelineRecordFactory::createGenericTimerData):
+ (WebCore::TimelineRecordFactory::createTimerInstallData):
+ (WebCore::TimelineRecordFactory::createEvaluateScriptData):
+ (WebCore::TimelineRecordFactory::createTimeStampData):
+ (WebCore::TimelineRecordFactory::createParseHTMLData):
+ (WebCore::TimelineRecordFactory::createAnimationFrameData):
+ (WebCore::TimelineRecordFactory::createPaintData):
+ (WebCore::TimelineRecordFactory::appendLayoutRoot):
+ (WebCore::TimelineRecordFactory::createBackgroundRecord): Deleted.
+ (WebCore::TimelineRecordFactory::createLayoutData): Deleted.
+ * inspector/TimelineRecordFactory.h:
+ (WebCore::TimelineRecordFactory::TimelineRecordFactory):
+
2015-10-29 Said Abou-Hallawa <sabouhallawa@apple.com>
Exploitable crash happens when an SVG contains an indirect resource inheritance cycle
#include <inspector/ScriptCallStack.h>
#include <inspector/ScriptCallStackFactory.h>
#include <wtf/RefPtr.h>
+#include <wtf/Stopwatch.h>
#include <wtf/text/StringBuilder.h>
using namespace Inspector;
#include <inspector/IdentifiersFactory.h>
#include <inspector/InspectorValues.h>
#include <wtf/ListHashSet.h>
+#include <wtf/Stopwatch.h>
#include <wtf/text/Base64.h>
#include <wtf/text/StringBuilder.h>
#include <yarr/RegularExpression.h>
#include "Event.h"
#include "Frame.h"
-#include "FrameView.h"
#include "InspectorPageAgent.h"
#include "InstrumentingAgents.h"
-#include "IntRect.h"
#include "JSDOMWindow.h"
-#include "MainFrame.h"
#include "PageScriptDebugServer.h"
-#include "RenderElement.h"
#include "RenderView.h"
-#include "ResourceRequest.h"
-#include "ResourceResponse.h"
#include "ScriptState.h"
#include "TimelineRecordFactory.h"
-#include <inspector/IdentifiersFactory.h>
#include <inspector/ScriptBreakpoint.h>
#include <profiler/LegacyProfiler.h>
-#include <wtf/CurrentTime.h>
+#include <wtf/Stopwatch.h>
#if PLATFORM(IOS)
#include "RuntimeApplicationChecksIOS.h"
void InspectorTimelineAgent::willLayout(Frame& frame)
{
- auto* root = frame.view()->layoutRoot();
- bool partialLayout = !!root;
-
- if (!partialLayout)
- root = frame.contentRenderer();
-
- unsigned dirtyObjects = 0;
- unsigned totalObjects = 0;
- for (RenderObject* o = root; o; o = o->nextInPreOrder(root)) {
- ++totalObjects;
- if (o->needsLayout())
- ++dirtyObjects;
- }
- pushCurrentRecord(TimelineRecordFactory::createLayoutData(dirtyObjects, totalObjects, partialLayout), TimelineRecordType::Layout, true, &frame);
+ pushCurrentRecord(InspectorObject::create(), TimelineRecordType::Layout, true, &frame);
}
void InspectorTimelineAgent::didLayout(RenderObject* root)
#include <inspector/InspectorFrontendDispatchers.h>
#include <inspector/InspectorValues.h>
#include <inspector/ScriptDebugListener.h>
-#include <wtf/Stopwatch.h>
#include <wtf/Vector.h>
-#include <wtf/WeakPtr.h>
namespace JSC {
class Profile;
class FloatQuad;
class Frame;
class InspectorPageAgent;
-class IntRect;
-class URL;
-class Page;
class PageScriptDebugServer;
class RenderObject;
-class ResourceRequest;
-class ResourceResponse;
class RunLoopObserver;
typedef String ErrorString;
#include "Event.h"
#include "FloatQuad.h"
-#include "IntRect.h"
#include "JSMainThreadExecState.h"
-#include "LayoutRect.h"
-#include "ResourceRequest.h"
-#include "ResourceResponse.h"
#include <inspector/InspectorProtocolObjects.h>
#include <inspector/ScriptBreakpoint.h>
#include <inspector/ScriptCallStack.h>
Ref<InspectorObject> TimelineRecordFactory::createGenericRecord(double startTime, int maxCallStackDepth)
{
Ref<InspectorObject> record = InspectorObject::create();
- record->setDouble("startTime", startTime);
+ record->setDouble(ASCIILiteral("startTime"), startTime);
if (maxCallStackDepth) {
RefPtr<ScriptCallStack> stackTrace = createScriptCallStack(JSMainThreadExecState::currentState(), maxCallStackDepth);
if (stackTrace && stackTrace->size())
- record->setValue("stackTrace", stackTrace->buildInspectorArray());
+ record->setValue(ASCIILiteral("stackTrace"), stackTrace->buildInspectorArray());
}
return WTF::move(record);
}
-Ref<InspectorObject> TimelineRecordFactory::createBackgroundRecord(double startTime, const String& threadName)
-{
- Ref<InspectorObject> record = InspectorObject::create();
- record->setDouble("startTime", startTime);
- record->setString("thread", threadName);
- return WTF::move(record);
-}
-
Ref<InspectorObject> TimelineRecordFactory::createFunctionCallData(const String& scriptName, int scriptLine)
{
Ref<InspectorObject> data = InspectorObject::create();
- data->setString("scriptName", scriptName);
- data->setInteger("scriptLine", scriptLine);
+ data->setString(ASCIILiteral("scriptName"), scriptName);
+ data->setInteger(ASCIILiteral("scriptLine"), scriptLine);
return WTF::move(data);
}
Ref<InspectorObject> TimelineRecordFactory::createConsoleProfileData(const String& title)
{
Ref<InspectorObject> data = InspectorObject::create();
- data->setString("title", title);
+ data->setString(ASCIILiteral("title"), title);
return WTF::move(data);
}
Ref<InspectorObject> TimelineRecordFactory::createEventDispatchData(const Event& event)
{
Ref<InspectorObject> data = InspectorObject::create();
- data->setString("type", event.type().string());
+ data->setString(ASCIILiteral("type"), event.type().string());
return WTF::move(data);
}
Ref<InspectorObject> TimelineRecordFactory::createGenericTimerData(int timerId)
{
Ref<InspectorObject> data = InspectorObject::create();
- data->setInteger("timerId", timerId);
+ data->setInteger(ASCIILiteral("timerId"), timerId);
return WTF::move(data);
}
Ref<InspectorObject> TimelineRecordFactory::createTimerInstallData(int timerId, int timeout, bool singleShot)
{
Ref<InspectorObject> data = InspectorObject::create();
- data->setInteger("timerId", timerId);
- data->setInteger("timeout", timeout);
- data->setBoolean("singleShot", singleShot);
+ data->setInteger(ASCIILiteral("timerId"), timerId);
+ data->setInteger(ASCIILiteral("timeout"), timeout);
+ data->setBoolean(ASCIILiteral("singleShot"), singleShot);
return WTF::move(data);
}
Ref<InspectorObject> TimelineRecordFactory::createEvaluateScriptData(const String& url, double lineNumber)
{
Ref<InspectorObject> data = InspectorObject::create();
- data->setString("url", url);
- data->setInteger("lineNumber", lineNumber);
+ data->setString(ASCIILiteral("url"), url);
+ data->setInteger(ASCIILiteral("lineNumber"), lineNumber);
return WTF::move(data);
}
Ref<InspectorObject> TimelineRecordFactory::createTimeStampData(const String& message)
{
Ref<InspectorObject> data = InspectorObject::create();
- data->setString("message", message);
- return WTF::move(data);
-}
-
-Ref<InspectorObject> TimelineRecordFactory::createLayoutData(unsigned dirtyObjects, unsigned totalObjects, bool partialLayout)
-{
- Ref<InspectorObject> data = InspectorObject::create();
- data->setInteger("dirtyObjects", dirtyObjects);
- data->setInteger("totalObjects", totalObjects);
- data->setBoolean("partialLayout", partialLayout);
+ data->setString(ASCIILiteral("message"), message);
return WTF::move(data);
}
Ref<InspectorObject> TimelineRecordFactory::createParseHTMLData(unsigned startLine)
{
Ref<InspectorObject> data = InspectorObject::create();
- data->setInteger("startLine", startLine);
+ data->setInteger(ASCIILiteral("startLine"), startLine);
return WTF::move(data);
}
Ref<InspectorObject> TimelineRecordFactory::createAnimationFrameData(int callbackId)
{
Ref<InspectorObject> data = InspectorObject::create();
- data->setInteger("id", callbackId);
+ data->setInteger(ASCIILiteral("id"), callbackId);
return WTF::move(data);
}
Ref<InspectorObject> TimelineRecordFactory::createPaintData(const FloatQuad& quad)
{
Ref<InspectorObject> data = InspectorObject::create();
- data->setArray("clip", createQuad(quad));
+ data->setArray(ASCIILiteral("clip"), createQuad(quad));
return WTF::move(data);
}
void TimelineRecordFactory::appendLayoutRoot(InspectorObject* data, const FloatQuad& quad)
{
- data->setArray("root", createQuad(quad));
+ data->setArray(ASCIILiteral("root"), createQuad(quad));
}
static Ref<Protocol::Timeline::CPUProfileNodeAggregateCallInfo> buildAggregateCallInfoInspectorObject(const JSC::ProfileNode* node)
#ifndef TimelineRecordFactory_h
#define TimelineRecordFactory_h
-#include "URL.h"
#include <inspector/InspectorValues.h>
#include <wtf/Forward.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
- class Event;
- class FloatQuad;
- class ResourceRequest;
- class ResourceResponse;
- class ScriptProfile;
-
- class TimelineRecordFactory {
- public:
- static Ref<Inspector::InspectorObject> createGenericRecord(double startTime, int maxCallStackDepth);
- static Ref<Inspector::InspectorObject> createBackgroundRecord(double startTime, const String& thread);
-
- static Ref<Inspector::InspectorObject> createFunctionCallData(const String& scriptName, int scriptLine);
- static Ref<Inspector::InspectorObject> createConsoleProfileData(const String& title);
-
- static Ref<Inspector::InspectorObject> createProbeSampleData(const Inspector::ScriptBreakpointAction&, unsigned sampleId);
-
- static Ref<Inspector::InspectorObject> createEventDispatchData(const Event&);
-
- static Ref<Inspector::InspectorObject> createGenericTimerData(int timerId);
-
- static Ref<Inspector::InspectorObject> createTimerInstallData(int timerId, int timeout, bool singleShot);
-
- static Ref<Inspector::InspectorObject> createEvaluateScriptData(const String&, double lineNumber);
-
- static Ref<Inspector::InspectorObject> createTimeStampData(const String&);
-
- static Ref<Inspector::InspectorObject> createLayoutData(unsigned dirtyObjects, unsigned totalObjects, bool partialLayout);
-
- static Ref<Inspector::InspectorObject> createParseHTMLData(unsigned startLine);
-
- static Ref<Inspector::InspectorObject> createAnimationFrameData(int callbackId);
-
- static Ref<Inspector::InspectorObject> createPaintData(const FloatQuad&);
-
- static void appendLayoutRoot(Inspector::InspectorObject* data, const FloatQuad&);
-
- static void appendProfile(Inspector::InspectorObject*, RefPtr<JSC::Profile>&&);
-
- private:
- TimelineRecordFactory() { }
- };
+class Event;
+class FloatQuad;
+
+class TimelineRecordFactory {
+public:
+ static Ref<Inspector::InspectorObject> createGenericRecord(double startTime, int maxCallStackDepth);
+
+ static Ref<Inspector::InspectorObject> createFunctionCallData(const String& scriptName, int scriptLine);
+ static Ref<Inspector::InspectorObject> createConsoleProfileData(const String& title);
+ static Ref<Inspector::InspectorObject> createProbeSampleData(const Inspector::ScriptBreakpointAction&, unsigned sampleId);
+ static Ref<Inspector::InspectorObject> createEventDispatchData(const Event&);
+ static Ref<Inspector::InspectorObject> createGenericTimerData(int timerId);
+ static Ref<Inspector::InspectorObject> createTimerInstallData(int timerId, int timeout, bool singleShot);
+ static Ref<Inspector::InspectorObject> createEvaluateScriptData(const String&, double lineNumber);
+ static Ref<Inspector::InspectorObject> createTimeStampData(const String&);
+ static Ref<Inspector::InspectorObject> createParseHTMLData(unsigned startLine);
+ static Ref<Inspector::InspectorObject> createAnimationFrameData(int callbackId);
+ static Ref<Inspector::InspectorObject> createPaintData(const FloatQuad&);
+
+ static void appendLayoutRoot(Inspector::InspectorObject* data, const FloatQuad&);
+ static void appendProfile(Inspector::InspectorObject*, RefPtr<JSC::Profile>&&);
+
+private:
+ TimelineRecordFactory() { }
+};
} // namespace WebCore
+2015-10-29 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Clean up and audit TimelineRecordFactory records
+ https://bugs.webkit.org/show_bug.cgi?id=150660
+
+ Reviewed by Brian Burg.
+
+ * Localizations/en.lproj/localizedStrings.js:
+ * UserInterface/Controllers/TimelineManager.js:
+ (WebInspector.TimelineManager.prototype._processRecord):
+ (WebInspector.TimelineManager.prototype._processEvent):
+ Add FIXME for payload data which we are not yet using but could.
+ Fix typo in some rAF records where we were mistakenly using "timerId"
+ instead of "id" for the request identifier.
+
+ * UserInterface/Models/ScriptTimelineRecord.js:
+ (WebInspector.ScriptTimelineRecord.EventType.displayName):
+ Display the now correctly accessed rAF identifier in the Scripts timeline.
+
2015-10-28 Joseph Pecoraro <pecoraro@apple.com>
Web Inspector: Add "revert" to CSS value autocompletion
console.assert(isNaN(endTime));
// Pass the startTime as the endTime since this record type has no duration.
+ // FIXME: Make use of "timeout" and "singleShot" payload properties.
return new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.TimerInstalled, startTime, startTime, callFrames, sourceCodeLocation, recordPayload.data.timerId);
case TimelineAgent.EventType.TimerRemove:
console.assert(isNaN(endTime));
// Pass the startTime as the endTime since this record type has no duration.
- return new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.AnimationFrameRequested, startTime, startTime, callFrames, sourceCodeLocation, recordPayload.data.timerId);
+ return new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.AnimationFrameRequested, startTime, startTime, callFrames, sourceCodeLocation, recordPayload.data.id);
case TimelineAgent.EventType.CancelAnimationFrame:
console.assert(isNaN(endTime));
// Pass the startTime as the endTime since this record type has no duration.
- return new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.AnimationFrameCanceled, startTime, startTime, callFrames, sourceCodeLocation, recordPayload.data.timerId);
+ return new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.AnimationFrameCanceled, startTime, startTime, callFrames, sourceCodeLocation, recordPayload.data.id);
}
return null;
{
switch (recordPayload.type) {
case TimelineAgent.EventType.TimeStamp:
+ // FIXME: Make use of "message" payload properties.
var timestamp = this.activeRecording.computeElapsedTime(recordPayload.startTime);
var eventMarker = new WebInspector.TimelineMarker(timestamp, WebInspector.TimelineMarker.Type.TimeStamp);
this._activeRecording.addEventMarker(eventMarker);
return WebInspector.UIString("Timer %s Removed").format(details);
return WebInspector.UIString("Timer Removed");
case WebInspector.ScriptTimelineRecord.EventType.AnimationFrameFired:
+ if (details && includeDetailsInMainTitle)
+ return WebInspector.UIString("Animation Frame %s Fired").format(details);
return WebInspector.UIString("Animation Frame Fired");
case WebInspector.ScriptTimelineRecord.EventType.AnimationFrameRequested:
+ if (details && includeDetailsInMainTitle)
+ return WebInspector.UIString("Animation Frame %s Requested").format(details);
return WebInspector.UIString("Animation Frame Requested");
case WebInspector.ScriptTimelineRecord.EventType.AnimationFrameCanceled:
+ if (details && includeDetailsInMainTitle)
+ return WebInspector.UIString("Animation Frame %s Canceled").format(details);
return WebInspector.UIString("Animation Frame Canceled");
}
};