[Pkg-mozext-commits] [firebug] 07/16: Issue 7724: Firebug Breakpoint exception in current FF Nightly
David Prévot
taffit at moszumanska.debian.org
Fri Feb 6 17:18:16 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository firebug.
commit a389cf78b310aedf33531520cc11f1e05051ecc3
Author: Jan Odvarko <odvarko at gmail.com>
Date: Fri Jan 23 14:55:22 2015 +0100
Issue 7724: Firebug Breakpoint exception in current FF Nightly
---
.../firebug/debugger/breakpoints/breakpointTool.js | 65 +++++++++++++++++-----
extension/content/firebug/debugger/debuggerLib.js | 6 ++
extension/content/firebug/debugger/debuggerTool.js | 13 +++++
.../content/firebug/debugger/script/scriptPanel.js | 10 +++-
.../firebug/debugger/script/scriptPanelWarning.js | 7 +++
.../content/firebug/debugger/script/sourceFile.js | 5 ++
.../content/firebug/debugger/script/sourceTool.js | 8 +++
.../content/firebug/debugger/stack/stackFrame.js | 8 ++-
extension/content/firebug/editor/sourceEditor.js | 12 ++++
9 files changed, 115 insertions(+), 19 deletions(-)
diff --git a/extension/content/firebug/debugger/breakpoints/breakpointTool.js b/extension/content/firebug/debugger/breakpoints/breakpointTool.js
index fb93b78..902810c 100644
--- a/extension/content/firebug/debugger/breakpoints/breakpointTool.js
+++ b/extension/content/firebug/debugger/breakpoints/breakpointTool.js
@@ -100,6 +100,12 @@ BreakpointTool.prototype = Obj.extend(new Tool(),
{
Trace.sysout("breakpointTool.onAddBreakpoint; callback executed", response);
+ // Protocol change, URL is now stored in the source.
+ // Make a copy to the expected location.
+ if (!bpClient.location.url) {
+ bpClient.location.url = bpClient.source._form.href;
+ }
+
// Do not log error if it's 'noScript'. It's quite common that breakpoints
// are set before scripts exists (or no longer exists since garbage collected).
if (response.error && response.error != "noScript")
@@ -142,7 +148,12 @@ BreakpointTool.prototype = Obj.extend(new Tool(),
// the UI is properly (and asynchronously) updated everywhere.
self.dispatch("onBreakpointAdded", [self.context, bp]);
- Firebug.dispatchEvent(self.context.browser, "onBreakpointAdded", [bp]);
+ // Adding breakpoints is asynchronous, it might happen that the
+ // context (and browser) is closed soon than the async process
+ // finishes, so avoid exception.
+ // It would be better to avoid such scenarios.
+ if (self.context.browser)
+ Firebug.dispatchEvent(self.context.browser, "onBreakpointAdded", [bp]);
// The info about the original line should not be needed any more.
delete bp.params.originLineNo;
@@ -373,18 +384,29 @@ BreakpointTool.prototype = Obj.extend(new Tool(),
// executed as soon as we receive a response.
if (!isNormalDisabledBreakpoint(bp))
{
- self.context.activeThread.setBreakpoint(location,
- self.onSetBreakpoint.bind(self, callback));
+ // The protocol changed in Firefox 36. Setting a breakpoint
+ // is now done through source actor not thread actor.
+ // See also:
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1105493
+ // https://code.google.com/p/fbug/issues/detail?id=7724
+ var setBreakpoint = self.context.activeThread.setBreakpoint;
+ if (typeof setBreakpoint == "function")
+ {
+ self.context.activeThread.setBreakpoint(location,
+ self.onSetBreakpoint.bind(self, callback));
+ }
+ else
+ {
+ var sourceFile = self.context.getSourceFile(url);
+ if (sourceFile)
+ {
+ let sourceClient = sourceFile.getClient();
+ sourceClient.setBreakpoint(location, self.onSetBreakpoint.bind(self, callback));
+ }
+ }
}
}
- // If the debuggee is paused, just set the breakpoint.
- if (thread.paused)
- {
- doSetBreakpoint(callback);
- return;
- }
-
// If the previous async-process hasn't finished yet, put arguments in a queue.
if (this.setBreakpointInProgress)
{
@@ -397,6 +419,22 @@ BreakpointTool.prototype = Obj.extend(new Tool(),
this.setBreakpointInProgress = true;
+ // If the debuggee is paused, just set the breakpoint.
+ if (thread.paused)
+ {
+ doSetBreakpoint(function(response, bpClient)
+ {
+ self.setBreakpointInProgress = false;
+
+ callback(response, bpClient);
+
+ // Set breakpoints waiting in the queue.
+ if (self.queue.length > 0)
+ self.setBreakpoint.apply(self, self.queue.shift());
+ });
+ return;
+ }
+
// Otherwise, force a pause in order to set the breakpoint.
// xxxHonza: this sometimes generates 'alreadyPaused' packet, fix me.
// Or maybe the interrupt call in setBreakpoints. You need a page with two
@@ -501,10 +539,9 @@ BreakpointTool.prototype = Obj.extend(new Tool(),
Trace.sysout("breakpointTool.doSetBreakpoints; ", arr);
// Iterate all breakpoints in the given array and set them step by step.
- // The thread is paused at this point. The following loop generates a set of
- // 'setBreakpoint' packets that are put in an internal queue (in the underlying
- // RDP framework) and handled step by step, i.e. the next 'setBreakpoint' packet
- // is sent as soon as a response for the previous one is received.
+ // The following loop resumes/interrupts the thread for every bp set.
+ // This should be optimized by using Promises (callbacks make this
+ // a lot more complicated).
for (var i = 0; i < arr.length; i++)
self.onAddBreakpoint(arr[i]);
diff --git a/extension/content/firebug/debugger/debuggerLib.js b/extension/content/firebug/debugger/debuggerLib.js
index ba6eb00..4360ed9 100644
--- a/extension/content/firebug/debugger/debuggerLib.js
+++ b/extension/content/firebug/debugger/debuggerLib.js
@@ -374,6 +374,12 @@ DebuggerLib.isExecutableLine = function(context, location)
return;
}
+ if (!location.url)
+ {
+ TraceError.sysout("debuggerClient.isExecutableLine; ERROR No URL?");
+ return;
+ }
+
// Set 'innermost' property to false to get any script that is presented
// on the specified line (see also issue 7176).
var query = {
diff --git a/extension/content/firebug/debugger/debuggerTool.js b/extension/content/firebug/debugger/debuggerTool.js
index f15abfd..5ee2828 100644
--- a/extension/content/firebug/debugger/debuggerTool.js
+++ b/extension/content/firebug/debugger/debuggerTool.js
@@ -187,6 +187,11 @@ DebuggerTool.prototype = Obj.extend(new Tool(),
return doResume(this);
}
+ // Backward compatibility with the protocol (URL is now in the source).
+ if (!packet.frame.where.url) {
+ packet.frame.where.url = packet.frame.where.source.url;
+ }
+
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=829028
// Avoid double-break at the same line (e.g. breakpoint + step-over)
@@ -303,6 +308,14 @@ DebuggerTool.prototype = Obj.extend(new Tool(),
// which is stored in the context.
var frames = this.context.activeThread.cachedFrames;
+ // Backward compatibility
+ for (var i=0; i<frames.length; i++)
+ {
+ var frame = frames[i];
+ if (!frame.where.url)
+ frame.where.url = frame.where.source.url;
+ }
+
Trace.sysout("debuggerTool.framesadded; frames: ", frames);
var trace = StackTrace.buildStackTrace(this.context, frames);
diff --git a/extension/content/firebug/debugger/script/scriptPanel.js b/extension/content/firebug/debugger/script/scriptPanel.js
index 1643cf5..256a30a 100644
--- a/extension/content/firebug/debugger/script/scriptPanel.js
+++ b/extension/content/firebug/debugger/script/scriptPanel.js
@@ -455,6 +455,12 @@ ScriptPanel.prototype = Obj.extend(BasePanel,
showThisCompilationUnit: function(compilationUnit)
{
+ if (!compilationUnit.getURL())
+ {
+ TraceError.sysout("scriptPanel.showThisCompilationUnit; no URL?");
+ return false;
+ }
+
if (compilationUnit.getURL().lastIndexOf("chrome://", 0) === 0)
return false;
@@ -1751,8 +1757,6 @@ ScriptPanel.prototype = Obj.extend(BasePanel,
// before the ScriptPanel is initialized and adds itself to the DebuggerTool
// as a listener.
- Trace.sysout("scriptPanel.newSource; " + sourceFile.href, sourceFile);
-
// New script has been appended, update the default location if necessary.
// xxxHonza: Do not use this.navigate() method since it would fire "onPanelNavigate"
// event and cause {@linke NavigationHistory} to be updated (issue 6950).
@@ -1764,7 +1768,7 @@ ScriptPanel.prototype = Obj.extend(BasePanel,
this.location = this.getDefaultLocation();
Trace.sysout("scriptPanel.newSource; this.location.getURL() = " +
- this.location.getURL());
+ (this.location ? this.location.getURL() : "no url"));
this.updateLocation(this.location);
Firebug.chrome.syncLocationList();
diff --git a/extension/content/firebug/debugger/script/scriptPanelWarning.js b/extension/content/firebug/debugger/script/scriptPanelWarning.js
index f2d4e58..c48f4c7 100644
--- a/extension/content/firebug/debugger/script/scriptPanelWarning.js
+++ b/extension/content/firebug/debugger/script/scriptPanelWarning.js
@@ -222,6 +222,13 @@ var ScriptPanelWarning =
showWarning: function(panel)
{
+ if (!panel.context.window)
+ {
+ TraceError.sysout("scriptPanelWarning.showWarning; ERROR " +
+ "no window!", panel.context);
+ return;
+ }
+
var location = panel.getDefaultLocation();
var jsEnabled = Options.getPref("javascript", "enabled");
var activitySuspended = this.isActivitySuspended();
diff --git a/extension/content/firebug/debugger/script/sourceFile.js b/extension/content/firebug/debugger/script/sourceFile.js
index 69f0aa2..dea9d2f 100644
--- a/extension/content/firebug/debugger/script/sourceFile.js
+++ b/extension/content/firebug/debugger/script/sourceFile.js
@@ -242,6 +242,11 @@ SourceFile.prototype =
getSourceLink: function()
{
return new SourceLink(this.href, null, "js");
+ },
+
+ getClient: function()
+ {
+ return this.context.activeThread.source(this);
}
}
diff --git a/extension/content/firebug/debugger/script/sourceTool.js b/extension/content/firebug/debugger/script/sourceTool.js
index d289d0f..f5e643e 100644
--- a/extension/content/firebug/debugger/script/sourceTool.js
+++ b/extension/content/firebug/debugger/script/sourceTool.js
@@ -167,6 +167,10 @@ SourceTool.prototype = Obj.extend(new Tool(),
return;
}
+ // There is no URL for e.g. event handler scripts.
+ if (!script.url)
+ script.url = this.context.getName() + "@" + script.actor;
+
// Create a source file and append it into the context. This is the only
// place where an instance of {@link SourceFile} is created.
var sourceFile = new SourceFile(this.context, script.actor, script.url,
@@ -512,6 +516,10 @@ DynamicSourceCollector.prototype =
if (!threadActor._allowSource(script.url))
return false;
+ // Firefox 38 removes the breakpointStore
+ if (!threadActor.breakpointStore)
+ return false;
+
var endLine = script.startLine + script.lineCount - 1;
for (var bp of threadActor.breakpointStore.findBreakpoints({url: script.url}))
{
diff --git a/extension/content/firebug/debugger/stack/stackFrame.js b/extension/content/firebug/debugger/stack/stackFrame.js
index dd02163..12c91fd 100644
--- a/extension/content/firebug/debugger/stack/stackFrame.js
+++ b/extension/content/firebug/debugger/stack/stackFrame.js
@@ -198,9 +198,13 @@ StackFrame.buildStackFrame = function(frame, context)
return;
}
- var sourceFile = context.getSourceFile(frame.where.url);
+ // The packet structure changed, make sure to read the URL
+ // from expected location.
+ var url = frame.where.source ? frame.where.source.url : frame.where.url;
+
+ var sourceFile = context.getSourceFile(url);
if (!sourceFile)
- sourceFile = {href: frame.where.url};
+ sourceFile = {href: url};
var args = [];
var bindings = frame.environment.bindings;
diff --git a/extension/content/firebug/editor/sourceEditor.js b/extension/content/firebug/editor/sourceEditor.js
index f662ba1..f8295c2 100644
--- a/extension/content/firebug/editor/sourceEditor.js
+++ b/extension/content/firebug/editor/sourceEditor.js
@@ -291,6 +291,18 @@ SourceEditor.prototype =
addEventListener: function(type, handler)
{
+ try
+ {
+ this.addEventListenerInternal(type, handler);
+ }
+ catch (err)
+ {
+ TraceError.sysout("sourceEditor.addEventListener; ERROR " + err, err);
+ }
+ },
+
+ addEventListenerInternal: function(type, handler)
+ {
Trace.sysout("sourceEditor.addEventListener; " + type);
if (isBuiltInEvent(type))
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firebug.git
More information about the Pkg-mozext-commits
mailing list