Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Watch panel inline editing

  • Loading branch information...
commit 92b955d9fb4d68a0460197baff304d3e3c10e661 1 parent d8bfb67
@janodvarko janodvarko authored
View
43 extension/content/firebug/debugger/debugger.js
@@ -5,8 +5,10 @@ define([
"firebug/lib/object",
"firebug/lib/locale",
"firebug/firebug",
+ "firebug/remoting/debuggerClientModule",
+ "firebug/debugger/debuggerLib",
],
-function(FBTrace, Obj, Locale, Firebug) {
+function(FBTrace, Obj, Locale, Firebug, DebuggerClientModule, DebuggerLib) {
// ********************************************************************************************* //
// Constants
@@ -15,6 +17,7 @@ const Cc = Components.classes;
const Ci = Components.interfaces;
var Trace = FBTrace.to("DBG_DEBUGGER");
+var TraceError = FBTrace.to("DBG_ERRORS");
// ********************************************************************************************* //
@@ -241,6 +244,43 @@ Firebug.Debugger = Obj.extend(Firebug.ActivableModule,
evaluate: function(js, context, scope)
{
+ Trace.sysout("debugger.evaluate; " + js, scope);
+
+ var currentFrame = context.currentFrame;
+ if (!currentFrame)
+ return;
+
+ var threadActor = DebuggerClientModule.getThreadActor(context);
+ var frameActor = currentFrame.getActor();
+ var frame = threadActor._requestFrame(frameActor);
+
+ try
+ {
+ var result;
+
+ var dGlobal = DebuggerLib.getDebuggeeGlobal(context);
+ scope = dGlobal.makeDebuggeeValue(scope);
+
+ if (scope)
+ result = frame.evalWithBindings(js, scope);
+ else
+ result = frame.eval(js);
+
+ Trace.sysout("debugger.evaluate; RESULT:", result);
+
+ if (result.hasOwnProperty("return"))
+ {
+ result = result["return"];
+ if (typeof(result) == "object")
+ return DebuggerClientModule.unwrapObject(result["return"]);
+ else
+ return result;
+ }
+ }
+ catch (e)
+ {
+ TraceError.sysout("debugger.evaluate; EXCEPTION " + e, e);
+ }
},
evaluateInCallingFrame: function(js, fileName, lineNo)
@@ -255,6 +295,7 @@ Firebug.Debugger = Obj.extend(Firebug.ActivableModule,
hasValidStack: function(context)
{
+ return context.stopped;
},
getCurrentFrameKeys: function(context)
View
8 extension/content/firebug/debugger/watch/watchPanel.js
@@ -622,6 +622,14 @@ WatchPanel.prototype = Obj.extend(BasePanel,
return this.editor;
},
+ setPropertyValue: function(row, value)
+ {
+ // Save state of the tree before evaluation will cause rebuild.
+ this.tree.saveState(this.toggles);
+
+ BasePanel.setPropertyValue.apply(this, arguments);
+ },
+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Editing Helpers (override the default DomBasePanel implementation)
View
12 extension/content/firebug/dom/domBasePanel.js
@@ -742,7 +742,9 @@ Firebug.DOMBasePanel.prototype = Obj.extend(Firebug.Panel,
// 2) object[propName] can also throws in case of e.g. non existing "abc.abc" prop name.
try
{
- if (object instanceof StackFrame)
+ if (typeof(object) == "function")
+ return Firebug.Debugger.evaluate(propName, this.context);
+ else if (object instanceof StackFrame)
return Firebug.Debugger.evaluate(propName, this.context);
@fflorent Owner

isn't that doing the same thing?

@janodvarko Owner

Yes, it does the same for StackFrame and a "function".
and I think we can remove the StackFrame case later..

Honza

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
else
return object[propName];
@@ -947,6 +949,14 @@ Firebug.DOMBasePanel.prototype = Obj.extend(Firebug.Panel,
// variables have been changed during a debugging session.
if (object instanceof StackFrame)
object.clearScopes();
+
+ // xxxHonza: rebuilding the content (tree) is not enough if the user changes
+ // e.g. a local variable within the current scope (i.e. a binding or an argument).
+ // In such case we need to refetch the environment from the server to get
+ // updated values.
+ // It could be done through "clientEvaluate", which does resume-pause roundtrip.
+ // This is also the reason why object.clearScopes() has been used for JSD1
+ // (see above).
}
this.rebuild(true);
@fflorent

isn't that doing the same thing?

@janodvarko

Yes, it does the same for StackFrame and a "function".
and I think we can remove the StackFrame case later..

Honza

Please sign in to comment.
Something went wrong with that request. Please try again.