Commit 18911405 authored by bburg@apple.com's avatar bburg@apple.com

Web Inspector: capture probe samples on the backend

https://bugs.webkit.org/show_bug.cgi?id=126668

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

Add the 'probe' breakpoint action to the protocol. Change the setBreakpoint
commands to return a list of assigned breakpoint action identifiers
Add a type for breakpoint action identifiers. Add an event for sending
captured probe samples to the inspector frontend.

* inspector/protocol/Debugger.json:

Source/WebCore:

Test: inspector-protocol/debugger/setProbe-multiple-actions.html

Add the probe breakpoint action type. A probe action
evaluates an expression on the script call frame, and
the result is aggregated on a per-probe basis. Each
evaluated expression result is called a probe sample.

* bindings/js/ScriptDebugServer.cpp:
(WebCore::ScriptDebugServer::evaluateBreakpointAction): Teach
the debug server to evaluate a probe.

(WebCore::ScriptDebugServer::dispatchDidSampleProbe): Added.
(WebCore::ScriptDebugServer::handleBreakpointHit): Increment a hit count.
(WebCore::ScriptDebugServer::getActionsForBreakpoint):
* bindings/js/ScriptDebugServer.h:
* inspector/InspectorDebuggerAgent.cpp:
(WebCore::objectGroupForBreakpointAction): Added. Create an object
group for each breakpoint action. Currently only probes make objects.
(WebCore::InspectorDebuggerAgent::InspectorDebuggerAgent):
(WebCore::InspectorDebuggerAgent::disable):
(WebCore::InspectorDebuggerAgent::enable): Remove stale comment.
(WebCore::breakpointActionTypeForString): Add new case.
(WebCore::InspectorDebuggerAgent::breakpointActionsFromProtocol): Make
this a member function instead of a static function, so it can increment
the breakpoint action identifier counter.
(WebCore::InspectorDebuggerAgent::setBreakpointByUrl): Propagate the
assigned breakpoint action identifiers.
(WebCore::InspectorDebuggerAgent::setBreakpoint): Propagate the
assigned breakpoint action identifiers.
(WebCore::InspectorDebuggerAgent::removeBreakpoint): Release object
groups for any actions that were associated with the removed breakpoint.
(WebCore::InspectorDebuggerAgent::didSampleProbe): Added.
(WebCore::InspectorDebuggerAgent::clearResolvedBreakpointState): Renamed from clear().
(WebCore::InspectorDebuggerAgent::didClearGlobalObject): Renamed from reset().
* inspector/InspectorDebuggerAgent.h:
* inspector/PageDebuggerAgent.cpp:
(WebCore::PageDebuggerAgent::didClearMainFrameWindowObject):
* inspector/ScriptBreakpoint.h:
(WebCore::ScriptBreakpointAction::ScriptBreakpointAction): Add identifier member.
* inspector/ScriptDebugListener.h:

Source/WebInspectorUI:

* UserInterface/InspectorJSBackendCommands.js: Add probe enumeration value.

LayoutTests:

Add protocol tests for setting and hitting the probe breakpoint action type.

* inspector-protocol/debugger/setBreakpoint-actions-expected.txt:
* inspector-protocol/debugger/setBreakpoint-actions.html:
* inspector-protocol/debugger/setProbe-multiple-actions-expected.txt: Added.
* inspector-protocol/debugger/setProbe-multiple-actions.html: Added.
* inspector-protocol/resources/probe-helper.js: Added.
(ProbeHelper.simplifiedProbeSample):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162096 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6641b197
2014-01-15 Brian Burg <bburg@apple.com>
Web Inspector: capture probe samples on the backend
https://bugs.webkit.org/show_bug.cgi?id=126668
Reviewed by Joseph Pecoraro.
Add protocol tests for setting and hitting the probe breakpoint action type.
* inspector-protocol/debugger/setBreakpoint-actions-expected.txt:
* inspector-protocol/debugger/setBreakpoint-actions.html:
* inspector-protocol/debugger/setProbe-multiple-actions-expected.txt: Added.
* inspector-protocol/debugger/setProbe-multiple-actions.html: Added.
* inspector-protocol/resources/probe-helper.js: Added.
(ProbeHelper.simplifiedProbeSample):
2014-01-15 Gavin Barraclough <barraclough@apple.com>
REGRESSION (r158369): Some pop-up windows open at incorrect size (affects GMail, theblaze.com)
Debugger.setBreakpoint with multiple probe actions at the same breakpoint. Test Debugger.didSampleProbe events for the probe samples.
Breakpoints Enabled
Found breakpoint.js
PASS: Should receive two breakpoint action identifiers on Debugger.setBreakpoint callback.
Running breakpointActions to trigger probe samples.
inside breakpointActions a:(12) b:([object Object])
Received probe sample payload: {"type":"number","value":12,"description":"12"}
Received probe sample payload: {"type":"number","value":12,"description":"12"}
PASS: Samples from probe actions on the same breakpoint should have unique action identifiers.
PASS: Samples from probe actions on the same breakpoint should have the same batch identifiers.
<html>
<head>
<script src="../../http/tests/inspector-protocol/resources/protocol-test.js"></script>
<script src="resources/breakpoint.js"></script>
<script>
function test()
{
InspectorTest.importScript("../../../../inspector-protocol/resources/probe-helper.js");
InspectorTest.sendCommand("Debugger.enable", {});
InspectorTest.sendCommand("Debugger.setBreakpointsActive", {active: true}, function() {
InspectorTest.log("Breakpoints Enabled");
});
var samples = [];
const expectedSampleCount = 2;
function receivedAllExpectedSamples() {
return samples.length === expectedSampleCount;
}
function dumpSamples()
{
InspectorTest.log("Sample 1: " + JSON.stringify(samples[0]));
InspectorTest.log("Sample 2: " + JSON.stringify(samples[1]));
}
var tests = [
{
message: "Samples from probe actions on the same breakpoint should have unique action identifiers.",
predicate: function samplesHaveUniqueActionIds() {
return samples[0].probeId !== samples[1].probeId;
},
error: dumpSamples
},
{
message: "Samples from probe actions on the same breakpoint should have the same batch identifiers.",
predicate: function samplesHaveEqualBatchIds() {
return samples[0].batchId === samples[1].batchId;
},
error: dumpSamples
},
];
InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
{
if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
InspectorTest.log("Found breakpoint.js");
var scriptIdentifier = messageObject.params.scriptId;
var location = {scriptId: scriptIdentifier, lineNumber: 18, columnNumber: 0};
var options = {
autoContinue: true,
actions: [
{"type": "probe", "data": "a"},
{"type": "probe", "data": "a"}
]
};
InspectorTest.sendCommand("Debugger.setBreakpoint", {location: location, options: options}, function(responseObject) {
InspectorTest.checkForError(responseObject);
var actionIdentifiers = responseObject.result.breakpointActionIdentifiers;
InspectorTest.assert(actionIdentifiers instanceof Array && actionIdentifiers.length === 2,
"Should receive two breakpoint action identifiers on Debugger.setBreakpoint callback.");
// FIXME: should we use the Breakpoint/BreakpointAction model objects to manage this?
if (actionIdentifiers.length === 2) {
options.actions[0].identifier = actionIdentifiers[0];
options.actions[1].identifier = actionIdentifiers[1];
}
InspectorTest.log("Running breakpointActions to trigger probe samples.");
InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointActions(12, {x:1,y:2})"});
});
}
}
InspectorTest.eventHandler["Debugger.didSampleProbe"] = function(messageObject)
{
var sample = ProbeHelper.simplifiedProbeSample(messageObject);
samples.push(sample);
InspectorTest.log("Received probe sample payload: " + JSON.stringify(sample.payload));
if (receivedAllExpectedSamples()) {
tests.forEach(function(test) {
var result = test.predicate();
InspectorTest.assert(result, test.message);
if (!result)
test.error();
});
InspectorTest.completeTest();
}
}
}
</script>
</head>
<body onload="runTest()">
<p>Debugger.setBreakpoint with multiple probe actions at the same breakpoint. Test Debugger.didSampleProbe events for the probe samples.</p>
</body>
</html>
......@@ -17,8 +17,10 @@ inside breakpointActions a:(12) b:([object Object])
PASS: Console Message: {"source":"javascript","level":"log","text":"log-action-before","location":"breakpoint.js:19:2"}
PASS: Console Message: {"source":"console-api","level":"log","text":"eval-action","location":"???:1:26","parameters":[{"type":"string"},{"type":"number"},{"type":"object"}]}
PASS: Console Message: {"source":"javascript","level":"log","text":"log-action-after","location":"breakpoint.js:19:2"}
PASS: Probe sample payload: {"type":"number","value":12,"description":"12"}
inside breakpointActions a:(100) b:([object HTMLBodyElement])
PASS: Console Message: {"source":"javascript","level":"log","text":"log-action-before","location":"breakpoint.js:19:2"}
PASS: Console Message: {"source":"console-api","level":"log","text":"eval-action","location":"???:1:26","parameters":[{"type":"string"},{"type":"number"},{"type":"object","subtype":"node"}]}
PASS: Console Message: {"source":"javascript","level":"log","text":"log-action-after","location":"breakpoint.js:19:2"}
PASS: Probe sample payload: {"type":"number","value":100,"description":"100"}
......@@ -6,6 +6,7 @@
function test()
{
InspectorTest.importScript("../../../../inspector-protocol/resources/console-helper.js");
InspectorTest.importScript("../../../../inspector-protocol/resources/probe-helper.js");
InspectorTest.sendCommand("Console.enable", {});
InspectorTest.sendCommand("Debugger.enable", {});
......@@ -13,9 +14,16 @@ function test()
InspectorTest.log("Breakpoints Enabled");
});
var expectLogs = false;
var logsSeen = 0;
const expectedLogs = 6;
var isExpectingLogs = false;
var isExpectingSamples = false;
var logCount = 0;
var sampleCount = 0;
const expectedLogCount = 6;
const expectedSampleCount = 2;
function receivedAllExpectedOutput() {
return logCount === expectedLogCount && sampleCount === expectedSampleCount;
}
InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
{
......@@ -30,7 +38,8 @@ function test()
{"type": "log", "data": "log-action-before"},
{"type": "sound"},
{"type": "evaluate", "data": "(function() { console.log('eval-action', a, b); })()"},
{"type": "log", "data": "log-action-after"}
{"type": "log", "data": "log-action-after"},
{"type": "probe", "data": "a"}
]
};
......@@ -41,7 +50,8 @@ function test()
InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointActions(1)"});
InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointActions(2, 12)"});
InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointActions(2, {x:1,y:2})"}, function() {
expectLogs = true;
isExpectingLogs = true;
isExpectingSamples = true;
InspectorTest.log("Running breakpointActions to triggering the breakpoint actions");
InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointActions(12, {x:1,y:2})"}, function() {
InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointActions(100, document.body)"});
......@@ -59,9 +69,26 @@ function test()
InspectorTest.completeTest();
}
InspectorTest.eventHandler["Debugger.didSampleProbe"] = function(messageObject)
{
if (!isExpectingSamples) {
InspectorTest.log("FAIL: unexpected probe sample, probe samples should only have come from breakpoint actions.");
InspectorTest.completeTest();
return;
}
var simplifiedSample = ProbeHelper.simplifiedProbeSample(messageObject);
InspectorTest.log("PASS: Probe sample payload: " + JSON.stringify(simplifiedSample.payload));
++sampleCount;
if (receivedAllExpectedOutput())
InspectorTest.completeTest();
}
InspectorTest.eventHandler["Console.messageAdded"] = function(messageObject)
{
if (!expectLogs) {
if (!isExpectingLogs) {
InspectorTest.log("FAIL: unexpected log, logs should only have come from breakpoint actions.");
InspectorTest.completeTest();
return;
......@@ -70,7 +97,9 @@ function test()
var simplifiedMessage = ConsoleHelper.simplifiedConsoleMessage(messageObject);
InspectorTest.log("PASS: Console Message: " + JSON.stringify(simplifiedMessage));
if (++logsSeen === expectedLogs)
++logCount;
if (receivedAllExpectedOutput())
InspectorTest.completeTest();
}
}
......
window.ProbeHelper = {};
ProbeHelper.simplifiedProbeSample = function(messageObject)
{
var data = messageObject.params.sample;
return {
probeId: data.probeId,
batchId: data.batchId,
sampleId: data.sampleId,
payload: data.payload
};
}
2014-01-15 Brian Burg <bburg@apple.com>
Web Inspector: capture probe samples on the backend
https://bugs.webkit.org/show_bug.cgi?id=126668
Reviewed by Joseph Pecoraro.
Add the 'probe' breakpoint action to the protocol. Change the setBreakpoint
commands to return a list of assigned breakpoint action identifiers
Add a type for breakpoint action identifiers. Add an event for sending
captured probe samples to the inspector frontend.
* inspector/protocol/Debugger.json:
2014-01-10 Mark Hahnenberg <mhahnenberg@apple.com>
Copying should be generational
......
......@@ -7,6 +7,11 @@
"type": "string",
"description": "Breakpoint identifier."
},
{
"id": "BreakpointActionIdentifier",
"type": "integer",
"description": "Breakpoint action identifier."
},
{
"id": "ScriptId",
"type": "string",
......@@ -31,7 +36,7 @@
"id": "BreakpointAction",
"type": "object",
"properties": [
{ "name": "type", "type": "string", "enum": ["log", "evaluate", "sound"], "description": "Different kinds of breakpoint actions." },
{ "name": "type", "type": "string", "enum": ["log", "evaluate", "sound", "probe"], "description": "Different kinds of breakpoint actions." },
{ "name": "data", "type": "string", "optional": true, "description": "Data associated with this breakpoint type (e.g. for type \"eval\" this is the JavaScript string to evalulate)." }
],
"description": "Action to perform when a breakpoint is triggered."
......@@ -78,6 +83,18 @@
{ "name": "object", "$ref": "Runtime.RemoteObject", "description": "Object representing the scope. For <code>global</code> and <code>with</code> scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties." }
],
"description": "Scope description."
},
{
"id": "ProbeSample",
"description": "A sample collected by evaluating a probe breakpoint action.",
"type": "object",
"properties": [
{ "name": "probeId", "$ref": "BreakpointActionIdentifier", "description": "Identifier of the probe breakpoint action that created the sample." },
{ "name": "sampleId", "type": "integer", "description": "Unique identifier for this sample." },
{ "name": "batchId", "type": "integer", "description": "A batch identifier which is the same for all samples taken at the same breakpoint hit." },
{ "name": "timestamp", "type": "number", "description": "Timestamp of when the sample was taken." },
{ "name": "payload", "$ref": "Runtime.RemoteObject", "description": "Contents of the sample." }
]
}
],
"commands": [
......@@ -107,7 +124,8 @@
],
"returns": [
{ "name": "breakpointId", "$ref": "BreakpointId", "description": "Id of the created breakpoint for further reference." },
{ "name": "locations", "type": "array", "items": { "$ref": "Location"}, "description": "List of the locations this breakpoint resolved into upon addition." }
{ "name": "locations", "type": "array", "items": { "$ref": "Location"}, "description": "List of the locations this breakpoint resolved into upon addition." },
{ "name": "breakpointActionIdentifiers", "type": "array", "items": { "$ref": "BreakpointActionIdentifier" }, "description": "Assigned breakpoint action identifiers." }
],
"description": "Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in <code>locations</code> property. Further matching script parsing will result in subsequent <code>breakpointResolved</code> events issued. This logical breakpoint will survive page reloads."
},
......@@ -119,7 +137,8 @@
],
"returns": [
{ "name": "breakpointId", "$ref": "BreakpointId", "description": "Id of the created breakpoint for further reference." },
{ "name": "actualLocation", "$ref": "Location", "description": "Location this breakpoint resolved into." }
{ "name": "actualLocation", "$ref": "Location", "description": "Location this breakpoint resolved into." },
{ "name": "breakpointActionIdentifiers", "type": "array", "items": { "$ref": "BreakpointActionIdentifier" }, "description": "Assigned breakpoint action identifiers." }
],
"description": "Sets JavaScript breakpoint at a given location."
},
......@@ -273,6 +292,13 @@
{
"name": "resumed",
"description": "Fired when the virtual machine resumed execution."
},
{
"name": "didSampleProbe",
"description": "Fires when a new proben sample is collected.",
"parameters": [
{ "name": "sample", "$ref": "ProbeSample", "description": "A collected probe sample." }
]
}
]
}
2014-01-15 Brian Burg <bburg@apple.com>
Web Inspector: capture probe samples on the backend
https://bugs.webkit.org/show_bug.cgi?id=126668
Reviewed by Joseph Pecoraro.
Test: inspector-protocol/debugger/setProbe-multiple-actions.html
Add the probe breakpoint action type. A probe action
evaluates an expression on the script call frame, and
the result is aggregated on a per-probe basis. Each
evaluated expression result is called a probe sample.
* bindings/js/ScriptDebugServer.cpp:
(WebCore::ScriptDebugServer::evaluateBreakpointAction): Teach
the debug server to evaluate a probe.
(WebCore::ScriptDebugServer::dispatchDidSampleProbe): Added.
(WebCore::ScriptDebugServer::handleBreakpointHit): Increment a hit count.
(WebCore::ScriptDebugServer::getActionsForBreakpoint):
* bindings/js/ScriptDebugServer.h:
* inspector/InspectorDebuggerAgent.cpp:
(WebCore::objectGroupForBreakpointAction): Added. Create an object
group for each breakpoint action. Currently only probes make objects.
(WebCore::InspectorDebuggerAgent::InspectorDebuggerAgent):
(WebCore::InspectorDebuggerAgent::disable):
(WebCore::InspectorDebuggerAgent::enable): Remove stale comment.
(WebCore::breakpointActionTypeForString): Add new case.
(WebCore::InspectorDebuggerAgent::breakpointActionsFromProtocol): Make
this a member function instead of a static function, so it can increment
the breakpoint action identifier counter.
(WebCore::InspectorDebuggerAgent::setBreakpointByUrl): Propagate the
assigned breakpoint action identifiers.
(WebCore::InspectorDebuggerAgent::setBreakpoint): Propagate the
assigned breakpoint action identifiers.
(WebCore::InspectorDebuggerAgent::removeBreakpoint): Release object
groups for any actions that were associated with the removed breakpoint.
(WebCore::InspectorDebuggerAgent::didSampleProbe): Added.
(WebCore::InspectorDebuggerAgent::clearResolvedBreakpointState): Renamed from clear().
(WebCore::InspectorDebuggerAgent::didClearGlobalObject): Renamed from reset().
* inspector/InspectorDebuggerAgent.h:
* inspector/PageDebuggerAgent.cpp:
(WebCore::PageDebuggerAgent::didClearMainFrameWindowObject):
* inspector/ScriptBreakpoint.h:
(WebCore::ScriptBreakpointAction::ScriptBreakpointAction): Add identifier member.
* inspector/ScriptDebugListener.h:
2014-01-15 Brent Fulgham <bfulgham@apple.com>
[WebGL] Validation function for compressed formats incorrect
/*
* Copyright (C) 2008, 2009, 2013 Apple Inc. All rights reserved.
* Copyright (C) 2008, 2009, 2013, 2014 Apple Inc. All rights reserved.
* Copyright (C) 2010-2011 Google Inc. All rights reserved.
* Copyright (C) 2013 University of Washington. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -44,6 +45,8 @@
#include <parser/SourceProvider.h>
#include <runtime/JSLock.h>
#include <wtf/MainThread.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/TemporaryChange.h>
#include <wtf/text/WTFString.h>
using namespace JSC;
......@@ -90,7 +93,7 @@ void ScriptDebugServer::removeBreakpoint(JSC::BreakpointID id)
Debugger::removeBreakpoint(id);
}
bool ScriptDebugServer::evaluateBreakpointAction(const ScriptBreakpointAction& breakpointAction) const
bool ScriptDebugServer::evaluateBreakpointAction(const ScriptBreakpointAction& breakpointAction)
{
DebuggerCallFrame* debuggerCallFrame = currentDebuggerCallFrame();
switch (breakpointAction.type) {
......@@ -110,6 +113,17 @@ bool ScriptDebugServer::evaluateBreakpointAction(const ScriptBreakpointAction& b
case ScriptBreakpointActionTypeSound:
systemBeep();
break;
case ScriptBreakpointActionTypeProbe: {
JSValue exception;
JSValue result = debuggerCallFrame->evaluate(breakpointAction.data, exception);
if (exception)
reportException(debuggerCallFrame->exec(), exception);
JSC::ExecState* state = debuggerCallFrame->scope()->globalObject()->globalExec();
Deprecated::ScriptValue wrappedResult = Deprecated::ScriptValue(state->vm(), exception ? exception : result);
dispatchDidSampleProbe(state, breakpointAction.identifier, wrappedResult);
break;
}
}
return true;
......@@ -140,6 +154,24 @@ void ScriptDebugServer::dispatchDidPause(ScriptDebugListener* listener)
listener->didPause(state, Deprecated::ScriptValue(state->vm(), jsCallFrame), Deprecated::ScriptValue());
}
void ScriptDebugServer::dispatchDidSampleProbe(ExecState* exec, int identifier, const Deprecated::ScriptValue& sample)
{
if (m_callingListeners)
return;
ListenerSet* listeners = getListenersForGlobalObject(exec->lexicalGlobalObject());
if (!listeners)
return;
ASSERT(!listeners->isEmpty());
TemporaryChange<bool> change(m_callingListeners, true);
Vector<ScriptDebugListener*> listenersCopy;
copyToVector(*listeners, listenersCopy);
for (auto listener : listenersCopy)
listener->didSampleProbe(exec, identifier, m_hitCount, sample);
}
void ScriptDebugServer::dispatchDidContinue(ScriptDebugListener* listener)
{
listener->didContinue();
......@@ -251,6 +283,7 @@ bool ScriptDebugServer::needPauseHandling(JSGlobalObject* globalObject)
void ScriptDebugServer::handleBreakpointHit(const JSC::Breakpoint& breakpoint)
{
m_hitCount++;
BreakpointIDToActionsMap::iterator it = m_breakpointIDToActions.find(breakpoint.id);
if (it != m_breakpointIDToActions.end()) {
BreakpointActions& actions = it->value;
......@@ -290,6 +323,17 @@ void ScriptDebugServer::recompileAllJSFunctionsTimerFired(Timer<ScriptDebugServe
recompileAllJSFunctions();
}
const Vector<ScriptBreakpointAction>& ScriptDebugServer::getActionsForBreakpoint(JSC::BreakpointID breakpointID)
{
ASSERT(breakpointID != JSC::noBreakpointID);
if (m_breakpointIDToActions.contains(breakpointID))
return m_breakpointIDToActions.find(breakpointID)->value;
static NeverDestroyed<Vector<ScriptBreakpointAction>> emptyActionVector = Vector<ScriptBreakpointAction>();
return emptyActionVector;
}
} // namespace WebCore
#endif // ENABLE(JAVASCRIPT_DEBUGGER)
......@@ -62,6 +62,8 @@ public:
void recompileAllJSFunctionsSoon();
virtual void recompileAllJSFunctions() = 0;
const Vector<ScriptBreakpointAction>& getActionsForBreakpoint(JSC::BreakpointID);
class Task {
WTF_MAKE_FAST_ALLOCATED;
public:
......@@ -84,7 +86,7 @@ protected:
virtual bool isContentScript(JSC::ExecState*);
bool evaluateBreakpointAction(const ScriptBreakpointAction&) const;
bool evaluateBreakpointAction(const ScriptBreakpointAction&);
void dispatchFunctionToListeners(JavaScriptExecutionCallback, JSC::JSGlobalObject*);
void dispatchFunctionToListeners(const ListenerSet& listeners, JavaScriptExecutionCallback callback);
......@@ -92,6 +94,7 @@ protected:
void dispatchDidContinue(ScriptDebugListener*);
void dispatchDidParseSource(const ListenerSet& listeners, JSC::SourceProvider*, bool isContentScript);
void dispatchFailedToParseSource(const ListenerSet& listeners, JSC::SourceProvider*, int errorLine, const String& errorMessage);
void dispatchDidSampleProbe(JSC::ExecState*, int probeIdentifier, const Deprecated::ScriptValue& sample);
bool m_doneProcessingDebuggerEvents;
......@@ -108,6 +111,7 @@ private:
void recompileAllJSFunctionsTimerFired(Timer<ScriptDebugServer>&);
unsigned m_hitCount;
bool m_callingListeners;
BreakpointIDToActionsMap m_breakpointIDToActions;
Timer<ScriptDebugServer> m_recompileTimer;
......
......@@ -81,8 +81,8 @@ public:
virtual void disable(ErrorString*);
virtual void setBreakpointsActive(ErrorString*, bool active);
virtual void setBreakpointByUrl(ErrorString*, int lineNumber, const String* optionalURL, const String* optionalURLRegex, const int* optionalColumnNumber, const RefPtr<Inspector::InspectorObject>* options, Inspector::TypeBuilder::Debugger::BreakpointId*, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::Location>>& locations);
virtual void setBreakpoint(ErrorString*, const RefPtr<Inspector::InspectorObject>& location, const RefPtr<Inspector::InspectorObject>* options, Inspector::TypeBuilder::Debugger::BreakpointId*, RefPtr<Inspector::TypeBuilder::Debugger::Location>& actualLocation);
virtual void setBreakpointByUrl(ErrorString*, int lineNumber, const String* optionalURL, const String* optionalURLRegex, const int* optionalColumnNumber, const RefPtr<Inspector::InspectorObject>* options, Inspector::TypeBuilder::Debugger::BreakpointId*, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::Location>>& locations, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::BreakpointActionIdentifier>>& breakpointActionIdentifiers);
virtual void setBreakpoint(ErrorString*, const RefPtr<Inspector::InspectorObject>& location, const RefPtr<Inspector::InspectorObject>* options, Inspector::TypeBuilder::Debugger::BreakpointId*, RefPtr<Inspector::TypeBuilder::Debugger::Location>& actualLocation, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::BreakpointActionIdentifier>>& breakpointActionIdentifiers);
virtual void removeBreakpoint(ErrorString*, const String& breakpointIdentifier);
virtual void continueToLocation(ErrorString*, const RefPtr<Inspector::InspectorObject>& location);
......@@ -138,19 +138,22 @@ protected:
virtual void disable();
virtual void didPause(JSC::ExecState*, const Deprecated::ScriptValue& callFrames, const Deprecated::ScriptValue& exception);
virtual void didContinue();
void reset();
void didClearGlobalObject();
private:
PassRefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::CallFrame>> currentCallFrames();
virtual void didParseSource(JSC::SourceID, const Script&) OVERRIDE FINAL;
virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage) OVERRIDE FINAL;
virtual void didSampleProbe(JSC::ExecState*, int probeIdentifier, int hitCount, const Deprecated::ScriptValue& sample) OVERRIDE FINAL;
PassRefPtr<Inspector::TypeBuilder::Debugger::Location> resolveBreakpoint(const String& breakpointIdentifier, JSC::SourceID, const ScriptBreakpoint&);
void clear();
bool assertPaused(ErrorString*);
void clearResolvedBreakpointState();
void clearBreakDetails();
bool breakpointActionsFromProtocol(ErrorString*, RefPtr<Inspector::InspectorArray>& actions, Vector<ScriptBreakpointAction>* result);
String sourceMapURLForScript(const Script&);
typedef HashMap<JSC::SourceID, Script> ScriptsMap;
......@@ -171,6 +174,8 @@ private:
bool m_enabled;
bool m_javaScriptPauseScheduled;
Listener* m_listener;
int m_nextProbeSampleId;
int m_nextBreakpointActionIdentifier;
};
} // namespace WebCore
......
......@@ -115,7 +115,7 @@ void PageDebuggerAgent::setOverlayMessage(ErrorString*, const String* message)
void PageDebuggerAgent::didClearMainFrameWindowObject()
{
reset();
didClearGlobalObject();
}
} // namespace WebCore
......
......@@ -38,17 +38,20 @@ namespace WebCore {
typedef enum {
ScriptBreakpointActionTypeLog,
ScriptBreakpointActionTypeEvaluate,
ScriptBreakpointActionTypeSound
ScriptBreakpointActionTypeSound,
ScriptBreakpointActionTypeProbe
} ScriptBreakpointActionType;
struct ScriptBreakpointAction {
ScriptBreakpointAction(ScriptBreakpointActionType type, const String& data)
ScriptBreakpointAction(ScriptBreakpointActionType type, int identifier, const String& data)
: type(type)
, identifier(identifier)
, data(data)
{
}
ScriptBreakpointActionType type;
int identifier;
String data;
};
......
......@@ -71,6 +71,7 @@ public:
virtual void didParseSource(JSC::SourceID, const Script&) = 0;
virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage) = 0;
virtual void didPause(JSC::ExecState*, const Deprecated::ScriptValue& callFrames, const Deprecated::ScriptValue& exception) = 0;
virtual void didSampleProbe(JSC::ExecState*, int probeIdentifier, int hitCount, const Deprecated::ScriptValue& result) = 0;
virtual void didContinue() = 0;
};
......
2014-01-15 Brian Burg <bburg@apple.com>
Web Inspector: capture probe samples on the backend
https://bugs.webkit.org/show_bug.cgi?id=126668
Reviewed by Joseph Pecoraro.
* UserInterface/InspectorJSBackendCommands.js: Add probe enumeration value.
2014-01-15 Andreas Kling <akling@apple.com>
Remove the CSS selector profiler.
......
......@@ -8,7 +8,7 @@
// Debugger.
InspectorBackend.registerDebuggerDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "Debugger");
InspectorBackend.registerEnum("Debugger.BreakpointActionType", {Log: "log", Evaluate: "evaluate", Sound: "sound"});
InspectorBackend.registerEnum("Debugger.BreakpointActionType", {Log: "log", Evaluate: "evaluate", Sound: "sound", Probe: "probe"});
InspectorBackend.registerEnum("Debugger.ScopeType", {Global: "global", Local: "local", With: "with", Closure: "closure", Catch: "catch"});
InspectorBackend.registerEvent("Debugger.globalObjectCleared", []);
InspectorBackend.registerEvent("Debugger.scriptParsed", ["scriptId", "url", "startLine", "startColumn", "endLine", "endColumn", "isContentScript", "sourceMapURL", "hasSourceURL"]);
......@@ -16,6 +16,7 @@ InspectorBackend.registerEvent("Debugger.scriptFailedToParse", ["url", "scriptSo
InspectorBackend.registerEvent("Debugger.breakpointResolved", ["breakpointId", "location"]);
InspectorBackend.registerEvent("Debugger.paused", ["callFrames", "reason", "data"]);
InspectorBackend.registerEvent("Debugger.resumed", []);
InspectorBackend.registerEvent("Debugger.didSampleProbe", ["sample"]);
InspectorBackend.registerCommand("Debugger.enable", [], []);
InspectorBackend.registerCommand("Debugger.disable", [], []);
InspectorBackend.registerCommand("Debugger.setBreakpointsActive", [{"name": "active", "type": "boolean", "optional": false}], []);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment