Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Unified Diff: third_party/WebKit/Source/devtools/front_end/sdk/ConsoleModel.js

Issue 1511043002: [DevTools] Evaluate expression like { ... } as Object Literal (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/console/console-eval-object-literal-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/sdk/ConsoleModel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/ConsoleModel.js b/third_party/WebKit/Source/devtools/front_end/sdk/ConsoleModel.js
index acc0d6bb1d41cc4f2159694762d48dbc21a71ffd..a814dca6b604a979f096a01c54d0c6eb5dc55165 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/ConsoleModel.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/ConsoleModel.js
@@ -189,7 +189,6 @@ WebInspector.ConsoleModel.prototype = {
*/
WebInspector.ConsoleModel.evaluateCommandInConsole = function(executionContext, text, useCommandLineAPI)
{
- useCommandLineAPI = !!useCommandLineAPI;
var target = executionContext.target();
var commandMessage = new WebInspector.ConsoleMessage(target, WebInspector.ConsoleMessage.MessageSource.JS, null, text, WebInspector.ConsoleMessage.MessageType.Command);
@@ -213,8 +212,9 @@ WebInspector.ConsoleModel.evaluateCommandInConsole = function(executionContext,
target.consoleModel.dispatchEventToListeners(WebInspector.ConsoleModel.Events.CommandEvaluated, {result: result, wasThrown: wasThrown, text: text, commandMessage: commandMessage, exceptionDetails: exceptionDetails});
}
}
-
- executionContext.evaluate(text, "console", useCommandLineAPI, false, false, true, printResult);
+ if (/^\s*\{/.test(text) && /\}\s*$/.test(text))
+ text = '(' + text + ')';
+ executionContext.evaluate(text, "console", !!useCommandLineAPI, false, false, true, printResult);
WebInspector.userMetrics.actionTaken(WebInspector.UserMetrics.Action.ConsoleEvaluated);
}
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/console/console-eval-object-literal-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698