Index: Source/core/inspector/InjectedScript.cpp |
diff --git a/Source/core/inspector/InjectedScript.cpp b/Source/core/inspector/InjectedScript.cpp |
index 3c9e690515316653b67bd7ec9295befda7a01f78..08f3881d9e675e2b59b12d49017192cd33a2ae45 100644 |
--- a/Source/core/inspector/InjectedScript.cpp |
+++ b/Source/core/inspector/InjectedScript.cpp |
@@ -47,17 +47,17 @@ using WebCore::TypeBuilder::Runtime::RemoteObject; |
namespace WebCore { |
-InjectedScript::InjectedScript() |
- : InjectedScriptBase("InjectedScript") |
+V8InjectedScript::V8InjectedScript() |
+ : V8InjectedScriptBase("InjectedScript") |
{ |
} |
-InjectedScript::InjectedScript(ScriptObject injectedScriptObject, InspectedStateAccessCheck accessCheck) |
- : InjectedScriptBase("InjectedScript", injectedScriptObject, accessCheck) |
+V8InjectedScript::V8InjectedScript(ScriptObject injectedScriptObject, InspectedStateAccessCheck accessCheck) |
+ : V8InjectedScriptBase("InjectedScript", injectedScriptObject, accessCheck) |
{ |
} |
-void InjectedScript::evaluate(ErrorString* errorString, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown) |
+void V8InjectedScript::evaluate(ErrorString* errorString, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown) |
{ |
ScriptFunctionCall function(injectedScriptObject(), "evaluate"); |
function.appendArgument(expression); |
@@ -68,7 +68,7 @@ void InjectedScript::evaluate(ErrorString* errorString, const String& expression |
makeEvalCall(errorString, function, result, wasThrown); |
} |
-void InjectedScript::callFunctionOn(ErrorString* errorString, const String& objectId, const String& expression, const String& arguments, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown) |
+void V8InjectedScript::callFunctionOn(ErrorString* errorString, const String& objectId, const String& expression, const String& arguments, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown) |
{ |
ScriptFunctionCall function(injectedScriptObject(), "callFunctionOn"); |
function.appendArgument(objectId); |
@@ -79,11 +79,16 @@ void InjectedScript::callFunctionOn(ErrorString* errorString, const String& obje |
makeEvalCall(errorString, function, result, wasThrown); |
} |
-void InjectedScript::evaluateOnCallFrame(ErrorString* errorString, const ScriptValue& callFrames, const Vector<ScriptValue>& asyncCallStacks, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, RefPtr<RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown) |
+void V8InjectedScript::evaluateOnCallFrame(ErrorString* errorString, const StackTrace& callFrames, const Vector<StackTrace>& asyncCallStacks, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, RefPtr<RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown) |
{ |
ScriptFunctionCall function(injectedScriptObject(), "evaluateOnCallFrame"); |
- function.appendArgument(callFrames); |
- function.appendArgument(asyncCallStacks); |
+ function.appendArgument(callFrames.asJavaScript()); |
+ Vector<ScriptValue> asyncCallStacksJavaScript; |
+ for (size_t i = 0; i < asyncCallStacks.size(); i++) { |
+ if (asyncCallStacks[i].isJavaScript()) |
+ asyncCallStacksJavaScript.append(asyncCallStacks[i].asJavaScript()); |
+ } |
+ function.appendArgument(asyncCallStacksJavaScript); |
function.appendArgument(callFrameId); |
function.appendArgument(expression); |
function.appendArgument(objectGroup); |
@@ -93,10 +98,31 @@ void InjectedScript::evaluateOnCallFrame(ErrorString* errorString, const ScriptV |
makeEvalCall(errorString, function, result, wasThrown); |
} |
-void InjectedScript::restartFrame(ErrorString* errorString, const ScriptValue& callFrames, const String& callFrameId, RefPtr<JSONObject>* result) |
+void V8InjectedScript::getCompletionsOnCallFrame(ErrorString* errorString, const StackTrace& callFrames, const Vector<StackTrace>& asyncCallStacks, const String& callFrameId, const String& expression, RefPtr<TypeBuilder::Array<String> >* result) |
+{ |
+ ScriptFunctionCall function(injectedScriptObject(), "getCompletionsOnCallFrame"); |
+ function.appendArgument(callFrames.asJavaScript()); |
+ Vector<ScriptValue> asyncCallStacksJavaScript; |
+ for (size_t i = 0; i < asyncCallStacks.size(); i++) { |
+ if (asyncCallStacks[i].isJavaScript()) |
+ asyncCallStacksJavaScript.append(asyncCallStacks[i].asJavaScript()); |
+ } |
+ function.appendArgument(asyncCallStacksJavaScript); |
+ function.appendArgument(callFrameId); |
+ function.appendArgument(expression); |
+ RefPtr<JSONValue> resultValue; |
+ makeCall(function, &resultValue); |
+ if (!resultValue || resultValue->type() != JSONValue::TypeArray) { |
+ *errorString = "Internal error"; |
+ return; |
+ } |
+ *result = Array<String>::runtimeCast(resultValue); |
+} |
+ |
+void V8InjectedScript::restartFrame(ErrorString* errorString, const StackTrace& callFrames, const String& callFrameId, RefPtr<JSONObject>* result) |
{ |
ScriptFunctionCall function(injectedScriptObject(), "restartFrame"); |
- function.appendArgument(callFrames); |
+ function.appendArgument(callFrames.asJavaScript()); |
function.appendArgument(callFrameId); |
RefPtr<JSONValue> resultValue; |
makeCall(function, &resultValue); |
@@ -113,10 +139,10 @@ void InjectedScript::restartFrame(ErrorString* errorString, const ScriptValue& c |
*errorString = "Internal error"; |
} |
-void InjectedScript::getStepInPositions(ErrorString* errorString, const ScriptValue& callFrames, const String& callFrameId, RefPtr<Array<TypeBuilder::Debugger::Location> >& positions) |
+void V8InjectedScript::getStepInPositions(ErrorString* errorString, const StackTrace& callFrames, const String& callFrameId, RefPtr<Array<TypeBuilder::Debugger::Location> >& positions) |
{ |
ScriptFunctionCall function(injectedScriptObject(), "getStepInPositions"); |
- function.appendArgument(callFrames); |
+ function.appendArgument(callFrames.asJavaScript()); |
function.appendArgument(callFrameId); |
RefPtr<JSONValue> resultValue; |
makeCall(function, &resultValue); |
@@ -133,11 +159,11 @@ void InjectedScript::getStepInPositions(ErrorString* errorString, const ScriptVa |
*errorString = "Internal error"; |
} |
-void InjectedScript::setVariableValue(ErrorString* errorString, const ScriptValue& callFrames, const String* callFrameIdOpt, const String* functionObjectIdOpt, int scopeNumber, const String& variableName, const String& newValueStr) |
+void V8InjectedScript::setVariableValue(ErrorString* errorString, const StackTrace& callFrames, const String* callFrameIdOpt, const String* functionObjectIdOpt, int scopeNumber, const String& variableName, const String& newValueStr) |
{ |
ScriptFunctionCall function(injectedScriptObject(), "setVariableValue"); |
if (callFrameIdOpt) { |
- function.appendArgument(callFrames); |
+ function.appendArgument(callFrames.asJavaScript()); |
function.appendArgument(*callFrameIdOpt); |
} else { |
function.appendArgument(false); |
@@ -163,7 +189,7 @@ void InjectedScript::setVariableValue(ErrorString* errorString, const ScriptValu |
// Normal return. |
} |
-void InjectedScript::getFunctionDetails(ErrorString* errorString, const String& functionId, RefPtr<FunctionDetails>* result) |
+void V8InjectedScript::getFunctionDetails(ErrorString* errorString, const String& functionId, RefPtr<FunctionDetails>* result) |
{ |
ScriptFunctionCall function(injectedScriptObject(), "getFunctionDetails"); |
function.appendArgument(functionId); |
@@ -177,7 +203,21 @@ void InjectedScript::getFunctionDetails(ErrorString* errorString, const String& |
*result = FunctionDetails::runtimeCast(resultValue); |
} |
-void InjectedScript::getProperties(ErrorString* errorString, const String& objectId, bool ownProperties, bool accessorPropertiesOnly, RefPtr<Array<PropertyDescriptor> >* properties) |
+void V8InjectedScript::getCompletions(ErrorString* errorString, const String& expression, RefPtr<TypeBuilder::Array<String> >* result) |
+{ |
+ *result = TypeBuilder::Array<String>::create(); |
+ ScriptFunctionCall function(injectedScriptObject(), "getCompletions"); |
+ function.appendArgument(expression); |
+ RefPtr<JSONValue> resultValue; |
+ makeCall(function, &resultValue); |
+ if (!resultValue || resultValue->type() != JSONValue::TypeArray) { |
+ *errorString = "Internal error"; |
+ return; |
+ } |
+ *result = Array<String>::runtimeCast(resultValue); |
+} |
+ |
+void V8InjectedScript::getProperties(ErrorString* errorString, const String& objectId, bool ownProperties, bool accessorPropertiesOnly, RefPtr<Array<PropertyDescriptor> >* properties) |
{ |
ScriptFunctionCall function(injectedScriptObject(), "getProperties"); |
function.appendArgument(objectId); |
@@ -193,7 +233,7 @@ void InjectedScript::getProperties(ErrorString* errorString, const String& objec |
*properties = Array<PropertyDescriptor>::runtimeCast(result); |
} |
-void InjectedScript::getInternalProperties(ErrorString* errorString, const String& objectId, RefPtr<Array<InternalPropertyDescriptor> >* properties) |
+void V8InjectedScript::getInternalProperties(ErrorString* errorString, const String& objectId, RefPtr<Array<InternalPropertyDescriptor> >* properties) |
{ |
ScriptFunctionCall function(injectedScriptObject(), "getInternalProperties"); |
function.appendArgument(objectId); |
@@ -209,7 +249,15 @@ void InjectedScript::getInternalProperties(ErrorString* errorString, const Strin |
*properties = array; |
} |
-Node* InjectedScript::nodeForObjectId(const String& objectId) |
+void V8InjectedScript::getProperty(ErrorString* errorString, const String& objectId, const RefPtr<JSONArray>& propertyPath, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown) |
+{ |
+ ScriptFunctionCall function(injectedScriptObject(), "getProperty"); |
+ function.appendArgument(objectId); |
+ function.appendArgument(propertyPath); |
+ makeEvalCall(errorString, function, result, wasThrown); |
+} |
+ |
+Node* V8InjectedScript::nodeForObjectId(const String& objectId) |
{ |
if (isEmpty() || !canAccessInspectedWindow()) |
return 0; |
@@ -224,7 +272,7 @@ Node* InjectedScript::nodeForObjectId(const String& objectId) |
return InjectedScriptHost::scriptValueAsNode(resultValue); |
} |
-void InjectedScript::releaseObject(const String& objectId) |
+void V8InjectedScript::releaseObject(const String& objectId) |
{ |
ScriptFunctionCall function(injectedScriptObject(), "releaseObject"); |
function.appendArgument(objectId); |
@@ -232,11 +280,11 @@ void InjectedScript::releaseObject(const String& objectId) |
makeCall(function, &result); |
} |
-PassRefPtr<Array<CallFrame> > InjectedScript::wrapCallFrames(const ScriptValue& callFrames, int asyncOrdinal) |
+PassRefPtr<Array<CallFrame> > V8InjectedScript::wrapCallFrames(const StackTrace& callFrames, int asyncOrdinal) |
{ |
ASSERT(!isEmpty()); |
ScriptFunctionCall function(injectedScriptObject(), "wrapCallFrames"); |
- function.appendArgument(callFrames); |
+ function.appendArgument(callFrames.asJavaScript()); |
function.appendArgument(asyncOrdinal); |
bool hadException = false; |
ScriptValue callFramesValue = callFunctionWithEvalEnabled(function, hadException); |
@@ -247,7 +295,7 @@ PassRefPtr<Array<CallFrame> > InjectedScript::wrapCallFrames(const ScriptValue& |
return Array<CallFrame>::create(); |
} |
-PassRefPtr<TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapObject(const ScriptValue& value, const String& groupName, bool generatePreview) const |
+PassRefPtr<TypeBuilder::Runtime::RemoteObject> V8InjectedScript::wrapObject(const ScriptValue& value, const String& groupName, bool generatePreview) |
{ |
ASSERT(!isEmpty()); |
ScriptFunctionCall wrapFunction(injectedScriptObject(), "wrapObject"); |
@@ -263,7 +311,7 @@ PassRefPtr<TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapObject(const |
return TypeBuilder::Runtime::RemoteObject::runtimeCast(rawResult); |
} |
-PassRefPtr<TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapTable(const ScriptValue& table, const ScriptValue& columns) const |
+PassRefPtr<TypeBuilder::Runtime::RemoteObject> V8InjectedScript::wrapTable(const ScriptValue& table, const ScriptValue& columns) |
{ |
ASSERT(!isEmpty()); |
ScriptFunctionCall wrapFunction(injectedScriptObject(), "wrapTable"); |
@@ -281,12 +329,12 @@ PassRefPtr<TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapTable(const S |
return TypeBuilder::Runtime::RemoteObject::runtimeCast(rawResult); |
} |
-PassRefPtr<TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapNode(Node* node, const String& groupName) |
+PassRefPtr<TypeBuilder::Runtime::RemoteObject> V8InjectedScript::wrapNode(Node* node, const String& groupName) |
{ |
return wrapObject(nodeAsScriptValue(node), groupName); |
} |
-ScriptValue InjectedScript::findObjectById(const String& objectId) const |
+ScriptValue V8InjectedScript::findObjectById(const String& objectId) const |
{ |
ASSERT(!isEmpty()); |
ScriptFunctionCall function(injectedScriptObject(), "findObjectById"); |
@@ -298,22 +346,23 @@ ScriptValue InjectedScript::findObjectById(const String& objectId) const |
return resultValue; |
} |
-ScriptValue InjectedScript::findCallFrameById(ErrorString* errorString, const ScriptValue& topCallFrame, const String& callFrameId) |
+ActivationFrame V8InjectedScript::findCallFrameById(ErrorString* errorString, const StackTrace& topCallFrame, const String& callFrameId) |
{ |
+ ASSERT(topCallFrame.isJavaScript()); |
ScriptFunctionCall function(injectedScriptObject(), "callFrameForId"); |
- function.appendArgument(topCallFrame); |
+ function.appendArgument(topCallFrame.asJavaScript()); |
function.appendArgument(callFrameId); |
bool hadException = false; |
ScriptValue resultValue = callFunctionWithEvalEnabled(function, hadException); |
ASSERT(!hadException); |
if (hadException || resultValue.isEmpty() || !resultValue.isObject()) { |
*errorString = "Internal error"; |
- return ScriptValue(); |
+ return ActivationFrame(); |
} |
- return resultValue; |
+ return ActivationFrame(resultValue); |
} |
-void InjectedScript::inspectNode(Node* node) |
+void V8InjectedScript::inspectNode(Node* node) |
{ |
ASSERT(!isEmpty()); |
ScriptFunctionCall function(injectedScriptObject(), "inspectNode"); |
@@ -322,7 +371,7 @@ void InjectedScript::inspectNode(Node* node) |
makeCall(function, &result); |
} |
-void InjectedScript::releaseObjectGroup(const String& objectGroup) |
+void V8InjectedScript::releaseObjectGroup(const String& objectGroup) |
{ |
ASSERT(!isEmpty()); |
ScriptFunctionCall releaseFunction(injectedScriptObject(), "releaseObjectGroup"); |
@@ -332,7 +381,7 @@ void InjectedScript::releaseObjectGroup(const String& objectGroup) |
ASSERT(!hadException); |
} |
-ScriptValue InjectedScript::nodeAsScriptValue(Node* node) |
+ScriptValue V8InjectedScript::nodeAsScriptValue(Node* node) |
{ |
return InjectedScriptHost::nodeAsScriptValue(scriptState(), node); |
} |