"id": this._requestId };
if (InspectorTest._dumpInspectorProtocolMessages)
- testRunner.logToStderr("backend: " + JSON.stringify(messageObject));
+ testRunner.logToStderr("frontend: " + JSON.stringify(messageObject));
InspectorFrontendHost.sendMessageToBackend(JSON.stringify(messageObject));
return this._requestId;
}
/**
- * @param {string} message
+ * @param {string|!Object} messageOrObject
*/
-InspectorFrontendAPI.dispatchMessage = function(message)
+InspectorFrontendAPI.dispatchMessage = function(messageOrObject)
{
if (InspectorTest._dumpInspectorProtocolMessages)
- testRunner.logToStderr("frontend: " + message);
- var messageObject = JSON.parse(message);
+ testRunner.logToStderr("backend: " + (typeof messageOrObject === "string" ? messageOrObject : JSON.stringify(messageOrObject)));
+ var messageObject = (typeof messageOrObject === "string" ? JSON.parse(messageOrObject) : messageOrObject);
var messageId = messageObject["id"];
try {
if (typeof messageId === "number") {
eventHandler(messageObject);
}
} catch(e) {
- InspectorTest.log("Exception when dispatching message: " + e + "\n\n message = " + JSON.stringify(messageObject, null, 2));
+ InspectorTest.log("Exception when dispatching message: " + e + "\n" + e.stack + "\n message = " + JSON.stringify(messageObject, null, 2));
InspectorTest.completeTest();
}
}
* @param {string} message
* @param {!function} callback
*/
-InspectorTest.executeInPage = function(string, callback)
+InspectorTest.evaluateInPage = function(string, callback)
{
this.sendCommand("Runtime.evaluate", { "expression": string }, function(message) {
if (message.error)