Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 9d1c200ea4a358736d00cbcdc08dcd9033b939fb 1 parent c0653f4
Jan Odvarko janodvarko authored
Showing with 30 additions and 2 deletions.
  1. +30 −2 extension/content/firebug/console/consolePanel.js
32 extension/content/firebug/console/consolePanel.js
View
@@ -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);
}
},
Please sign in to comment.
Something went wrong with that request. Please try again.