Closed Bug 1607918 Opened 4 years ago Closed 4 years ago

Firefox incorrectly allows lower-case 'webkitanimationend' event listener

Categories

(Core :: DOM: Events, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla74
Tracking Status
firefox74 --- fixed

People

(Reporter: smcgruer, Assigned: bzbarsky)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36

Steps to reproduce:

I have been working on testing the widely supported prefixed animation/transition event handlers and listeners[0]. For the listeners, the spec says[1] that the event names are: webkitAnimationEnd, webkitAnimationIteration, webkitAnimationStart, webkitTransitionEnd, and that comparison is done exactly[2], i.e. case-sensitively.

In my testing, I found that Firefox appears to accept a fully-lower cased version of the event listeners (though it does not support other casing, e.g. fully-upper case), i.e.

foo.addEventListener('webkitanimationstart', () => {
console.log('This should never fire!');
});

See the reproduction at https://output.jsbin.com/nokakel/quiet, or the test results for [0], https://wpt.fyi/results/compat?run_id=398290001&run_id=381650003&run_id=387230001

[0] https://github.com/web-platform-tests/wpt/pull/19099
[1] https://dom.spec.whatwg.org/#concept-event-listener-invoke, step 8.2
[2] https://dom.spec.whatwg.org/#concept-event-listener-inner-invoke, step 2.1

Component: Untriaged → CSS Transitions and Animations
Product: Firefox → Core
Version: 71 Branch → Trunk

Minimal testcase:

 <script>
    var el = document.createElement("div");
    el.addEventListener("webkitAnimationEnd", () => console.log("cased"));
    el.addEventListener("webkitanimationend", () => console.log("lowercase"));
    el.dispatchEvent(new AnimationEvent("webkitAnimationEnd"));
  </script>

The issue is that https://searchfox.org/mozilla-central/rev/ba4fab1cc2f1c9c4e07cdb71542b8d441707c577/dom/events/EventNameList.h#519-537 map two different names to the same event type, and the dispatch is done by event type.

Fix coming up.

Assignee: nobody → bzbarsky
Status: UNCONFIRMED → NEW
Ever confirmed: true
Component: CSS Transitions and Animations → DOM: Events

Hmm. So removing the lowercase mappings there entirely causes problems because then we don't treat the "onwebkitanimationend" content attribute as an event listener attribute... Thinking about other options.

The WPTs were cherrypicked from https://github.com/web-platform-tests/wpt/pull/19099

The issue in dom/events/test/test_bug1332699.html was discussed in
https://bugzilla.mozilla.org/show_bug.cgi?id=1332699#c8 and
https://bugzilla.mozilla.org/show_bug.cgi?id=1332699#c10 but Xidorn never quite
made it clear enough what the issue was, so it ended up making it into the tree.

Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/429f702dfd42
Fix case handling for webkit-prefixed transition/animation event handlers.  r=smaug.
Regressions: 1608980
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla74
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: