14

The Firefox Web console (Ctrl + Shift + K) is not showing all Javascript errors that are reported in the Firefox Error Console. How to change this?

It's annoying because the Firefox Error Console has been deprecated and needs to be re-enabled explicitely in Firefox configuration.

Example of errors not showing in the Web console is accessing a property of an undefined object. This kind of exception just kills the Javascript running script and is very annoying to debug if it doesn't appear in the log...

var obj = undefined;
obj['whatever'];

This will raise an error in the Error Console but not the Web console:

/*
Exception: obj is undefined
@Scratchpad/1:11
*/

Note that "JS > Errors" is checked in the Web Console and Chrome debugging is ON on the Web console configuration.

EDIT: This seems to only apply to GreaseMonkey userscripts (and scratchpad also).

KrisWebDev
  • 9,342
  • 4
  • 39
  • 59
  • 1
    It looks like strict mode is enabled. Go to `about:config` and check for `javascript.options.strict`. This option switches the engine to strict mode which gives you more errors in the Error Console (see https://developer.mozilla.org/en/docs/Debugging_JavaScript#Strict_code_checking). – Thibaud Colas Nov 24 '13 at 11:49
  • 2
    What FF version are you using ? I get the 'obj is undefined' error in the Web console using Firefox 27 (Aurora). – Michael Low Nov 24 '13 at 12:20
  • 1
    Why are you using the scratchpad? – Qantas 94 Heavy Nov 24 '13 at 13:05
  • 1
    Works for me in Firefox 25 and Nightly, using `data:text/html,`. Result is a Web Console log entry like this: `TypeError: obj is undefined @ data:text/html,:1` – nmaier Nov 24 '13 at 13:20
  • OK, it seems to only apply to GreaseMonkey userscript and the scratchpad was not a good test to check if it was applicable in other contexts. So it's more of a GreaseMonkey-Firefox integration issue. – KrisWebDev Dec 01 '13 at 09:47
  • 3
    To see Greasemonkey errors, open the browser console (Ctrl-Shift-J). Set `devtools.errorconsole.enabled` back to `false`. The web console is tab-specific -- which excludes much add-on activity. The browser console catches everything that's catchable. The Firebug console catches most things still. – Brock Adams Dec 01 '13 at 10:31
  • @BrockAdams: Please promote your comment to an answer. The browser console is a good solution. – KrisWebDev Dec 01 '13 at 14:29

1 Answers1

23

Answer given by Brock Adams in comment:

To see Greasemonkey errors, open the browser console (Ctrl - Shift - J). [...] The web console is tab-specific -- which excludes much add-on activity. The browser console catches everything that's catchable. The Firebug console catches most things still.

Plus Nelson comment:

This worked for me, but only after enabling "Show Content messages" in the gear menu of the browser console.

KrisWebDev
  • 9,342
  • 4
  • 39
  • 59
  • Sadly some `console.log()` outputs from Greasemonkey scripts are still NOT visible in **any** console. I have an `addEventListener('DOMSubtreeModified'` here which runs and alters variables. I can see the variables change, but the apropriate `console.log()` output is missing from all logs. Apparently some invocations are silenced in some states, their `console.log()` is lost. (I did not find a way to reproduce this outside the Intranet here yet, so no demonstration possible, sorry.) – Tino Jun 12 '14 at 16:58
  • 4
    `devtools.errorconsole.enabled` is `false` at my side. All logging options I can find are enabled. However, neither browser console nor web console show any bit from the failing Greasemonkey UserScript. If the script compiles it works, but if the script has a fatal compile error FF is completely mute, as if the script isn't there at all. – Tino Jan 03 '16 at 01:55
  • 1
    This no longer works. It looks like the error console has been completely removed. How can I get Greasemonkey errors to show up? – CXL Sep 12 '17 at 00:30
  • 1
    This solution is about the browser console (Ctrl+Shift+J), not the error console. – KrisWebDev Sep 13 '17 at 17:52
  • 2
    This worked for me, but only after enabling "Show Content messages" in the gear menu of the browser console. – Nelson Apr 26 '20 at 20:11
  • @KrisWebDev Please add the note from Nelson to your answer. Otherwise it would not work. – nharrer Dec 02 '20 at 22:36