Skip to content

Commit

Permalink
Make sure the breakpoints panel is updated
Browse files Browse the repository at this point in the history
  • Loading branch information
janodvarko committed Sep 20, 2012
1 parent ada19c9 commit a15837a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 15 deletions.
20 changes: 14 additions & 6 deletions extension/content/firebug/debugger/debuggerClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function DebuggerClient(context, connection)
this.onThreadStateListener = this.onThreadState.bind(this);
}

DebuggerClient.prototype = Obj.extend(Object,
DebuggerClient.prototype = Obj.extend(new Firebug.EventSource(),
{
dispatchName: "DebuggerClient",

Expand Down Expand Up @@ -149,7 +149,7 @@ DebuggerClient.prototype = Obj.extend(Object,
this.activeThread = threadClient;

// Connect script manager
this.scripts = new SourceScripts(this.connection, this.activeThread);
this.scripts = new SourceScripts(this);
this.scripts.connect();

// Resume remote thread.
Expand Down Expand Up @@ -192,10 +192,11 @@ DebuggerClient.prototype = Obj.extend(Object,
* Keeps the source script list up-to-date, using the thread client's
* source script cache.
*/
function SourceScripts(connection, thread)
function SourceScripts(debuggerClient)
{
this.connection = connection;
this.thread = thread;
this.debuggerClient = debuggerClient;
this.connection = debuggerClient.connection;
this.thread = debuggerClient.activeThread;
}

SourceScripts.prototype =
Expand All @@ -207,11 +208,16 @@ SourceScripts.prototype =
// Retrieve the list of scripts known to the server from before the client
// was ready to handle new script notifications.
this.thread.fillScripts();

this.onNewScript = this.onNewScript.bind();

this.debuggerClient.addListener("newScript", this.onNewScript);
},

disconnect: function()
{

this.thread.removeListener(this);
this.debuggerClient.removeListener("newScript", this.onNewScript);
},

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Expand All @@ -228,6 +234,8 @@ SourceScripts.prototype =

onScriptsAdded: function(scriptCache)
{
FBTrace.sysout("SourceScripts.onScriptsAdded; ", scriptCache);

for (var p in scriptCache)
{
var script = scriptCache[p];
Expand Down
26 changes: 21 additions & 5 deletions extension/content/firebug/debugger/scriptPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ define([
"firebug/chrome/menu",
"firebug/debugger/stackFrame",
"firebug/debugger/sourceLink",
"firebug/debugger/breakpoint",
"firebug/debugger/breakpointStore",
],
function (Obj, Locale, Events, Dom, ScriptView, CompilationUnit, DebuggerTool, Menu,
StackFrame, SourceLink) {
StackFrame, SourceLink, Breakpoint, BreakpointStore) {

// ********************************************************************************************* //
// Script panel
Expand Down Expand Up @@ -306,13 +308,27 @@ ScriptPanel.prototype = Obj.extend(BasePanel,

onBreakpointAdd: function(bp)
{
var self = this;
function callback()
var url = this.location.href;
var line = bp.line;

function callback(response)
{
FBTrace.sysout("scriptPanel.onBreakpointAdd; breakpoint added", arguments);
if (response.error)
{
if (FBTrace.DBG_ERRORS)
FBTrace.sysout("scriptPanel.onBreakpointAdd; ERROR " + response, response);
return;
}

// Persist the breakpoint on the client side
BreakpointStore.addBreakpoint(url, line, {actor: response.actor});

if (FBTrace.DBG_BP)
FBTrace.sysout("scriptPanel.onBreakpointAdd; breakpoint added", bp);
}

this.tool.setBreakpoint(this.context, this.location.href, bp.line, callback);
FBTrace.sysout("scriptPanel.onBreakpointAdd; set a breakpoint", bp);
this.tool.setBreakpoint(this.context, url, line, callback);
},

onBreakpointRemove: function(bp)
Expand Down
8 changes: 4 additions & 4 deletions extension/content/firebug/debugger/threadClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,13 @@ ThreadClient.prototype = Obj.extend(new Firebug.EventSource(),
// dead script that will reappear on a page reload.
if (onResponse)
{
var bpClient = new BreakpointClient(this.connection, response.actor,
location);
//var bpClient = new BreakpointClient(this.connection, response.actor,
// location);

if (callback)
callback(onResponse(response, bpClient));
callback(onResponse(response));
else
onResponse(response, bpClient);
onResponse(response);
}
}.bind(this));
}.bind(this);
Expand Down

0 comments on commit a15837a

Please sign in to comment.