var _origAssert = console.assert;


if (typeof window.console === 'undefined') {
    window.console = {};
}

if (typeof console.log === 'undefined') {
    console.log = function() {}
}

/*
 * console.assert may not behave as we'd hope on all implementations.
 * On Chrome, for instance, it doesn't raise an exception. So, fall back
 * to raising one.
 */
console.assert = function(conditional, msg) {
    if (_origAssert && _origAssert.call) {
        _origAssert.call(console, conditional, msg);
    }

    /* If the above assert never raised an exception, raise our own. */
    if (!conditional) {
        throw Error(msg);
    }
}

if (typeof console.assert === 'undefined') {
    console.log = function() {}
}

var _origAssert;

if (typeof window.console === 'undefined') {
    window.console = {};
}

_origAssert = console.assert;

if (typeof console.log === 'undefined') {
    console.log = function() {}
}

/*
 * console.assert may not behave as we'd hope on all implementations.
 * On Chrome, for instance, it doesn't raise an exception. So, fall back
 * to raising one.
 */
console.assert = function(conditional, msg) {
    if (_origAssert && _origAssert.call) {
        _origAssert.call(console, conditional, msg);
    }

    /* If the above assert never raised an exception, raise our own. */
    if (!conditional) {
        throw Error(msg);
    }
}

Fix the console fallbacks to not break older browsers.
Fix the console fallbacks to not break older browsers.

The console fallbacks were designed to work if no console API was
defined, but it still ended up accessing stuff inside of console. It
also had some unused code at the end. This has been fixed and should
restore compatibility with Firefox 3.x and IE.

Fixes bug #2880
