Make console.log() and friends work with the Firefox 4 Web Console by binding the methods
authorPatrick Walton <pwalton@mozilla.com>
Fri, 17 Sep 2010 11:14:29 -0700
changeset 2037 466480c5e77e7018bee499895cb808d103ec4e1e
parent 2036 780d540a1ca188958ac65438fb76d8b30281282d
child 2038 03cee9be1bd8040ad28b20449d5dd70d08c224ca
push id916
push userpwalton@mozilla.com
push dateFri, 17 Sep 2010 18:14:33 +0000
Make console.log() and friends work with the Firefox 4 Web Console by binding the methods
plugins/boot/bespin/console.js
--- a/plugins/boot/bespin/console.js
+++ b/plugins/boot/bespin/console.js
@@ -77,15 +77,15 @@ if (typeof(window) === 'undefined') {
 } else {
     // So we're not in Webkit, but we may still be no console object (in the
     // case of Firefox without Firebug)
     exports.console = { };
 
     // For each of the console functions, copy them if they exist, stub if not
     NAMES.forEach(function(name) {
         if (window.console && window.console[name]) {
-            exports.console[name] = window.console[name];
+            exports.console[name] = window.console[name].bind(window.console);
         } else {
             exports.console[name] = noop;
         }
     });
 }