window.onerror and window.unhandledrejection handlers in content script does not catch this content script's exceptions
Categories
(WebExtensions :: Untriaged, defect)
Tracking
(Not tracked)
People
(Reporter: CoolCmd, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0
Steps to reproduce:
In WebExtension, manifest.json loads the content script 'content.js', which contains the following code:
window.onerror = function catchException(e) { alert(e) }
// . . .
throw 'contentScriptException'
Actual results:
catchException() does not catch the exception 'contentScriptException'
Expected results:
window.onerror and window.unhandledrejection handlers in content script should catch content script exceptions and not catch web page exceptions.
window.onerror and window.unhandledrejection handlers in web page should catch web page exceptions and not catch content script exceptions.
This feature is greatly helps to develop and maintain complex content scripts.
Chrome 76 works as expected with my extension (but according to issue 457785, it does not always provide the details of the exception).
Comment 1•6 years ago
|
||
This is the expected behavior. The window error and unhandledrejection events will only ever report exceptions from the content page.
Updated•6 years ago
|
Description
•