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

Unified Diff: Source/WebCore/inspector/front-end/ConsoleView.js

Issue 7034027: Merge 86768 - 2011-05-18 Pavel Feldman <pfeldman@google.com> (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/742/
Patch Set: Created 9 years, 7 months 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
Index: Source/WebCore/inspector/front-end/ConsoleView.js
===================================================================
--- Source/WebCore/inspector/front-end/ConsoleView.js (revision 86772)
+++ Source/WebCore/inspector/front-end/ConsoleView.js (working copy)
@@ -344,6 +344,12 @@
// Pass less stop characters to rangeOfWord so the range will be a more complete expression.
var expressionRange = wordRange.startContainer.rangeOfWord(wordRange.startOffset, ExpressionStopCharacters, this.promptElement, "backward");
var expressionString = expressionRange.toString();
+ var prefix = wordRange.toString();
+ this._completions(expressionString, prefix, bestMatchOnly, completionsReadyCallback);
+ },
+
+ _completions: function(expressionString, prefix, bestMatchOnly, completionsReadyCallback)
+ {
var lastIndex = expressionString.length - 1;
var dotNotation = (expressionString[lastIndex] === ".");
@@ -352,11 +358,13 @@
if (dotNotation || bracketNotation)
expressionString = expressionString.substr(0, lastIndex);
- var prefix = wordRange.toString();
if (!expressionString && !prefix)
return;
- this.evalInInspectedWindow(expressionString, "completion", true, evaluated.bind(this));
+ if (!expressionString && WebInspector.panels.scripts.paused)
+ WebInspector.panels.scripts.getSelectedCallFrameVariables(reportCompletions.bind(this));
+ else
+ this.evalInInspectedWindow(expressionString, "completion", true, evaluated.bind(this));
function evaluated(result)
{
@@ -368,14 +376,22 @@
function evaluatedProperties(properties)
{
RuntimeAgent.releaseObjectGroup("completion");
- var propertyNames = [];
+ var propertyNames = {};
for (var i = 0; properties && i < properties.length; ++i)
- propertyNames.push(properties[i].name);
+ propertyNames[properties[i].name] = true;
+ reportCompletions.call(this, propertyNames);
+ }
+ function reportCompletions(propertyNames)
+ {
var includeCommandLineAPI = (!dotNotation && !bracketNotation);
- if (includeCommandLineAPI)
- propertyNames.splice(0, 0, "dir", "dirxml", "keys", "values", "profile", "profileEnd", "monitorEvents", "unmonitorEvents", "inspect", "copy", "clear");
- this._reportCompletions(bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix, propertyNames);
+ if (includeCommandLineAPI) {
+ const commandLineAPI = ["dir", "dirxml", "keys", "values", "profile", "profileEnd", "monitorEvents", "unmonitorEvents", "inspect", "copy", "clear"];
+ for (var i = 0; i < commandLineAPI.length; ++i)
+ propertyNames[commandLineAPI[i]] = true;
+ }
+
+ this._reportCompletions(bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix, Object.keys(propertyNames));
}
},

Powered by Google App Engine
This is Rietveld 408576698