Diff
Modified: trunk/LayoutTests/ChangeLog (92767 => 92768)
--- trunk/LayoutTests/ChangeLog 2011-08-10 14:06:11 UTC (rev 92767)
+++ trunk/LayoutTests/ChangeLog 2011-08-10 14:37:23 UTC (rev 92768)
@@ -1,5 +1,15 @@
2011-08-10 Pavel Feldman <[email protected]>
+ Web Inspector: auto-completion for string literals doesn't work
+ https://bugs.webkit.org/show_bug.cgi?id=65701
+
+ Reviewed by Yury Semikhatsky.
+
+ * inspector/debugger/debugger-completions-on-call-frame-expected.txt:
+ * inspector/debugger/debugger-completions-on-call-frame.html:
+
+2011-08-10 Pavel Feldman <[email protected]>
+
Web Inspector: CSS editing file containing tabs leads to the whole file change in revision history.
https://bugs.webkit.org/show_bug.cgi?id=65959
Modified: trunk/LayoutTests/inspector/debugger/debugger-completions-on-call-frame-expected.txt (92767 => 92768)
--- trunk/LayoutTests/inspector/debugger/debugger-completions-on-call-frame-expected.txt 2011-08-10 14:06:11 UTC (rev 92767)
+++ trunk/LayoutTests/inspector/debugger/debugger-completions-on-call-frame-expected.txt 2011-08-10 14:37:23 UTC (rev 92768)
@@ -9,6 +9,7 @@
dirxml
window
this
+toExponential
Script execution resumed.
Debugger was disabled.
Modified: trunk/LayoutTests/inspector/debugger/debugger-completions-on-call-frame.html (92767 => 92768)
--- trunk/LayoutTests/inspector/debugger/debugger-completions-on-call-frame.html 2011-08-10 14:06:11 UTC (rev 92767)
+++ trunk/LayoutTests/inspector/debugger/debugger-completions-on-call-frame.html 2011-08-10 14:37:23 UTC (rev 92768)
@@ -23,30 +23,40 @@
function step2()
{
- WebInspector.console._completions("", "var", false, checkAgainstGolden.bind(this, [ "var1", "var2" ], step3));
+ WebInspector.console._completions("", "var", false, checkAgainstGolden.bind(this, [ "var1", "var2" ], [], step3));
}
function step3()
{
- WebInspector.console._completions("", "di", false, checkAgainstGolden.bind(this, [ "dir", "dirxml" ], step4));
+ WebInspector.console._completions("", "di", false, checkAgainstGolden.bind(this, [ "dir", "dirxml" ], [], step4));
}
function step4()
{
- WebInspector.console._completions("", "win", false, checkAgainstGolden.bind(this, [ "window" ], step5));
+ WebInspector.console._completions("", "win", false, checkAgainstGolden.bind(this, [ "window" ], [], step5));
}
function step5()
{
- WebInspector.console._completions("", "t", false, checkAgainstGolden.bind(this, [ "this" ], step6));
+ WebInspector.console._completions("", "t", false, checkAgainstGolden.bind(this, [ "this" ], [], step6));
}
function step6()
{
+ WebInspector.console._completions("var1", "toExp", false, checkAgainstGolden.bind(this, [ "toExponential" ], [], step7));
+ }
+
+ function step7()
+ {
+ WebInspector.console._completions("123", "toExp", false, checkAgainstGolden.bind(this, [], [ "toExponential" ], step8));
+ }
+
+ function step8()
+ {
InspectorTest.completeDebuggerTest();
}
- function checkAgainstGolden(golden, continuation, completions)
+ function checkAgainstGolden(golden, antiGolden, continuation, completions)
{
for (var i = 0; i < golden.length; ++i) {
if (completions.indexOf(golden[i]) !== -1)
@@ -54,6 +64,12 @@
else
InspectorTest.addResult("NOT FOUND: " + golden[i]);
}
+
+ for (var i = 0; i < antiGolden.length; ++i) {
+ if (completions.indexOf(antiGolden[i]) !== -1)
+ InspectorTest.addResult("FOUND: " + antiGolden[i]);
+ }
+
continuation();
}
}
Modified: trunk/Source/WebCore/ChangeLog (92767 => 92768)
--- trunk/Source/WebCore/ChangeLog 2011-08-10 14:06:11 UTC (rev 92767)
+++ trunk/Source/WebCore/ChangeLog 2011-08-10 14:37:23 UTC (rev 92768)
@@ -1,5 +1,37 @@
2011-08-10 Pavel Feldman <[email protected]>
+ Web Inspector: auto-completion for string literals doesn't work
+ https://bugs.webkit.org/show_bug.cgi?id=65701
+
+ Reviewed by Yury Semikhatsky.
+
+ * inspector/InjectedScript.cpp:
+ (WebCore::InjectedScript::evaluateOnCallFrame):
+ * inspector/InjectedScript.h:
+ * inspector/InjectedScriptSource.js:
+ (.):
+ ():
+ * inspector/Inspector.json:
+ * inspector/InspectorDebuggerAgent.cpp:
+ (WebCore::InspectorDebuggerAgent::evaluateOnCallFrame):
+ * inspector/InspectorDebuggerAgent.h:
+ * inspector/front-end/ConsoleView.js:
+ (WebInspector.ConsoleView.prototype._completions.evaluated.getCompletions):
+ (WebInspector.ConsoleView.prototype._completions.evaluated):
+ (WebInspector.ConsoleView.prototype._completions.receivedPropertyNamesFromEval):
+ (WebInspector.ConsoleView.prototype._completions.receivedPropertyNames):
+ (WebInspector.ConsoleView.prototype._completions):
+ (WebInspector.ConsoleView.prototype.evalInInspectedWindow):
+ * inspector/front-end/DebuggerPresentationModel.js:
+ (WebInspector.PresenationCallFrame.prototype.evaluate):
+ * inspector/front-end/RemoteObject.js:
+ (WebInspector.RemoteObject):
+ * inspector/front-end/ScriptsPanel.js:
+ (WebInspector.ScriptsPanel.prototype.evaluateInSelectedCallFrame):
+ (WebInspector.SourceFrameDelegateForScriptsPanel.prototype.evaluateInSelectedCallFrame):
+
+2011-08-10 Pavel Feldman <[email protected]>
+
Web Inspector: CSS editing file containing tabs leads to the whole file change in revision history.
https://bugs.webkit.org/show_bug.cgi?id=65959
Modified: trunk/Source/WebCore/inspector/InjectedScript.cpp (92767 => 92768)
--- trunk/Source/WebCore/inspector/InjectedScript.cpp 2011-08-10 14:06:11 UTC (rev 92767)
+++ trunk/Source/WebCore/inspector/InjectedScript.cpp 2011-08-10 14:37:23 UTC (rev 92768)
@@ -74,7 +74,7 @@
makeEvalCall(errorString, function, result, wasThrown);
}
-void InjectedScript::evaluateOnCallFrame(ErrorString* errorString, const ScriptValue& callFrames, const String& callFrameId, const String& _expression_, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorObject>* result, bool* wasThrown)
+void InjectedScript::evaluateOnCallFrame(ErrorString* errorString, const ScriptValue& callFrames, const String& callFrameId, const String& _expression_, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, RefPtr<InspectorObject>* result, bool* wasThrown)
{
ScriptFunctionCall function(m_injectedScriptObject, "evaluateOnCallFrame");
function.appendArgument(callFrames);
@@ -82,6 +82,7 @@
function.appendArgument(_expression_);
function.appendArgument(objectGroup);
function.appendArgument(includeCommandLineAPI);
+ function.appendArgument(returnByValue);
makeEvalCall(errorString, function, result, wasThrown);
}
Modified: trunk/Source/WebCore/inspector/InjectedScript.h (92767 => 92768)
--- trunk/Source/WebCore/inspector/InjectedScript.h 2011-08-10 14:06:11 UTC (rev 92767)
+++ trunk/Source/WebCore/inspector/InjectedScript.h 2011-08-10 14:37:23 UTC (rev 92768)
@@ -69,7 +69,15 @@
bool returnByValue,
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 evaluateOnCallFrame(ErrorString*,
+ const ScriptValue& callFrames,
+ const String& callFrameId,
+ const String& _expression_,
+ const String& objectGroup,
+ bool includeCommandLineAPI,
+ bool returnByValue,
+ RefPtr<InspectorObject>* result,
+ bool* wasThrown);
void getProperties(ErrorString*, const String& objectId, bool ownProperties, RefPtr<InspectorArray>* result);
Node* nodeForObjectId(const String& objectId);
void releaseObject(const String& objectId);
Modified: trunk/Source/WebCore/inspector/InjectedScriptSource.js (92767 => 92768)
--- trunk/Source/WebCore/inspector/InjectedScriptSource.js 2011-08-10 14:06:11 UTC (rev 92767)
+++ trunk/Source/WebCore/inspector/InjectedScriptSource.js 2011-08-10 14:37:23 UTC (rev 92768)
@@ -332,12 +332,12 @@
return result;
},
- evaluateOnCallFrame: function(topCallFrame, callFrameId, _expression_, objectGroup, injectCommandLineAPI)
+ evaluateOnCallFrame: function(topCallFrame, callFrameId, _expression_, objectGroup, injectCommandLineAPI, returnByValue)
{
var callFrame = this._callFrameForId(topCallFrame, callFrameId);
if (!callFrame)
return "Could not find call frame with given id";
- return this._evaluateAndWrap(callFrame.evaluate, callFrame, _expression_, objectGroup, true, injectCommandLineAPI);
+ return this._evaluateAndWrap(callFrame.evaluate, callFrame, _expression_, objectGroup, true, injectCommandLineAPI, returnByValue);
},
_callFrameForId: function(topCallFrame, callFrameId)
@@ -449,7 +449,6 @@
{
this.type = typeof object;
if (injectedScript.isPrimitiveValue(object) || object === null || forceValueType) {
-
// We don't send undefined values over JSON.
if (typeof object !== "undefined")
this.value = object;
Modified: trunk/Source/WebCore/inspector/Inspector.json (92767 => 92768)
--- trunk/Source/WebCore/inspector/Inspector.json 2011-08-10 14:06:11 UTC (rev 92767)
+++ trunk/Source/WebCore/inspector/Inspector.json 2011-08-10 14:37:23 UTC (rev 92768)
@@ -1611,7 +1611,8 @@
{ "name": "callFrameId", "type": "string", "description": "Call frame identifier to evaluate on. This identifier is a part of backtrace reported by the <code>pausedScript</code>." },
{ "name": "_expression_", "type": "string", "description": "_expression_ to evaluate." },
{ "name": "objectGroup", "type": "string", "optional": true, "description": "String object group name to put result into (allows rapid releasing resulting object handles using <code>releaseObjectGroup</code>)." },
- { "name": "includeCommandLineAPI", "type": "boolean", "optional": true, "description": "Specifies whether command line API should be available to the evaluated _expression_, defaults to false." }
+ { "name": "includeCommandLineAPI", "type": "boolean", "optional": true, "description": "Specifies whether command line API should be available to the evaluated _expression_, defaults to false." },
+ { "name": "returnByValue", "type": "boolean", "optional": true, "description": "Whether the result is expected to be a JSON object that should be sent by value." }
],
"returns": [
{ "name": "result", "$ref": "Runtime.RemoteObject", "description": "Object wrapper for the evaluation result." },
Modified: trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp (92767 => 92768)
--- trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp 2011-08-10 14:06:11 UTC (rev 92767)
+++ trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp 2011-08-10 14:37:23 UTC (rev 92768)
@@ -395,14 +395,14 @@
*errorString = "Internal error. Could not change pause on exceptions state";
}
-void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString* errorString, const String& callFrameId, const String& _expression_, const String* const objectGroup, const bool* const includeCommandLineAPI, RefPtr<InspectorObject>* result, bool* wasThrown)
+void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString* errorString, const String& callFrameId, const String& _expression_, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const returnByValue, RefPtr<InspectorObject>* result, bool* wasThrown)
{
InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(callFrameId);
if (injectedScript.hasNoValue()) {
*errorString = "Inspected frame has gone";
return;
}
- injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack, callFrameId, _expression_, objectGroup ? *objectGroup : "", includeCommandLineAPI ? *includeCommandLineAPI : false, result, wasThrown);
+ injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack, callFrameId, _expression_, objectGroup ? *objectGroup : "", includeCommandLineAPI ? *includeCommandLineAPI : false, returnByValue ? *returnByValue : false, result, wasThrown);
}
PassRefPtr<InspectorArray> InspectorDebuggerAgent::currentCallFrames()
Modified: trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h (92767 => 92768)
--- trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h 2011-08-10 14:06:11 UTC (rev 92767)
+++ trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h 2011-08-10 14:37:23 UTC (rev 92768)
@@ -98,7 +98,14 @@
void stepInto(ErrorString*);
void stepOut(ErrorString*);
void setPauseOnExceptions(ErrorString*, const String& pauseState);
- void evaluateOnCallFrame(ErrorString*, const String& callFrameId, const String& _expression_, const String* const objectGroup, const bool* const includeCommandLineAPI, RefPtr<InspectorObject>* result, bool* wasThrown);
+ void evaluateOnCallFrame(ErrorString*,
+ const String& callFrameId,
+ const String& _expression_,
+ const String* const objectGroup,
+ const bool* const includeCommandLineAPI,
+ const bool* const returnByValue,
+ RefPtr<InspectorObject>* result,
+ bool* wasThrown);
class Listener {
public:
Modified: trunk/Source/WebCore/inspector/front-end/ConsoleView.js (92767 => 92768)
--- trunk/Source/WebCore/inspector/front-end/ConsoleView.js 2011-08-10 14:06:11 UTC (rev 92767)
+++ trunk/Source/WebCore/inspector/front-end/ConsoleView.js 2011-08-10 14:37:23 UTC (rev 92768)
@@ -401,9 +401,17 @@
if (dotNotation || bracketNotation)
expressionString = expressionString.substr(0, lastIndex);
- if (!expressionString && !prefix)
+ if (!expressionString && !prefix) {
+ completionsReadyCallback([]);
return;
+ }
+ if (parseInt(expressionString) == expressionString) {
+ // User is entering float value, do not suggest anything.
+ completionsReadyCallback([]);
+ return;
+ }
+
if (!expressionString && WebInspector.panels.scripts.paused)
WebInspector.panels.scripts.getSelectedCallFrameVariables(receivedPropertyNames.bind(this));
else
@@ -411,12 +419,25 @@
function evaluated(result, wasThrown)
{
- if (wasThrown)
+ if (!result || wasThrown) {
+ completionsReadyCallback([]);
return;
- var getCompletions = function()
+ }
+
+ function getCompletions(primitiveType)
{
+ var object;
+ if (primitiveType === "string")
+ object = new String();
+ else if (primitiveType === "number")
+ object = new Number();
+ else if (primitiveType === "boolean")
+ object = new Boolean();
+ else
+ object = this;
+
var resultSet = {};
- for (var o = this; o; o = o.__proto__) {
+ for (var o = object; o; o = o.__proto__) {
try {
var names = Object.getOwnPropertyNames(o);
for (var i = 0; i < names.length; ++i)
@@ -426,21 +447,34 @@
}
return resultSet;
}
- result.callFunctionJSON(getCompletions, receivedPropertyNames.bind(this));
+
+ if (result.type === "object" || result.type === "function")
+ result.callFunctionJSON(getCompletions, receivedPropertyNames.bind(this));
+ else if (result.type === "string" || result.type === "number" || result.type === "boolean")
+ this.evalInInspectedWindow("(" + getCompletions + ")(\"" + result.type + "\")", "completion", undefined, true, true, receivedPropertyNamesFromEval.bind(this));
}
+ function receivedPropertyNamesFromEval(result, wasThrown)
+ {
+ if (result && !wasThrown)
+ receivedPropertyNames.call(this, result.value);
+ else
+ completionsReadyCallback([]);
+ }
+
function receivedPropertyNames(propertyNames)
{
RuntimeAgent.releaseObjectGroup("completion");
- if (!propertyNames)
+ if (!propertyNames) {
+ completionsReadyCallback([]);
return;
+ }
var includeCommandLineAPI = (!dotNotation && !bracketNotation);
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));
}
},
@@ -586,10 +620,10 @@
}
},
- evalInInspectedWindow: function(_expression_, objectGroup, includeCommandLineAPI, doNotPauseOnExceptions, evalAsJSONValue, callback)
+ evalInInspectedWindow: function(_expression_, objectGroup, includeCommandLineAPI, doNotPauseOnExceptions, returnByValue, callback)
{
if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) {
- WebInspector.panels.scripts.evaluateInSelectedCallFrame(_expression_, objectGroup, includeCommandLineAPI, callback);
+ WebInspector.panels.scripts.evaluateInSelectedCallFrame(_expression_, objectGroup, includeCommandLineAPI, returnByValue, callback);
return;
}
@@ -600,10 +634,18 @@
function evalCallback(error, result, wasThrown)
{
- if (!error)
+ if (error) {
+ console.error(error);
+ callback(null);
+ return;
+ }
+
+ if (returnByValue && !wasThrown)
+ callback(result, wasThrown);
+ else
callback(WebInspector.RemoteObject.fromPayload(result), wasThrown);
}
- RuntimeAgent.evaluate(_expression_, objectGroup, includeCommandLineAPI, doNotPauseOnExceptions, this._currentEvaluationContextId(), evalAsJSONValue, evalCallback);
+ RuntimeAgent.evaluate(_expression_, objectGroup, includeCommandLineAPI, doNotPauseOnExceptions, this._currentEvaluationContextId(), returnByValue, evalCallback);
},
_enterKeyPressed: function(event)
@@ -626,6 +668,9 @@
var self = this;
function printResult(result, wasThrown)
{
+ if (!result)
+ return;
+
self.prompt.history.push(str);
self.prompt.historyOffset = 0;
self.prompt.text = "";
Modified: trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js (92767 => 92768)
--- trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js 2011-08-10 14:06:11 UTC (rev 92767)
+++ trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js 2011-08-10 14:37:23 UTC (rev 92768)
@@ -796,13 +796,22 @@
this._sourceFile.forceLoadContent(this._script);
},
- evaluate: function(code, objectGroup, includeCommandLineAPI, callback)
+ evaluate: function(code, objectGroup, includeCommandLineAPI, returnByValue, callback)
{
function didEvaluateOnCallFrame(error, result, wasThrown)
{
- callback(WebInspector.RemoteObject.fromPayload(result), wasThrown);
+ if (error) {
+ console.error(error);
+ callback(null);
+ return;
+ }
+
+ if (returnByValue && !wasThrown)
+ callback(result, wasThrown);
+ else
+ callback(WebInspector.RemoteObject.fromPayload(result), wasThrown);
}
- DebuggerAgent.evaluateOnCallFrame(this._callFrame.id, code, objectGroup, includeCommandLineAPI, didEvaluateOnCallFrame.bind(this));
+ DebuggerAgent.evaluateOnCallFrame(this._callFrame.id, code, objectGroup, includeCommandLineAPI, returnByValue, didEvaluateOnCallFrame.bind(this));
},
sourceLine: function(callback)
Modified: trunk/Source/WebCore/inspector/front-end/RemoteObject.js (92767 => 92768)
--- trunk/Source/WebCore/inspector/front-end/RemoteObject.js 2011-08-10 14:06:11 UTC (rev 92767)
+++ trunk/Source/WebCore/inspector/front-end/RemoteObject.js 2011-08-10 14:37:23 UTC (rev 92768)
@@ -38,7 +38,8 @@
this._description = description;
this._hasChildren = true;
} else {
- // Primitive
+ // Primitive or null object.
+ console.assert(type !== "object" || value === null);
this._description = description || (value + "");
this._hasChildren = false;
}
Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (92767 => 92768)
--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2011-08-10 14:06:11 UTC (rev 92767)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2011-08-10 14:37:23 UTC (rev 92768)
@@ -394,10 +394,10 @@
this.sidebarPanes.jsBreakpoints.removeBreakpoint(breakpoint.sourceFileId, breakpoint.lineNumber);
},
- evaluateInSelectedCallFrame: function(code, objectGroup, includeCommandLineAPI, callback)
+ evaluateInSelectedCallFrame: function(code, objectGroup, includeCommandLineAPI, returnByValue, callback)
{
var selectedCallFrame = this._presentationModel.selectedCallFrame;
- selectedCallFrame.evaluate(code, objectGroup, includeCommandLineAPI, callback);
+ selectedCallFrame.evaluate(code, objectGroup, includeCommandLineAPI, returnByValue, callback);
},
getSelectedCallFrameVariables: function(callback)
@@ -1192,7 +1192,7 @@
evaluateInSelectedCallFrame: function(string, callback)
{
- WebInspector.panels.scripts.evaluateInSelectedCallFrame(string, this._popoverObjectGroup, false, callback);
+ WebInspector.panels.scripts.evaluateInSelectedCallFrame(string, this._popoverObjectGroup, false, false, callback);
},
releaseEvaluationResult: function()
Modified: trunk/Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js (92767 => 92768)
--- trunk/Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js 2011-08-10 14:06:11 UTC (rev 92767)
+++ trunk/Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js 2011-08-10 14:37:23 UTC (rev 92768)
@@ -107,6 +107,9 @@
function appendResult(_expression_, watchIndex, result, wasThrown)
{
+ if (!result)
+ return;
+
var property = new WebInspector.RemoteObjectProperty(_expression_, result);
property.watchIndex = watchIndex;
property.wasThrown = wasThrown;