It should be possible to re-initialize an Event after it's been dispatched
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 Aug 2016 16:35:30 +0000 (16:35 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 Aug 2016 16:35:30 +0000 (16:35 +0000)
commitbc8652065750cd2ea66d5bafb1cd5d79a52602b1
tree8971174ce55446c599e03e57ef2c5e5fa0632e3f
parentbb2db1f42a5e021a73cd0870101b0f3aeae77fc7
It should be possible to re-initialize an Event after it's been dispatched
https://bugs.webkit.org/show_bug.cgi?id=160651

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline W3C test now that more checks are passing.

* web-platform-tests/dom/events/Event-propagation-expected.txt:

Source/WebCore:

Allow re-initialization of an Event that's already been dispatched, as
per the latest DOM specification:
- https://dom.spec.whatwg.org/#dom-event-initevent

Firefox already follows the specification here.

No new tests, rebaselined existing test.

Test: fast/events/initEvent-after-dispatch.html

* dom/Event.cpp:
(WebCore::Event::initEvent):
- Replace dispatched() check with isBeingDispatched() in order to
  allow initialization of an already dispatched event but prevent
  initialization of an event that is currently being dispatched
  as per:
  https://dom.spec.whatwg.org/#dom-event-initevent (step 1)
- Reset target to null as per:
  https://dom.spec.whatwg.org/#concept-event-initialize (step 4)

LayoutTests:

Add layout test coverage.

* fast/events/initEvent-after-dispatch-expected.txt: Added.
* fast/events/initEvent-after-dispatch.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/events/initEvent-after-dispatch-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/initEvent-after-dispatch.html [new file with mode: 0644]
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-propagation-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/dom/Event.cpp