From 3ccb2e6e8d7ba2130ef6c5fefb24e682060f1d03 Mon Sep 17 00:00:00 2001 From: ragaskar Date: Wed, 24 Jun 2009 22:20:07 -0700 Subject: [PATCH] Add console.log protection to TrivialReporter.js --- lib/TrivialReporter.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/TrivialReporter.js b/lib/TrivialReporter.js index 14c35ea..a7bd114 100644 --- a/lib/TrivialReporter.js +++ b/lib/TrivialReporter.js @@ -59,3 +59,13 @@ jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) { jasmine.TrivialReporter.prototype.log = function() { console.log.apply(console, arguments); }; + +//protect against console.log incidents +if (!("console" in window) || !("firebug" in console)) { + var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; + window.console = {}; + for (var i = 0, len = names.length; i < len; ++i) { + window.console[names[i]] = function() { + }; + } +}