Bug 148800 - dispatchEvent() should throw an InvalidStateError if the event's initialized flag is not set
Summary: dispatchEvent() should throw an InvalidStateError if the event's initialized ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL: https://dom.spec.whatwg.org/#dom-even...
Keywords: InRadar, WebExposed
Depends on: 148883
Blocks:
  Show dependency treegraph
 
Reported: 2015-09-04 09:59 PDT by Chris Dumez
Modified: 2015-09-06 13:42 PDT (History)
5 users (show)

See Also:


Attachments
Patch (28.14 KB, patch)
2015-09-04 10:48 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (28.45 KB, patch)
2015-09-05 11:07 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2015-09-04 09:59:42 PDT
dispatchEvent() should throw an InvalidStateError if the event's initialized flag is not set, and should allow dispatching events with an empty type as long as it is initialized:
https://dom.spec.whatwg.org/#dom-eventtarget-dispatchevent (step 1)

Currently, WebKit relies on the event type being empty and throws a UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0.

This is covered by the following newly imported W3C test:
http/tests/w3c/dom/events/EventTarget-dispatchEvent.html
Comment 1 Chris Dumez 2015-09-04 10:00:35 PDT
rdar://problem/22565782
rdar://problem/22565485
Comment 2 Chris Dumez 2015-09-04 10:48:02 PDT
Created attachment 260597 [details]
Patch
Comment 3 Geoffrey Garen 2015-09-04 13:53:27 PDT
Comment on attachment 260597 [details]
Patch

r=me
Comment 4 WebKit Commit Bot 2015-09-04 14:13:14 PDT
Comment on attachment 260597 [details]
Patch

Clearing flags on attachment: 260597

Committed r189386: <http://trac.webkit.org/changeset/189386>
Comment 5 WebKit Commit Bot 2015-09-04 14:13:24 PDT
All reviewed patches have been landed.  Closing bug.
Comment 6 Alexey Proskuryakov 2015-09-04 22:23:16 PDT
This change appears to have made several tests assert, rolling out.

https://build.webkit.org/results/Apple%20Yosemite%20Debug%20WK2%20(Tests)/r189417%20(6763)/results.html
Comment 7 WebKit Commit Bot 2015-09-04 22:25:06 PDT
Re-opened since this is blocked by bug 148883
Comment 8 Chris Dumez 2015-09-05 11:07:25 PDT
Created attachment 260694 [details]
Patch
Comment 9 Chris Dumez 2015-09-05 11:08:20 PDT
Comment on attachment 260694 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=260694&action=review

> Source/WebCore/dom/EventTarget.cpp:-194
> -    ASSERT(event && !event->type().isEmpty());

Fixed outdated assertion as it is now valid to dispatch an event with an empty type, as long as the event has its initialized flag set to true.
Comment 10 WebKit Commit Bot 2015-09-06 13:41:56 PDT
Comment on attachment 260694 [details]
Patch

Clearing flags on attachment: 260694

Committed r189452: <http://trac.webkit.org/changeset/189452>
Comment 11 WebKit Commit Bot 2015-09-06 13:42:01 PDT
All reviewed patches have been landed.  Closing bug.