简体   繁体   中英

For Mozilla WebExtensions, how do I get Javascript errors to show up in the console log?

For Mozilla WebExtensions, how do I get Javascript errors to show up in the console log?

I'm opening the developer tools for the appropriate tab. I run the code below in a WebExtension content script.

"use strict"
console.log("Load start."); 
foofoofoo; // ***TEMP*** force error

The message "Load start." appears in the console for that tab, but there's no message for the error from the next line. I never seem to get any Javascript error messages from add-ons in the console. I can see them if I step through in the debugger, but can't just get an ordinary Javascript error message.

The "Browser console" (CTL-SHIFT-J) shows the Javascript error messages from a content script, but the Developer Tools console, even though it will show log messages from an add-on content script, does not.

This does not appear to be documented.

In addition to the browser console that you already discovered and the browser toolbox you can find addon-specific debuggers under about:debugging .

Which debugger to use for which context is documented on the MDN article WebExtensions/Debugging

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM