Closed Bug 1565546 Opened 6 years ago Closed 6 years ago

window.onerror and window.unhandledrejection handlers in content script does not catch this content script's exceptions

Categories

(WebExtensions :: Untriaged, defect)

68 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

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).

This is the expected behavior. The window error and unhandledrejection events will only ever report exceptions from the content page.

Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
Version: Firefox 68 → 68 Branch
You need to log in before you can comment on or make changes to this bug.