Open Bug 1159878 Opened 9 years ago Updated 2 years ago

Should event listener listening for "begin" get also "beginEvent" events?

Categories

(Core :: DOM: Events, defect, P5)

36 Branch
defect

Tracking

()

People

(Reporter: smaug, Unassigned)

References

Details

This is all about those weird SVG/SMIL events.
Currently listener for "begin" is handled as if it was onbegin EventHandler, so it gets 
beginEvent events too. But is that what SVG/SMIL specs want?
Depends on: 1153603
I think what we want is for the event type to be "beginEvent" and for addEventListener("beginEvent", ...) and onbegin="" to listen for those events.  But an event (created in script) with type "begin" shouldn't trigger either of those listeners.  Did I get that right Brian?
Flags: needinfo?(bbirtles)
Yeah, that's right.

We should have some tests for this:

  https://dxr.mozilla.org/mozilla-central/source/dom/smil/test/test_smilTimeEvents.xhtml

specifically, testRegistration(), but they're pretty crumby (the 5s timeout is particularly embarrassing). It should test that listening for "begin" or "onbegin" doesn't catch any "beginEvent" events but it's possible it fails after the test has already finished (I'm pretty sure I would have checked that though?).

It doesn't test "begin" events aren't caught.
Flags: needinfo?(bbirtles)
So addEventlistener("begin", ...); shouldn't listen for beginEvent SMIL events?
No, I don't believe so. To receive beginEvent SMIL events you need one of the following:

elem.addEventListener("beginEvent", ....)
elem.setAttribute("onbegin", "....");
elem.onbegin = ...

But we don't implement the last one (I think it was added to SVG2).
(In reply to Brian Birtles (:birtles) from comment #2)
> Yeah, that's right.
> 
> We should have some tests for this:
> 
>  
> https://dxr.mozilla.org/mozilla-central/source/dom/smil/test/
> test_smilTimeEvents.xhtml
> 
> specifically, testRegistration(), but they're pretty crumby (the 5s timeout
> is particularly embarrassing). It should test that listening for "begin" or
> "onbegin" doesn't catch any "beginEvent" events
It doesn't test that.
It tests that if addEventListener("onbegin",... or addEventListener("begin", ... catch an event in the test, the event is beginEvent.
And in fact event listener for "begin" catches "beginEvent" events.
(In reply to Olli Pettay [:smaug] from comment #5)
> (In reply to Brian Birtles (:birtles) from comment #2)
> > Yeah, that's right.
> > 
> > We should have some tests for this:
> > 
> >  
> > https://dxr.mozilla.org/mozilla-central/source/dom/smil/test/
> > test_smilTimeEvents.xhtml
> > 
> > specifically, testRegistration(), but they're pretty crumby (the 5s timeout
> > is particularly embarrassing). It should test that listening for "begin" or
> > "onbegin" doesn't catch any "beginEvent" events
> It doesn't test that.
> It tests that if addEventListener("onbegin",... or addEventListener("begin",
> ... catch an event in the test, the event is beginEvent.
> And in fact event listener for "begin" catches "beginEvent" events.

There's a listener added at the bottom of the file:

  gAnim.addEventListener("beginEvent", handleOnBegin, false);

The idea is that all the listeners added in testRegistration are bogus so the only listener that should receive anything is the one added at the end of the file. If any of the bogus listeners also receive the "beginEvent"s we fire then checkExpectedEvents will report "Unexpected event" because we're only expecting one event.

My concern was that those additional event handlers won't fire until after the test suite has finished (hence the comment, "but it's possible it fails after the test has already finished") but even then we will still get an error.
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.