Closed Bug 1250234 Opened 4 years ago Closed 4 years ago

WebSocket::CreateAndDispatchMessageEvent can leave stray exceptions on JSContexts

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla47
Tracking Status
firefox47 --- fixed

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

Attachments

(1 file)

Say we get into this code.  We set up an AutoJSAPI, then do some stuff like allocate strings and blob buffers and whatnot.  Those things can throw OOM.  And then we just leave it hanging out on the JSContext.

The good news is that we can just take ownership of error reporting on the AutoJSAPI and things will be good.
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Could we please make AutoJSAPI less error prone to use when dealing with exceptions. It is guaranteed that we'll forget to use TakeOwnershipOfErrorReporting() when needed.
I think AutoJSAPI ctor or Init should take some non-optional enum value to indicate the exception handling. Or should AutoJSAPI always handle exceptions and then in some special cases one could prevent that?
> Or should AutoJSAPI always handle exceptions and then in some special cases one could prevent that?

That's the plan in general.  That's what bug 1072144 is on the way to, for example.
https://hg.mozilla.org/mozilla-central/rev/96d04f92c8c4
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.