Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Issue 5712: Firefox crashes when trying to log XMLHTTPRequest to console

  • Loading branch information...
commit eb095372da7beb313f88add9653c519e688bc142 1 parent 7e7b1a9
@janodvarko janodvarko authored SebastianZ committed
Showing with 30 additions and 2 deletions.
  1. +30 −2 extension/content/firebug/console/consolePanel.js
View
32 extension/content/firebug/console/consolePanel.js
@@ -11,14 +11,21 @@ define([
"firebug/lib/search",
"firebug/chrome/menu",
"firebug/lib/options",
+ "firebug/lib/wrapper",
+ "firebug/lib/xpcom",
"firebug/console/profiler",
"firebug/chrome/searchBox"
],
-function(Obj, Firebug, FirebugReps, Locale, Events, Css, Dom, Search, Menu, Options) {
+function(Obj, Firebug, FirebugReps, Locale, Events, Css, Dom, Search, Menu, Options,
+ Wrapper, Xpcom) {
// ********************************************************************************************* //
// Constants
+var versionChecker = Xpcom.CCSV("@mozilla.org/xpcom/version-comparator;1", "nsIVersionComparator");
+var appInfo = Xpcom.CCSV("@mozilla.org/xre/app-info;1", "nsIXULAppInfo");
+var firefox15AndHigher = versionChecker.compare(appInfo.version, "15") >= 0;
+
const Cc = Components.classes;
const Ci = Components.interfaces;
@@ -453,6 +460,27 @@ Firebug.ConsolePanel.prototype = Obj.extend(Firebug.ActivablePanel,
appendObject: function(object, row, rep)
{
+ // Issue 5712: Firefox crashes when trying to log XMLHTTPRequest to console
+ // xxxHonza: should be removed as soon as Firefox 16 is the minimum version.
+ if (!firefox15AndHigher)
+ {
+ if (typeof(object) == "object")
+ {
+ try
+ {
+ // xxxHonza: could we log directly the unwrapped object?
+ var unwrapped = Wrapper.unwrapObject(object);
+ if (unwrapped.constructor.name == "XMLHttpRequest")
+ object = object + "";
+ }
+ catch (e)
+ {
+ if (FBTrace.DBG_ERRORS)
+ FBTrace.sysout("consolePanel.appendObject; EXCEPTION " + e, e);
+ }
+ }
+ }
+
if (!rep)
rep = Firebug.getRep(object, this.context);
@@ -561,7 +589,7 @@ Firebug.ConsolePanel.prototype = Obj.extend(Firebug.ActivablePanel,
var object = objects[i];
if (typeof(object) == "string")
logTextNode(object, row);
- else
+ else
this.appendObject(object, row);
}
},

0 comments on commit eb09537

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