This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 27046 - Invoke and report to window.onerror shorthand
Summary: Invoke and report to window.onerror shorthand
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 17713
  Show dependency treegraph
 
Reported: 2014-10-14 13:19 UTC by Anne
Modified: 2014-11-26 10:12 UTC (History)
3 users (show)

See Also:


Attachments

Description Anne 2014-10-14 13:19:58 UTC
See also bug 25138 comment 2.

To define event listeners I need a way to invoke a callback and instead of rethrowing the exceptions, report them for window.onerror.

Bug 17713 comment 16 has a long list of algorithms that need to invoke the same hook.

I suppose there might be a difference between some whether microtasks need to be run at the end, have not investigated.
Comment 1 Ian 'Hixie' Hickson 2014-11-19 23:49:42 UTC
I added "report the exception". Does that handle it? I'm not really sure I understand the request here.
Comment 2 Anne 2014-11-20 12:10:16 UTC
That got added as part of https://html5.org/r/8849 it seems.

Ian, as said in comment 0, in bug 25138 you said this: "Happy to add something that invokes a callback and then catches and reports exceptions."
Comment 3 Ian 'Hixie' Hickson 2014-11-20 20:50:41 UTC
I am still happy to add that if that's what you need. As I implied in bug 25318 comment 2, though, I can't do that until there's a definition of "invoke" that I can use.

Right now, you would just say (modulo there being no definition of "invoke"):

   Invoke the callback /callback/. If this raises an
   exception, /report the exception/.

Do you really need a macro just for that? I mean, it would probably just turn the above into something like:

   Invoke the callback /callback/ using the /exception-
   reporting algorithm/.

...which doesn't seem any better. It's barely any shorter, and it's more confusing.
Comment 4 Anne 2014-11-21 06:46:07 UTC
I thought there was something else around invoke that was needed, with respect to code entry-points.
Comment 5 Anne 2014-11-21 06:46:57 UTC
That is, that a more elaborate setup was needed to invoke a callback. I thought we'd run microtasks after them as well. Just saying "invoke" probably does not do that.
Comment 6 Ian 'Hixie' Hickson 2014-11-21 22:04:20 UTC
Yes. But that belongs in WebIDL. That's what bug 25138 is about.
Comment 7 Anne 2014-11-22 09:59:36 UTC
That bug is just about a hook for the IDL algorithm, no? IDL doesn't know about microtasks.
Comment 8 Ian 'Hixie' Hickson 2014-11-24 18:51:15 UTC
What does microtasks have to do with anything? I thought we were just talking about calling a callback. Microtasks happen at the end of tasks, no? I feel like there's some grand vision that I'm missing here, and you keep showing me individual puzzle pieces and expecting me to draw the whole thing...
Comment 9 Anne 2014-11-25 11:03:42 UTC
Sorry for the confusion. I never really understood when microtasks were supposed to run. I thought it was both at the end of task and after event listener callbacks.

I was hoping you still had all the pieces in your head with respect to how we wanted to define this interaction of events, IDL, and HTML.

It seems I'm wrong so I guess you should close this, I should start using the new "report the exception" mechanism and we'll see if anything is still undefined.
Comment 10 Anne 2014-11-26 10:12:49 UTC
As per the commit mentioned in comment 2. It seems nothing much else is needed here after all.