Open
Bug 1215171
Opened 9 years ago
Updated 2 years ago
Ability to listen for javascript warnings, similar to window.onerror event handler
Categories
(Core :: DOM: Core & HTML, enhancement)
Core
DOM: Core & HTML
Tracking
()
UNCONFIRMED
People
(Reporter: sworddragon2, Unassigned)
Details
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0 Build ID: 20151003161951 Steps to reproduce: I wanted to listen for javascript errors and have noticed that window.onerror doesn't trigger on javascript warnings. Expected results: Javascript warnings should also trigger window.onerror or there could maybe be another way to listen for them.
Reporter | ||
Updated•9 years ago
|
Severity: normal → enhancement
Comment 1•9 years ago
|
||
An example of code with that problem?
Reporter | ||
Comment 2•9 years ago
|
||
What for code do you expect me to upload? A proof that this feature does not exist? Or did you just mean a use-case for this feature?
Comment 3•9 years ago
|
||
Use-case is useful to create a test for check that problem :-)
Comment 4•9 years ago
|
||
Yes, an HTML testcase that works in another browser and not Firefox can be a very useful thing :)
Reporter | ||
Comment 5•9 years ago
|
||
The problem I wanted to point to is that a testcase may be currently only semi-useful as for the current state of this report it is unknown if window.onerror should catch warnings or not. So either this is a bug and I could upload a testcase that tries to catch a warning and does fail at this point or this behavior is wanted and this is a feature request as it looks weird to me that we can catch any verbose behavior from console.* output over modal dialogs up to javascript errors but not javascript warnings.
Comment 6•9 years ago
|
||
Sounds like a feature request. What types of warnings were you specifically interested in and why?
Component: Untriaged → DOM
Product: Firefox → Core
Summary: Ability to listen for javascript warnings → Ability to listen for javascript warnings, similar to window.onerror event handler
Version: 41 Branch → Trunk
Reporter | ||
Comment 7•9 years ago
|
||
I'm interested in catching all warnings that do not trigger window.onerror. The reason is simple: To suppress warnings from code which I don't control. More precisely I'm loading untrusted content in an iframe and using a sandbox with allow-scripts since I need the content to evaluate its initial state. But allow-scripts is too permissive for me in this case as the content should never be able to make any potential verbose actions. Because of this I'm also manually restricting the sandbox a bit more: - By disabling modal dialogs (window.alert(), window.confirm() and window.prompt()). - By disabling all functions in console. - By assigning its window.parent its window. - By suppressing JavaScript errors. Only JavaScript warnings are missing (like ones from javascript.options.strict) and they can mix up with warnings from my code which makes them more difficult to notice in the console.
Comment 8•9 years ago
|
||
I personally don't think we should be adding more complexity to support javascript.options.strict, especially if this would be web-visible complexity for what is fundamentally not a web-facing feature.
Assignee | ||
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•