Diff
Modified: trunk/Source/WebCore/ChangeLog (120708 => 120709)
--- trunk/Source/WebCore/ChangeLog 2012-06-19 14:03:15 UTC (rev 120708)
+++ trunk/Source/WebCore/ChangeLog 2012-06-19 14:03:48 UTC (rev 120709)
@@ -1,3 +1,55 @@
+2012-06-19 Peter Rybin <[email protected]>
+
+ Web Inspector: Support 'Restart frame' in protocol and backend
+ https://bugs.webkit.org/show_bug.cgi?id=89147
+
+ Reviewed by Yury Semikhatsky.
+
+ Inspector.json got new command in Debugger domain.
+ A call path from InspectorDebuggerAgent to V8 Debug.LiveEdit.RestartFrame API
+ is built.
+ JSC implementation is a stub with fix me (40300).
+
+ * bindings/js/JSJavaScriptCallFrameCustom.cpp:
+ (WebCore::JSJavaScriptCallFrame::restart):
+ (WebCore):
+ * bindings/js/ScriptDebugServer.cpp:
+ (WebCore):
+ (WebCore::ScriptDebugServer::updateCallStack):
+ * bindings/js/ScriptDebugServer.h:
+ (ScriptDebugServer):
+ * bindings/v8/DebuggerScript.js:
+ (.):
+ * bindings/v8/_javascript_CallFrame.cpp:
+ (WebCore::_javascript_CallFrame::restart):
+ (WebCore):
+ * bindings/v8/_javascript_CallFrame.h:
+ (_javascript_CallFrame):
+ * bindings/v8/ScriptDebugServer.cpp:
+ (WebCore):
+ (WebCore::ScriptDebugServer::updateCallStack):
+ * bindings/v8/ScriptDebugServer.h:
+ * bindings/v8/ScriptFunctionCall.cpp:
+ (WebCore::ScriptFunctionCall::call):
+ * bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp:
+ (WebCore::V8JavaScriptCallFrame::restartCallback):
+ (WebCore):
+ * inspector/InjectedScript.cpp:
+ (WebCore::InjectedScript::restartFrame):
+ (WebCore):
+ * inspector/InjectedScript.h:
+ (InjectedScript):
+ * inspector/InjectedScriptExterns.js:
+ (_javascript_CallFrame.prototype.restart):
+ * inspector/InjectedScriptSource.js:
+ (.):
+ * inspector/Inspector.json:
+ * inspector/InspectorDebuggerAgent.cpp:
+ (WebCore::InspectorDebuggerAgent::restartFrame):
+ * inspector/InspectorDebuggerAgent.h:
+ (InspectorDebuggerAgent):
+ * inspector/_javascript_CallFrame.idl:
+
2012-06-19 Andrei Poenaru <[email protected]>
Replaced printf with fprintf in DEBUG_AUDIONODE_REFERENCES
Modified: trunk/Source/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp (120708 => 120709)
--- trunk/Source/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp 2012-06-19 14:03:15 UTC (rev 120708)
+++ trunk/Source/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp 2012-06-19 14:03:48 UTC (rev 120709)
@@ -48,6 +48,12 @@
return result;
}
+JSValue JSJavaScriptCallFrame::restart(ExecState*)
+{
+ // FIXME(40300): implement this.
+ return JSValue(JSValue::JSFalse);
+}
+
JSValue JSJavaScriptCallFrame::thisObject(ExecState*) const
{
return impl()->thisObject() ? JSValue(impl()->thisObject()) : jsNull();
Modified: trunk/Source/WebCore/bindings/js/ScriptDebugServer.cpp (120708 => 120709)
--- trunk/Source/WebCore/bindings/js/ScriptDebugServer.cpp 2012-06-19 14:03:15 UTC (rev 120708)
+++ trunk/Source/WebCore/bindings/js/ScriptDebugServer.cpp 2012-06-19 14:03:48 UTC (rev 120709)
@@ -206,6 +206,13 @@
return false;
}
+
+void ScriptDebugServer::updateCallStack(ScriptValue*)
+{
+ // This method is used for restart frame feature that is not implemented yet.
+ // FIXME(40300): implement this.
+}
+
void ScriptDebugServer::dispatchDidPause(ScriptDebugListener* listener)
{
ASSERT(m_paused);
Modified: trunk/Source/WebCore/bindings/js/ScriptDebugServer.h (120708 => 120709)
--- trunk/Source/WebCore/bindings/js/ScriptDebugServer.h 2012-06-19 14:03:15 UTC (rev 120708)
+++ trunk/Source/WebCore/bindings/js/ScriptDebugServer.h 2012-06-19 14:03:48 UTC (rev 120709)
@@ -83,6 +83,7 @@
bool canSetScriptSource();
bool setScriptSource(const String& sourceID, const String& newContent, bool preview, String* error, ScriptValue* newCallFrames, ScriptObject* result);
+ void updateCallStack(ScriptValue* callFrame);
bool causesRecompilation() { return true; }
// FIXME: Need to remove this. Refer to bug: 88759.
Modified: trunk/Source/WebCore/bindings/v8/DebuggerScript.js (120708 => 120709)
--- trunk/Source/WebCore/bindings/v8/DebuggerScript.js 2012-06-19 14:03:15 UTC (rev 120708)
+++ trunk/Source/WebCore/bindings/v8/DebuggerScript.js 2012-06-19 14:03:48 UTC (rev 120709)
@@ -254,10 +254,16 @@
scopeChain.push(DebuggerScript._buildScopeObject(scopeMirror));
}
- function evaluate(_expression_) {
+ function evaluate(_expression_)
+ {
return frameMirror.evaluate(_expression_, false).value();
}
+ function restart()
+ {
+ return Debug.LiveEdit.RestartFrame(frameMirror);
+ }
+
return {
"sourceID": sourceID,
"line": location ? location.line : 0,
@@ -267,7 +273,8 @@
"scopeChain": scopeChain,
"scopeType": scopeType,
"evaluate": evaluate,
- "caller": callerFrame
+ "caller": callerFrame,
+ "restart": restart
};
}
Modified: trunk/Source/WebCore/bindings/v8/_javascript_CallFrame.cpp (120708 => 120709)
--- trunk/Source/WebCore/bindings/v8/_javascript_CallFrame.cpp 2012-06-19 14:03:15 UTC (rev 120708)
+++ trunk/Source/WebCore/bindings/v8/_javascript_CallFrame.cpp 2012-06-19 14:03:48 UTC (rev 120709)
@@ -125,6 +125,12 @@
return evalFunction->Call(m_callFrame.get(), 1, argv);
}
+v8::Handle<v8::Value> _javascript_CallFrame::restart()
+{
+ v8::Handle<v8::Function> restartFunction = v8::Handle<v8::Function>::Cast(m_callFrame.get()->Get(v8String("restart")));
+ return restartFunction->Call(m_callFrame.get(), 0, 0);
+}
+
} // namespace WebCore
#endif // ENABLE(_javascript__DEBUGGER)
Modified: trunk/Source/WebCore/bindings/v8/_javascript_CallFrame.h (120708 => 120709)
--- trunk/Source/WebCore/bindings/v8/_javascript_CallFrame.h 2012-06-19 14:03:15 UTC (rev 120708)
+++ trunk/Source/WebCore/bindings/v8/_javascript_CallFrame.h 2012-06-19 14:03:48 UTC (rev 120709)
@@ -60,6 +60,7 @@
v8::Handle<v8::Value> thisObject() const;
v8::Handle<v8::Value> evaluate(const String& _expression_);
+ v8::Handle<v8::Value> restart();
private:
_javascript_CallFrame(v8::Handle<v8::Context> debuggerContext, v8::Handle<v8::Object> callFrame);
Modified: trunk/Source/WebCore/bindings/v8/ScriptDebugServer.cpp (120708 => 120709)
--- trunk/Source/WebCore/bindings/v8/ScriptDebugServer.cpp 2012-06-19 14:03:15 UTC (rev 120708)
+++ trunk/Source/WebCore/bindings/v8/ScriptDebugServer.cpp 2012-06-19 14:03:48 UTC (rev 120709)
@@ -254,6 +254,14 @@
return true;
}
+
+void ScriptDebugServer::updateCallStack(ScriptValue* callFrame)
+{
+ if (isPaused())
+ *callFrame = currentCallFrame();
+}
+
+
ScriptValue ScriptDebugServer::currentCallFrame()
{
ASSERT(isPaused());
Modified: trunk/Source/WebCore/bindings/v8/ScriptDebugServer.h (120708 => 120709)
--- trunk/Source/WebCore/bindings/v8/ScriptDebugServer.h 2012-06-19 14:03:15 UTC (rev 120708)
+++ trunk/Source/WebCore/bindings/v8/ScriptDebugServer.h 2012-06-19 14:03:48 UTC (rev 120709)
@@ -77,6 +77,7 @@
bool canSetScriptSource();
bool setScriptSource(const String& sourceID, const String& newContent, bool preview, String* error, ScriptValue* newCallFrames, ScriptObject* result);
+ void updateCallStack(ScriptValue* callFrame);
bool causesRecompilation() { return false; }
bool supportsNativeBreakpoints() { return true; }
Modified: trunk/Source/WebCore/bindings/v8/ScriptFunctionCall.cpp (120708 => 120709)
--- trunk/Source/WebCore/bindings/v8/ScriptFunctionCall.cpp 2012-06-19 14:03:15 UTC (rev 120708)
+++ trunk/Source/WebCore/bindings/v8/ScriptFunctionCall.cpp 2012-06-19 14:03:48 UTC (rev 120709)
@@ -133,7 +133,7 @@
v8::Local<v8::Value> result;
{
- V8RecursionScope scope(getScriptExecutionContext());
+ V8RecursionScope innerScope(getScriptExecutionContext());
result = function->Call(thisObject, m_arguments.size(), args.get());
}
if (!scope.success()) {
Modified: trunk/Source/WebCore/bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp (120708 => 120709)
--- trunk/Source/WebCore/bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp 2012-06-19 14:03:15 UTC (rev 120708)
+++ trunk/Source/WebCore/bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp 2012-06-19 14:03:48 UTC (rev 120709)
@@ -46,6 +46,13 @@
return impl->evaluate(_expression_);
}
+v8::Handle<v8::Value> V8JavaScriptCallFrame::restartCallback(const v8::Arguments& args)
+{
+ INC_STATS("V8JavaScriptCallFrame.restartCallback()");
+ _javascript_CallFrame* impl = V8JavaScriptCallFrame::toNative(args.Holder());
+ return impl->restart();
+}
+
v8::Handle<v8::Value> V8JavaScriptCallFrame::scopeChainAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("V8JavaScriptCallFrame.scopeChainAccessorGetter()");
Modified: trunk/Source/WebCore/inspector/InjectedScript.cpp (120708 => 120709)
--- trunk/Source/WebCore/inspector/InjectedScript.cpp 2012-06-19 14:03:15 UTC (rev 120708)
+++ trunk/Source/WebCore/inspector/InjectedScript.cpp 2012-06-19 14:03:48 UTC (rev 120709)
@@ -95,6 +95,26 @@
makeEvalCall(errorString, function, result, wasThrown);
}
+void InjectedScript::restartFrame(ErrorString* errorString, const ScriptValue& callFrames, const String& callFrameId, RefPtr<InspectorObject>* result)
+{
+ ScriptFunctionCall function(m_injectedScriptObject, "restartFrame");
+ function.appendArgument(callFrames);
+ function.appendArgument(callFrameId);
+ RefPtr<InspectorValue> resultValue;
+ makeCall(function, &resultValue);
+ if (resultValue) {
+ if (resultValue->type() == InspectorValue::TypeString) {
+ resultValue->asString(errorString);
+ return;
+ }
+ if (resultValue->type() == InspectorValue::TypeObject) {
+ *result = resultValue->asObject();
+ return;
+ }
+ }
+ *errorString = "Internal error";
+}
+
void InjectedScript::getFunctionDetails(ErrorString* errorString, const String& functionId, RefPtr<FunctionDetails>* result)
{
ScriptFunctionCall function(m_injectedScriptObject, "getFunctionDetails");
Modified: trunk/Source/WebCore/inspector/InjectedScript.h (120708 => 120709)
--- trunk/Source/WebCore/inspector/InjectedScript.h 2012-06-19 14:03:15 UTC (rev 120708)
+++ trunk/Source/WebCore/inspector/InjectedScript.h 2012-06-19 14:03:48 UTC (rev 120709)
@@ -81,6 +81,7 @@
bool returnByValue,
RefPtr<TypeBuilder::Runtime::RemoteObject>* result,
TypeBuilder::OptOutput<bool>* wasThrown);
+ void restartFrame(ErrorString*, const ScriptValue& callFrames, const String& callFrameId, RefPtr<InspectorObject>* result);
void getFunctionDetails(ErrorString*, const String& functionId, RefPtr<TypeBuilder::Debugger::FunctionDetails>* result);
void getProperties(ErrorString*, const String& objectId, bool ownProperties, RefPtr<TypeBuilder::Array<TypeBuilder::Runtime::PropertyDescriptor> >* result);
Node* nodeForObjectId(const String& objectId);
Modified: trunk/Source/WebCore/inspector/InjectedScriptExterns.js (120708 => 120709)
--- trunk/Source/WebCore/inspector/InjectedScriptExterns.js 2012-06-19 14:03:15 UTC (rev 120708)
+++ trunk/Source/WebCore/inspector/InjectedScriptExterns.js 2012-06-19 14:03:48 UTC (rev 120709)
@@ -98,6 +98,8 @@
*/
_javascript_CallFrame.prototype.scopeType = function(index) { }
+_javascript_CallFrame.prototype.restart = function() { }
+
/**
* @constructor
*/
Modified: trunk/Source/WebCore/inspector/InjectedScriptSource.js (120708 => 120709)
--- trunk/Source/WebCore/inspector/InjectedScriptSource.js 2012-06-19 14:03:15 UTC (rev 120708)
+++ trunk/Source/WebCore/inspector/InjectedScriptSource.js 2012-06-19 14:03:48 UTC (rev 120709)
@@ -371,6 +371,17 @@
return this._evaluateAndWrap(callFrame.evaluate, callFrame, _expression_, objectGroup, true, injectCommandLineAPI, returnByValue);
},
+ restartFrame: function(topCallFrame, callFrameId)
+ {
+ var callFrame = this._callFrameForId(topCallFrame, callFrameId);
+ if (!callFrame)
+ return "Could not find call frame with given id";
+ var result = callFrame.restart();
+ if (result === false)
+ result = "Restart frame is not supported";
+ return result;
+ },
+
_callFrameForId: function(topCallFrame, callFrameId)
{
var parsedCallFrameId = eval("(" + callFrameId + ")");
Modified: trunk/Source/WebCore/inspector/Inspector.json (120708 => 120709)
--- trunk/Source/WebCore/inspector/Inspector.json 2012-06-19 14:03:15 UTC (rev 120708)
+++ trunk/Source/WebCore/inspector/Inspector.json 2012-06-19 14:03:48 UTC (rev 120709)
@@ -2485,6 +2485,18 @@
"description": "Edits _javascript_ source live."
},
{
+ "name": "restartFrame",
+ "parameters": [
+ { "name": "callFrameId", "$ref": "CallFrameId", "description": "Call frame identifier to evaluate on." }
+ ],
+ "returns": [
+ { "name": "callFrames", "type": "array", "items": { "$ref": "CallFrame"}, "description": "New stack trace." },
+ { "name": "result", "type": "object", "description": "VM-specific description.", "hidden": true }
+ ],
+ "hidden": true,
+ "description": "Restarts particular call frame from the beginning."
+ },
+ {
"name": "getScriptSource",
"parameters": [
{ "name": "scriptId", "$ref": "ScriptId", "description": "Id of the script to get source for." }
Modified: trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp (120708 => 120709)
--- trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp 2012-06-19 14:03:15 UTC (rev 120708)
+++ trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp 2012-06-19 14:03:48 UTC (rev 120709)
@@ -378,7 +378,19 @@
if (object)
result = object;
}
+void InspectorDebuggerAgent::restartFrame(ErrorString* errorString, const String& callFrameId, RefPtr<Array<TypeBuilder::Debugger::CallFrame> >& newCallFrames, RefPtr<InspectorObject>& result)
+{
+ InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(callFrameId);
+ if (injectedScript.hasNoValue()) {
+ *errorString = "Inspected frame has gone";
+ return;
+ }
+ injectedScript.restartFrame(errorString, m_currentCallStack, callFrameId, &result);
+ scriptDebugServer().updateCallStack(&m_currentCallStack);
+ newCallFrames = currentCallFrames();
+}
+
void InspectorDebuggerAgent::getScriptSource(ErrorString* error, const String& scriptId, String* scriptSource)
{
ScriptsMap::iterator it = m_scripts.find(scriptId);
Modified: trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h (120708 => 120709)
--- trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h 2012-06-19 14:03:15 UTC (rev 120708)
+++ trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h 2012-06-19 14:03:48 UTC (rev 120709)
@@ -89,6 +89,7 @@
virtual void searchInContent(ErrorString*, const String& scriptId, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<TypeBuilder::Array<TypeBuilder::Page::SearchMatch> >&);
virtual void setScriptSource(ErrorString*, const String& scriptId, const String& newContent, const bool* preview, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame> >& newCallFrames, RefPtr<InspectorObject>& result);
+ virtual void restartFrame(ErrorString*, const String& callFrameId, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame> >& newCallFrames, RefPtr<InspectorObject>& result);
virtual void getScriptSource(ErrorString*, const String& scriptId, String* scriptSource);
virtual void getFunctionDetails(ErrorString*, const String& functionId, RefPtr<TypeBuilder::Debugger::FunctionDetails>&);
void schedulePauseOnNextStatement(InspectorFrontend::Debugger::Reason::Enum breakReason, PassRefPtr<InspectorObject> data);
Modified: trunk/Source/WebCore/inspector/_javascript_CallFrame.idl (120708 => 120709)
--- trunk/Source/WebCore/inspector/_javascript_CallFrame.idl 2012-06-19 14:03:15 UTC (rev 120708)
+++ trunk/Source/WebCore/inspector/_javascript_CallFrame.idl 2012-06-19 14:03:48 UTC (rev 120709)
@@ -39,6 +39,7 @@
const unsigned short CATCH_SCOPE = 4;
[Custom] void evaluate(in DOMString script);
+ [Custom] DOMObject restart();
readonly attribute _javascript_CallFrame caller;
readonly attribute long sourceID;