Closed
Bug 1153603
Opened 9 years ago
Closed 9 years ago
Wrong type of event when using createEvent + initEvent ("end" -> "endType")
Categories
(Core :: DOM: Events, defect)
Tracking
()
RESOLVED
FIXED
mozilla40
Tracking | Status | |
---|---|---|
firefox40 | --- | fixed |
People
(Reporter: ibnrubaxa, Assigned: smaug)
References
(Blocks 1 open bug)
Details
(Keywords: testcase)
Attachments
(2 files, 2 obsolete files)
716 bytes,
text/html
|
Details | |
3.61 KB,
patch
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36 Steps to reproduce: var event = document.createEvent('Event'); event.initEvent('end', true, true); Example: http://jsbin.com/mivodadeko/2/edit?js,output Actual results: even.type === 'endType'; // Bug! Expected results: even.type === 'end';
Updated•9 years ago
|
Assignee | ||
Comment 1•9 years ago
|
||
oh, bizarre bug. (new Event("end")).type in browser console is enough to show the issue.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee | ||
Comment 2•9 years ago
|
||
zoom, begin and repeat have similar issues. thinking how to fix this... the issue is that we map the same internal event type to two different dom event types.
Comment 3•9 years ago
|
||
For the SMIL events, beginEvent/endEvent/repeatEvent are the actual event types (unfortunately) but their event handler attributes are onbegin/onend/onrepeat. So e.initEvent("end") should not be anything related to beginEvent. Similarly for e.initEvent("zoom"). Would it work to skip the insertion of the entry for "begin", etc. into sStringEventTable in nsContentUtils::InitializeEventTable (maybe by adding a flag to the EventNameType field that we can check)? Then a string lookup of "begin" would not find anything, but an atom lookup of nsGkAtoms::onbegin would find the entry. I'd have to check that all uses of GetEventId are really only caring about event handler attributes, and GetEventClassID/GetEventIdAndAtom are really only caring about event types.
Flags: needinfo?(bugs)
Comment 4•9 years ago
|
||
(The cleanest solution would be to have separate fields for the event handler attribute name and the event type, but that's probably a waste of memory just to handle these few SVG events correctly.)
Assignee | ||
Updated•9 years ago
|
Assignee: nobody → bugs
Flags: needinfo?(bugs)
Comment 5•9 years ago
|
||
This is an issue with the SpeechSynthesisUtterance end event as well: https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html#dfn-utteranceonend I would like to create proper event ids, and add the events to the name mapping, but that is not possible since the SMIL end event already has an entry.
Assignee | ||
Comment 6•9 years ago
|
||
Attachment #8599499 -
Flags: review?(cam)
Comment 7•9 years ago
|
||
Comment on attachment 8599499 [details] [diff] [review] v1 Review of attachment 8599499 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/base/nsContentUtils.cpp @@ +644,5 @@ > +static bool > +ShouldAddEventToStringEventTable(const EventNameMapping& aMapping) > +{ > + switch(aMapping.mId) { > +#define ID_TO_EVENT(name_, _id, _type, _struct) \ Either all trailing or all leading underscores.
Attachment #8599499 -
Flags: review?(cam) → review+
Assignee | ||
Comment 8•9 years ago
|
||
silly copy-pasting from inconsistent code.
Assignee | ||
Comment 9•9 years ago
|
||
Assignee | ||
Comment 10•9 years ago
|
||
Assignee | ||
Updated•9 years ago
|
Keywords: checkin-needed
Updated•9 years ago
|
Attachment #8599499 -
Attachment is obsolete: true
Updated•9 years ago
|
Attachment #8599837 -
Attachment is obsolete: true
Updated•9 years ago
|
Flags: in-testsuite+
Comment 11•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/4d5f30e402da
Keywords: checkin-needed
Comment 12•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/4d5f30e402da
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox40:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
You need to log in
before you can comment on or make changes to this bug.
Description
•