Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initialize breakpoints in source view

  • Loading branch information...
commit 052797b0d51cfe65b2b66329325b257ccece6ace 1 parent a15837a
Jan Odvarko janodvarko authored
1  extension/content/firebug/debugger/debuggerClient.js
View
@@ -194,6 +194,7 @@ DebuggerClient.prototype = Obj.extend(new Firebug.EventSource(),
*/
function SourceScripts(debuggerClient)
{
+ this.context = debuggerClient.context;
this.debuggerClient = debuggerClient;
this.connection = debuggerClient.connection;
this.thread = debuggerClient.activeThread;
13 extension/content/firebug/debugger/scriptPanel.js
View
@@ -342,6 +342,19 @@ ScriptPanel.prototype = Obj.extend(BasePanel,
items.push.apply(items, menuItems);
},
+ onGetBreakpoints: function(breakpoints)
+ {
+ if (!this.location)
+ return;
+
+ var url = this.location.href;
+ var bps = BreakpointStore.getBreakpoints(url);
+ if (!bps || !bps.length)
+ return;
+
+ breakpoints.push.apply(breakpoints, bps);
+ },
+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Options
32 extension/content/firebug/debugger/scriptView.js
View
@@ -27,6 +27,7 @@ Cu["import"]("resource:///modules/source-editor.jsm");
function ScriptView()
{
this.editor = null;
+ this.skipEditorBreakpointChange = false;
}
ScriptView.prototype = Obj.extend(new Firebug.EventSource(),
@@ -74,6 +75,13 @@ ScriptView.prototype = Obj.extend(new Firebug.EventSource(),
if (this.defaultSource)
this.showSource(this.defaultSource);
+
+ // xxxHonza: Breakpoints appear and disappear if it's done without
+ // a timetou, why? Ask Mihai.
+ var self = this;
+ setTimeout(function() {
+ self.initBreakpoints();
+ }, 500);
},
destroy: function()
@@ -206,6 +214,8 @@ ScriptView.prototype = Obj.extend(new Firebug.EventSource(),
onBreakpointChange: function(event)
{
+ FBTrace.sysout("scriptView.onBreakpointChange " + this.skipEditorBreakpointChange);
+
if (this.skipEditorBreakpointChange)
return;
@@ -218,6 +228,28 @@ ScriptView.prototype = Obj.extend(new Firebug.EventSource(),
}, this);
},
+ initBreakpoints: function()
+ {
+ var bps = [];
+ this.dispatch("onGetBreakpoints", [bps]);
+
+ FBTrace.sysout("scriptView.initBreakpoints; " + bps.length, bps);
+
+ if (!bps.length)
+ return;
+
+ // Ignore events about breakpoint changes.
+ this.skipEditorBreakpointChange = true;
+
+ for (var i=0; i<bps.length; i++)
+ {
+ var bp = bps[i];
+ this.editor.addBreakpoint(bp.lineNo);
+ }
+
+ this.skipEditorBreakpointChange = false;
+ },
+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Highlight Line
Please sign in to comment.
Something went wrong with that request. Please try again.