New issue
Advanced search Search tips

Issue 603614 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner: ----
Closed: Apr 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug

Blocking:
issue 651744



Sign in to add a comment

document.createEvent() should be case-insensitive

Reported by a...@aryeh.name, Apr 14 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36

Steps to reproduce the problem:
Call document.createEvent("dragevent")

What is the expected behavior?
Returns DragEvent object

What went wrong?
Throws, only "DragEvent" works

Did this work before? N/A 

Chrome version: 49.0.2623.112  Channel: n/a
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version: Shockwave Flash 21.0 r0

Spec: https://dom.spec.whatwg.org/#dom-document-createevent
Test: http://w3c-test.org/dom/nodes/Document-createEvent.html

AFAIK, all other browsers match the spec on this point.
 
Cc: tkent@chromium.org dtapu...@chromium.org
Components: -Blink Blink>DOM
The spec only mentions a few fields that should be case insensitive. It does not declare what should be done about events that aren't in that table.

Labels: Hotlist-Interop

Comment 3 by a...@aryeh.name, Apr 17 2016

If the argument is not a case-insensitive match for one of the entries in the table, the spec says to throw.  So the argument is case-insensitive in all cases where the method actually does anything besides throw.
Note the spec recently changed. After I had added my comments. I agree with the bug now see. https://github.com/whatwg/dom/commit/9e3ce67c7927d6642646a3d0c84fa6d8f7926cfa

Tkent@ I can do this if you like. 
Owner: dtapu...@chromium.org
Status: Assigned (was: Unconfirmed)
Go for it.

Comment 6 by foolip@chromium.org, Aug 31 2016

Cc: foolip@chromium.org
FWIW, some of the things in the spec have incredibly low usage and aren't supported in all browsers and could probably be removed again. IDBVersionChangeEvent and WebGLContextEvent are among these.

But I think it'd be fine to just match case-insensitively for everything even if we keep measuring and hope to reduce the list somewhat.

Comment 7 by a...@aryeh.name, Aug 31 2016

Yes, the current list is conservative, but any events you support at all should still be case-insensitive.

IIRC, everything on the current spec's list is supported by at least two UAs.  It could surely be cut down more, but it's more convenient to have it be larger rather than smaller, from a compat perspective.  It's not worth the time to try to figure out which additional ones we can cut out.

Comment 8 by foolip@chromium.org, Aug 31 2016

Agreed on matching everything case-insensitively.

We already have use counter data for all of these things, so it's actually not much work to see what's at the bottom of the list and try removing them.

Comment 9 by a...@aryeh.name, Aug 31 2016

Effort is still required for every UA to implement use counters, decide what threshold is acceptable to drop, and coordinate.  Just because something is near-zero usage for one UA doesn't mean it is for another -- for instance, "MouseScrollEvents" is only supported by Gecko, so it's not in the spec, but it turns out sites do actually use it in Gecko codepaths.

Gecko has use counters for this now too:

https://telemetry.mozilla.org/new-pipeline/evo.html#!aggregates=submissions&cumulative=0&end_date=2016-08-28&keys=!__none__!__none__&max_channel_version=nightly%252F51&measure=CREATE_EVENT_COMMANDEVENT&min_channel_version=nightly%252F48&product=Firefox&sanitize=0&sort_keys=submissions&start_date=2016-08-22&trim=0&use_submission_date=0

You have to unselect "Median" in the upper left and select "Submissions".

Anything that has roughly 0 submissions per day is fair game for us to drop.  So if you want to suggest any additions, you can propose them on GitHub.  I don't know what our exact cutoff is.  All but three of the event types that we support that are currently not in the spec (not counting internal events, which we'll hide from the web instead of dropping) all have literally 0-1 submissions per day, so we're fine dropping them.

Gecko bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1251198
 Issue 701381  has been merged into this issue.

Comment 11 by tkent@chromium.org, Mar 29 2017

Blocking: 651744
Project Member

Comment 12 by bugdroid1@chromium.org, Mar 31 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c2cffeaaa19ba03e23cbce4291be97a85e14dd78

commit c2cffeaaa19ba03e23cbce4291be97a85e14dd78
Author: Huy.DuongDinh <Huy.DuongDinh@gmail.com>
Date: Fri Mar 31 21:35:02 2017

Expand case-insensitive matching of Document.createEvent()

If a specified interface name is an ASCII case insensitive match for any of the
strings in the first in the table in [1], then the set constructor to the
interface in the second column on the same row as the matching string.

In make_event_factory.py file. create_event_legacy_whitelist is renamed to
create_event_measure_whitelist. All events on the create_event_measure_whitelist
are matched case-insensitively in createEvent and are measured using UseCounter

The patch ensures that the test in [2] has less fail

[1]: https://dom.spec.whatwg.org/#dom-document-createevent
[2]: http://w3c-test.org/dom/nodes/Document-createEvent.html

BUG= 603614 

Review-Url: https://codereview.chromium.org/2755313002
Cr-Commit-Position: refs/heads/master@{#461236}

[modify] https://crrev.com/c2cffeaaa19ba03e23cbce4291be97a85e14dd78/AUTHORS
[modify] https://crrev.com/c2cffeaaa19ba03e23cbce4291be97a85e14dd78/third_party/WebKit/LayoutTests/external/wpt/dom/nodes/Document-createEvent-expected.txt
[modify] https://crrev.com/c2cffeaaa19ba03e23cbce4291be97a85e14dd78/third_party/WebKit/Source/build/scripts/make_event_factory.py
[modify] https://crrev.com/c2cffeaaa19ba03e23cbce4291be97a85e14dd78/third_party/WebKit/Source/build/scripts/templates/EventFactory.cpp.tmpl

Labels: M-59
Owner: ----
Status: Fixed (was: Assigned)

Sign in to add a comment