Fix a regression with displaying diff viewer file entries.

The "Files Changed" list in the diff viewer broke with Windows-style
paths. A previous change was made to fix a JavaScript injection issue,
but that caused some escaping issues when using backslashes. We now
escape both HTML and JavaScript.
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