fixes JOO-58
trace(undefined) and trace(null) print empty string
http://jangaroo.myjetbrains.com/youtrack/issue/JOO-58

On the fly, factored out console object detection to happen
only once, and made everything more robust (hopefully).
What we really should do is separate a console polyfill from
the AS3 trace() implementation.