Firefox webextension don't produce exception
Asked Answered
P

1

6

Many times I've faced this problem when a code will generate exception( eg. method not defined in object) it will not show up in the Firefox console. Firefox will simply skip that part of code.

After unable to figure the problem out, I'd need to use Chrome console to see the exception. Or I can wrap code in try-catch to see exception when run in Firefox console

Any solution so that Firefox only will show the exception code without wrapping the code within try-catch where it is happening?

Printer answered 18/7, 2018 at 18:53 Comment(1)
As i understood. You need to set log level or info level in console.Polybius
G
0

You can visit the debug console directly by opening about:devtools-toolbox?type=extension&id=<extension id> in a new tab, then click the Console tab in the debug console. Any console log (console.log, console.info, etc) will appear there if no filter is specified. Uncaught exceptions will also appear here.

You can find your extension id in the overview of addons, or by supplying one manually in your manifest:

"browser_specific_settings": {
  "gecko": {
    "id": "[email protected]",
  }
}

This is what it looks like for an addon of mine:

debug console

You could also use the web-ext tool developed by Mozilla to debug your addons, which will also show console logs, however it is less useful than about:devtools-toolbox because it cannot expand nested objects.

npm install --global web-ext
cd /path/to/your/extension
web-ext run --verbose
Gyrostatic answered 13/4, 2020 at 7:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.