Track error events on window object in content scripts and background script

With my FF extension I would like to track and store errors using window.addEventListener('error', listener, false)

This works fine for sidebar scripts and browser action scripts but not for content scripts injected in a page - even if the error occured in the content script itself, which doesn’t seem to violate the “different origin” restriction on ErrorEvents:

When a syntax error occurs in a script, loaded from a different origin, the details of the syntax error are not reported to prevent leaking information (see here)

And it doesn’t seem to work for the background script either.

Is there a way to access those errors (in injected content scripts and in the background script)?

The reason behind it is that I want to enable users to mail more sophisticated bug reports than “it doesn’t work. why???”

That’s probably due to security restrictions placed on content scripts. Content scripts can’t detect changes that occur in content.

1 Like