Log Message
Web Inspector: use dedicated type for object id in the protocol. https://bugs.webkit.org/show_bug.cgi?id=65110
Reviewed by Yury Semikhatsky. Source/WebCore: * inspector/InjectedScript.cpp: (WebCore::InjectedScript::callFunctionOn): * inspector/InjectedScript.h: * inspector/InjectedScriptSource.js: (.): * inspector/Inspector.json: * inspector/InspectorRuntimeAgent.cpp: (WebCore::InspectorRuntimeAgent::callFunctionOn): LayoutTests: * inspector/runtime/runtime-callFunctionOn-expected.txt: * inspector/runtime/runtime-callFunctionOn.html:
Modified Paths
- trunk/LayoutTests/ChangeLog
- trunk/LayoutTests/inspector/runtime/runtime-callFunctionOn-expected.txt
- trunk/LayoutTests/inspector/runtime/runtime-callFunctionOn.html
- trunk/Source/WebCore/ChangeLog
- trunk/Source/WebCore/inspector/InjectedScript.cpp
- trunk/Source/WebCore/inspector/InjectedScript.h
- trunk/Source/WebCore/inspector/InjectedScriptSource.js
- trunk/Source/WebCore/inspector/Inspector.json
- trunk/Source/WebCore/inspector/InspectorRuntimeAgent.cpp
Diff
Modified: trunk/LayoutTests/ChangeLog (91667 => 91668)
--- trunk/LayoutTests/ChangeLog 2011-07-25 14:48:10 UTC (rev 91667)
+++ trunk/LayoutTests/ChangeLog 2011-07-25 15:10:43 UTC (rev 91668)
@@ -1,5 +1,15 @@
2011-07-25 Pavel Feldman <[email protected]>
+ Web Inspector: use dedicated type for object id in the protocol.
+ https://bugs.webkit.org/show_bug.cgi?id=65110
+
+ Reviewed by Yury Semikhatsky.
+
+ * inspector/runtime/runtime-callFunctionOn-expected.txt:
+ * inspector/runtime/runtime-callFunctionOn.html:
+
+2011-07-25 Pavel Feldman <[email protected]>
+
Web Inspector: refactor remote object structure to contain value for primitive values.
https://bugs.webkit.org/show_bug.cgi?id=65103
Modified: trunk/LayoutTests/inspector/runtime/runtime-callFunctionOn-expected.txt (91667 => 91668)
--- trunk/LayoutTests/inspector/runtime/runtime-callFunctionOn-expected.txt 2011-07-25 14:48:10 UTC (rev 91667)
+++ trunk/LayoutTests/inspector/runtime/runtime-callFunctionOn-expected.txt 2011-07-25 15:10:43 UTC (rev 91668)
@@ -8,4 +8,6 @@
{"a":1,"b":2}
{"a":1,"b":2}
{"c":1,"d":2}
+4
+undefined
Modified: trunk/LayoutTests/inspector/runtime/runtime-callFunctionOn.html (91667 => 91668)
--- trunk/LayoutTests/inspector/runtime/runtime-callFunctionOn.html 2011-07-25 14:48:10 UTC (rev 91667)
+++ trunk/LayoutTests/inspector/runtime/runtime-callFunctionOn.html 2011-07-25 15:10:43 UTC (rev 91668)
@@ -37,13 +37,13 @@
function step1(error, result, wasThrown)
{
- function format(aobj1, aobj2)
+ function format(aobj1, aobj2, val, undef)
{
- return JSON.stringify(this) + "\n" + JSON.stringify(aobj1) + "\n" + JSON.stringify(aobj2);
+ return JSON.stringify(this) + "\n" + JSON.stringify(aobj1) + "\n" + JSON.stringify(aobj2) + "\n" + val + "\n" + undef;
}
obj2 = result;
- RuntimeAgent.callFunctionOn(obj1.objectId, format.toString(), [obj1.objectId, obj2.objectId], step2);
+ RuntimeAgent.callFunctionOn(obj1.objectId, format.toString(), [obj1, obj2, {value:4}, {}], step2);
}
function step2(error, result, wasThrown)
Modified: trunk/Source/WebCore/ChangeLog (91667 => 91668)
--- trunk/Source/WebCore/ChangeLog 2011-07-25 14:48:10 UTC (rev 91667)
+++ trunk/Source/WebCore/ChangeLog 2011-07-25 15:10:43 UTC (rev 91668)
@@ -1,3 +1,19 @@
+2011-07-25 Pavel Feldman <[email protected]>
+
+ Web Inspector: use dedicated type for object id in the protocol.
+ https://bugs.webkit.org/show_bug.cgi?id=65110
+
+ Reviewed by Yury Semikhatsky.
+
+ * inspector/InjectedScript.cpp:
+ (WebCore::InjectedScript::callFunctionOn):
+ * inspector/InjectedScript.h:
+ * inspector/InjectedScriptSource.js:
+ (.):
+ * inspector/Inspector.json:
+ * inspector/InspectorRuntimeAgent.cpp:
+ (WebCore::InspectorRuntimeAgent::callFunctionOn):
+
2011-07-25 Yury Semikhatsky <[email protected]>
[Chromium] Web Inspector: live edit error should be revealed in Console
Modified: trunk/Source/WebCore/inspector/InjectedScript.cpp (91667 => 91668)
--- trunk/Source/WebCore/inspector/InjectedScript.cpp 2011-07-25 14:48:10 UTC (rev 91667)
+++ trunk/Source/WebCore/inspector/InjectedScript.cpp 2011-07-25 15:10:43 UTC (rev 91668)
@@ -63,19 +63,12 @@
makeEvalCall(errorString, function, result, wasThrown);
}
-void InjectedScript::callFunctionOn(ErrorString* errorString, const String& objectId, const String& _expression_, PassRefPtr<InspectorArray> arguments, RefPtr<InspectorObject>* result, bool* wasThrown)
+void InjectedScript::callFunctionOn(ErrorString* errorString, const String& objectId, const String& _expression_, const String& arguments, RefPtr<InspectorObject>* result, bool* wasThrown)
{
ScriptFunctionCall function(m_injectedScriptObject, "callFunctionOn");
function.appendArgument(objectId);
function.appendArgument(_expression_);
- for (unsigned i = 0; i < arguments->length(); ++i) {
- String argumentId;
- if (!arguments->get(i)->asString(&argumentId)) {
- *errorString = "Call argument should be an object id";
- return;
- }
- function.appendArgument(argumentId);
- }
+ function.appendArgument(arguments);
makeEvalCall(errorString, function, result, wasThrown);
}
Modified: trunk/Source/WebCore/inspector/InjectedScript.h (91667 => 91668)
--- trunk/Source/WebCore/inspector/InjectedScript.h 2011-07-25 14:48:10 UTC (rev 91667)
+++ trunk/Source/WebCore/inspector/InjectedScript.h 2011-07-25 15:10:43 UTC (rev 91668)
@@ -56,7 +56,7 @@
bool hasNoValue() const { return m_injectedScriptObject.hasNoValue(); }
void evaluate(ErrorString*, const String& _expression_, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorObject>* result, bool* wasThrown);
- void callFunctionOn(ErrorString*, const String& objectId, const String& _expression_, PassRefPtr<InspectorArray> arguments, RefPtr<InspectorObject>* result, bool* wasThrown);
+ void callFunctionOn(ErrorString*, const String& objectId, const String& _expression_, const String& arguments, RefPtr<InspectorObject>* result, bool* wasThrown);
void evaluateOnCallFrame(ErrorString*, const ScriptValue& callFrames, const String& callFrameId, const String& _expression_, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorObject>* result, bool* wasThrown);
void getProperties(ErrorString*, const String& objectId, bool ignoreHasOwnProperty, RefPtr<InspectorArray>* result);
Node* nodeForObjectId(const String& objectId);
Modified: trunk/Source/WebCore/inspector/InjectedScriptSource.js (91667 => 91668)
--- trunk/Source/WebCore/inspector/InjectedScriptSource.js 2011-07-25 14:48:10 UTC (rev 91667)
+++ trunk/Source/WebCore/inspector/InjectedScriptSource.js 2011-07-25 15:10:43 UTC (rev 91668)
@@ -277,24 +277,33 @@
return this._evaluateAndWrap(InjectedScriptHost.evaluate, InjectedScriptHost, _expression_, objectGroup, false, injectCommandLineAPI);
},
- callFunctionOn: function(objectId, _expression_)
+ callFunctionOn: function(objectId, _expression_, args)
{
var parsedObjectId = this._parseObjectId(objectId);
var object = this._objectForId(parsedObjectId);
if (!object)
return "Could not find object with given id";
- var resolvedArgs = [];
- for (var i = 2; i < arguments.length; ++i) {
- var parsedArgId = this._parseObjectId(arguments[i]);
- if (!parsedArgId || parsedArgId.injectedScriptId !== injectedScriptId)
- return "Arguments should belong to the same _javascript_ world as the target object.";
-
- var resolvedArg = this._objectForId(parsedArgId);
- if (!resolvedArg)
- return "Could not find object with given id";
+ if (args) {
+ var resolvedArgs = [];
+ args = InjectedScriptHost.evaluate(args);
+ for (var i = 0; i < args.length; ++i) {
+ var objectId = args[i].objectId;
+ if (objectId) {
+ var parsedArgId = this._parseObjectId(objectId);
+ if (!parsedArgId || parsedArgId.injectedScriptId !== injectedScriptId)
+ return "Arguments should belong to the same _javascript_ world as the target object.";
- resolvedArgs.push(resolvedArg);
+ var resolvedArg = this._objectForId(parsedArgId);
+ if (!resolvedArg)
+ return "Could not find object with given id";
+
+ resolvedArgs.push(resolvedArg);
+ } else if (args[i].value)
+ resolvedArgs.push(args[i].value);
+ else
+ resolvedArgs.push(undefined);
+ }
}
try {
Modified: trunk/Source/WebCore/inspector/Inspector.json (91667 => 91668)
--- trunk/Source/WebCore/inspector/Inspector.json 2011-07-25 14:48:10 UTC (rev 91667)
+++ trunk/Source/WebCore/inspector/Inspector.json 2011-07-25 15:10:43 UTC (rev 91668)
@@ -218,6 +218,11 @@
"description": "Runtime domain exposes _javascript_ runtime by means of remote evaluation and mirror objects. Evaluation results are returned as mirror object that expose type, string representation and unique identifier that can be used for further object interaction. Original objects are maintained in memory unless they are either explicitly released or are released along with the other objects in their object group.",
"types": [
{
+ "id": "RemoteObjectId",
+ "type": "string",
+ "description": "Unique object identifier."
+ },
+ {
"id": "RemoteObject",
"type": "object",
"description": "Mirror object referencing original _javascript_ object.",
@@ -227,7 +232,7 @@
{ "name": "className", "type": "string", "optional": true, "description": "Object class (constructor) name. Specified for <code>object</code> type values only." },
{ "name": "value", "type": "any", "optional": true, "description": "Remote object value (in case of primitive values)." },
{ "name": "description", "type": "string", "optional": true, "description": "String representation of the object." },
- { "name": "objectId", "type": "string", "optional": true, "description": "Unique object identifier (for non-primitive values)." }
+ { "name": "objectId", "$ref": "RemoteObjectId", "optional": true, "description": "Unique object identifier (for non-primitive values)." }
]
},
{
@@ -240,6 +245,15 @@
{ "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if exception was thrown on attempt to get the property value, in that case the value propery will contain thrown value." },
{ "name": "isGetter", "type": "boolean", "optional": true, "description": "True if this property is getter." }
]
+ },
+ {
+ "id": "CallArgument",
+ "type": "object",
+ "description": "Represents function call argument. Either remote object id <code>objectId</code> or primitive <code>value</code> or neither of (for undefined) them should be specified.",
+ "properties": [
+ { "name": "value", "type": "any", "optional": true, "description": "Primitive value." },
+ { "name": "objectId", "$ref": "RemoteObject", "optional": true, "description": "Remote object handle." }
+ ]
}
],
"commands": [
@@ -255,25 +269,25 @@
{ "name": "result", "$ref": "RemoteObject", "description": "Evaluation result." },
{ "name": "wasThrown", "type": "boolean", "optional": true, "description": "True iff the result was thrown during the evaluation." }
],
- "description": "Evaluate _expression_ on global object."
+ "description": "Evaluates _expression_ on global object."
},
{
"name": "callFunctionOn",
"parameters": [
- { "name": "objectId", "type": "string", "description": "Identifier of the object to call function on." },
+ { "name": "objectId", "$ref": "RemoteObjectId", "description": "Identifier of the object to call function on." },
{ "name": "functionDeclaration", "type": "string", "description": "Declaration of the function to call." },
- { "name": "arguments", "type": "array", "items": { "type": "string", "description": "Identifier of the argument." }, "optional": true, "description": "Call arguments. All call arguments must belong to the same _javascript_ world as the target object." }
+ { "name": "arguments", "type": "array", "items": { "$ref": "CallArgument", "description": "Call argument." }, "optional": true, "description": "Call arguments. All call arguments must belong to the same _javascript_ world as the target object." }
],
"returns": [
{ "name": "result", "$ref": "RemoteObject", "description": "Call result." },
{ "name": "wasThrown", "type": "boolean", "optional": true, "description": "True iff the result was thrown during the evaluation." }
],
- "description": "Call function with given declaration on the given object."
+ "description": "Calls function with given declaration on the given object."
},
{
"name": "getProperties",
"parameters": [
- { "name": "objectId", "type": "string", "description": "Identifier of the object to return properties for." },
+ { "name": "objectId", "$ref": "RemoteObjectId", "description": "Identifier of the object to return properties for." },
{ "name": "ignoreHasOwnProperty", "type": "boolean", "description": "If true, returns properties belonging to any element of the prototype chain." }
],
"returns": [
@@ -284,7 +298,7 @@
{
"name": "setPropertyValue",
"parameters": [
- { "name": "objectId", "type": "string", "description": "Identifier of the object to set property on." },
+ { "name": "objectId", "$ref": "RemoteObjectId", "description": "Identifier of the object to set property on." },
{ "name": "propertyName", "type": "string", "description": "Property name to set value for." },
{ "name": "_expression_", "type": "string", "description": "_expression_ to evaluate." }
],
@@ -293,7 +307,7 @@
{
"name": "releaseObject",
"parameters": [
- { "name": "objectId", "type": "string", "description": "Identifier of the object to release." }
+ { "name": "objectId", "$ref": "RemoteObjectId", "description": "Identifier of the object to release." }
],
"description": "Releases remote object with given id."
},
@@ -967,7 +981,7 @@
{
"name": "pushNodeToFrontend",
"parameters": [
- { "name": "objectId", "type": "string", "description": "_javascript_ object id to convert into node." }
+ { "name": "objectId", "$ref": "Runtime.RemoteObjectId", "description": "_javascript_ object id to convert into node." }
],
"returns": [
{ "name": "nodeId", "type": "integer", "description": "Node id for given object." }
@@ -1395,7 +1409,7 @@
{
"name": "start",
"parameters": [
- { "name": "maxCallStackDepth", "optional": true, "type": "integer", "description": "Samples _javascript_ stack traces up to <code>maxCallStackDepth</code>, defaults to 5." },
+ { "name": "maxCallStackDepth", "optional": true, "type": "integer", "description": "Samples _javascript_ stack traces up to <code>maxCallStackDepth</code>, defaults to 5." }
],
"description": "Starts capturing instrumentation events."
},
Modified: trunk/Source/WebCore/inspector/InspectorRuntimeAgent.cpp (91667 => 91668)
--- trunk/Source/WebCore/inspector/InspectorRuntimeAgent.cpp 2011-07-25 14:48:10 UTC (rev 91667)
+++ trunk/Source/WebCore/inspector/InspectorRuntimeAgent.cpp 2011-07-25 15:10:43 UTC (rev 91668)
@@ -89,11 +89,9 @@
*errorString = "Inspected frame has gone";
return;
}
- RefPtr<InspectorArray> arguments = InspectorArray::create();
- if (optionalArguments) {
- for (unsigned i = 0; i < (*optionalArguments)->length(); ++i)
- arguments->pushValue((*optionalArguments)->get(i));
- }
+ String arguments;
+ if (optionalArguments)
+ arguments = (*optionalArguments)->toJSONString();
injectedScript.callFunctionOn(errorString, objectId, _expression_, arguments, result, wasThrown);
}
_______________________________________________ webkit-changes mailing list [email protected] http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes
