Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

  • Loading branch information...
commit 9d1c200ea4a358736d00cbcdc08dcd9033b939fb 1 parent c0653f4
Jan Odvarko authored
32  extension/content/firebug/console/consolePanel.js
@@ -11,14 +11,21 @@ define([
11 11
     "firebug/lib/search",
12 12
     "firebug/chrome/menu",
13 13
     "firebug/lib/options",
  14
+    "firebug/lib/wrapper",
  15
+    "firebug/lib/xpcom",
14 16
     "firebug/console/profiler",
15 17
     "firebug/chrome/searchBox"
16 18
 ],
17  
-function(Obj, Firebug, FirebugReps, Locale, Events, Css, Dom, Search, Menu, Options) {
  19
+function(Obj, Firebug, FirebugReps, Locale, Events, Css, Dom, Search, Menu, Options,
  20
+    Wrapper, Xpcom) {
18 21
 
19 22
 // ********************************************************************************************* //
20 23
 // Constants
21 24
 
  25
+var versionChecker = Xpcom.CCSV("@mozilla.org/xpcom/version-comparator;1", "nsIVersionComparator");
  26
+var appInfo = Xpcom.CCSV("@mozilla.org/xre/app-info;1", "nsIXULAppInfo");
  27
+var firefox15AndHigher = versionChecker.compare(appInfo.version, "15") >= 0;
  28
+
22 29
 const Cc = Components.classes;
23 30
 const Ci = Components.interfaces;
24 31
 
@@ -453,6 +460,27 @@ Firebug.ConsolePanel.prototype = Obj.extend(Firebug.ActivablePanel,
453 460
 
454 461
     appendObject: function(object, row, rep)
455 462
     {
  463
+        // Issue 5712:  Firefox crashes when trying to log XMLHTTPRequest to console
  464
+        // xxxHonza: should be removed as soon as Firefox 16 is the minimum version.
  465
+        if (!firefox15AndHigher)
  466
+        {
  467
+            if (typeof(object) == "object")
  468
+            {
  469
+                try
  470
+                {
  471
+                    // xxxHonza: could we log directly the unwrapped object?
  472
+                    var unwrapped = Wrapper.unwrapObject(object);
  473
+                    if (unwrapped.constructor.name == "XMLHttpRequest") 
  474
+                        object = object + "";
  475
+                }
  476
+                catch (e)
  477
+                {
  478
+                    if (FBTrace.DBG_ERRORS)
  479
+                        FBTrace.sysout("consolePanel.appendObject; EXCEPTION " + e, e);
  480
+                }
  481
+            }
  482
+        }
  483
+
456 484
         if (!rep)
457 485
             rep = Firebug.getRep(object, this.context);
458 486
 
@@ -561,7 +589,7 @@ Firebug.ConsolePanel.prototype = Obj.extend(Firebug.ActivablePanel,
561 589
             var object = objects[i];
562 590
             if (typeof(object) == "string")
563 591
                 logTextNode(object, row);
564  
-            else
  592
+            else 
565 593
                 this.appendObject(object, row);
566 594
         }
567 595
     },

0 notes on commit 9d1c200

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