<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[189386] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/189386">189386</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2015-09-04 14:13:06 -0700 (Fri, 04 Sep 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>dispatchEvent() should throw an InvalidStateError if the event's initialized flag is not set
https://bugs.webkit.org/show_bug.cgi?id=148800
&lt;rdar://problem/22565782&gt;
&lt;rdar://problem/22565485&gt;

Reviewed by Geoffrey Garen.

Source/WebCore:

dispatchEvent() should throw an InvalidStateError if the event's
initialized flag is not set or its dispatch flag is 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)

Previously, WebKit relied on the event type being empty to throw a
UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0. However, this
exception type is outdated and initializing Event.type to an empty
string is legal.

No new tests, already covered by existing tests that were rebaselined.

* dom/Event.cpp:
(WebCore::Event::Event):
(WebCore::Event::initEvent):
* dom/Event.h:
(WebCore::Event::isInitialized):
* dom/EventTarget.cpp:
(WebCore::EventTarget::dispatchEvent):

LayoutTests:

* dom/html/level2/events/dispatchEvent02-expected.txt:
* dom/html/level2/events/dispatchEvent03-expected.txt:
* dom/html/level2/events/dispatchEvent04-expected.txt:
* dom/html/level2/events/dispatchEvent05-expected.txt:
* dom/html/level2/events/dispatchEvent06-expected.txt:
* dom/html/level2/events/dispatchEvent07-expected.txt:
* dom/xhtml/level2/events/dispatchEvent02-expected.txt:
* dom/xhtml/level2/events/dispatchEvent03-expected.txt:
* dom/xhtml/level2/events/dispatchEvent04-expected.txt:
* dom/xhtml/level2/events/dispatchEvent05-expected.txt:
* dom/xhtml/level2/events/dispatchEvent06-expected.txt:
* dom/xhtml/level2/events/dispatchEvent07-expected.txt:
Rebaseline, those tests are outdated and their expected results no
longer matches the behavior of the latest DOM specification.

* fast/dom/DOMException/EventException-expected.txt: Removed.
* fast/dom/DOMException/EventException.html: Removed.
* fast/dom/DOMException/resources/EventException.js: Removed.
Drop this test we no longer throw an EventException in this case.

* fast/dom/Window/dispatchEvent-expected.txt:
Rebaseline.

* fast/events/dispatch-event-being-dispatched-expected.txt:
* fast/events/dispatch-event-being-dispatched.html:
Fix the test to expect the new exception types.

* http/tests/w3c/dom/events/Event-type-empty-expected.txt:
* http/tests/w3c/dom/events/EventTarget-dispatchEvent-expected.txt:
Rebaseline.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsdomhtmllevel2eventsdispatchEvent02expectedtxt">trunk/LayoutTests/dom/html/level2/events/dispatchEvent02-expected.txt</a></li>
<li><a href="#trunkLayoutTestsdomhtmllevel2eventsdispatchEvent03expectedtxt">trunk/LayoutTests/dom/html/level2/events/dispatchEvent03-expected.txt</a></li>
<li><a href="#trunkLayoutTestsdomhtmllevel2eventsdispatchEvent04expectedtxt">trunk/LayoutTests/dom/html/level2/events/dispatchEvent04-expected.txt</a></li>
<li><a href="#trunkLayoutTestsdomhtmllevel2eventsdispatchEvent05expectedtxt">trunk/LayoutTests/dom/html/level2/events/dispatchEvent05-expected.txt</a></li>
<li><a href="#trunkLayoutTestsdomhtmllevel2eventsdispatchEvent06expectedtxt">trunk/LayoutTests/dom/html/level2/events/dispatchEvent06-expected.txt</a></li>
<li><a href="#trunkLayoutTestsdomhtmllevel2eventsdispatchEvent07expectedtxt">trunk/LayoutTests/dom/html/level2/events/dispatchEvent07-expected.txt</a></li>
<li><a href="#trunkLayoutTestsdomxhtmllevel2eventsdispatchEvent02expectedtxt">trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent02-expected.txt</a></li>
<li><a href="#trunkLayoutTestsdomxhtmllevel2eventsdispatchEvent03expectedtxt">trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent03-expected.txt</a></li>
<li><a href="#trunkLayoutTestsdomxhtmllevel2eventsdispatchEvent04expectedtxt">trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent04-expected.txt</a></li>
<li><a href="#trunkLayoutTestsdomxhtmllevel2eventsdispatchEvent05expectedtxt">trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent05-expected.txt</a></li>
<li><a href="#trunkLayoutTestsdomxhtmllevel2eventsdispatchEvent06expectedtxt">trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent06-expected.txt</a></li>
<li><a href="#trunkLayoutTestsdomxhtmllevel2eventsdispatchEvent07expectedtxt">trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent07-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomWindowdispatchEventexpectedtxt">trunk/LayoutTests/fast/dom/Window/dispatchEvent-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventsdispatcheventbeingdispatchedexpectedtxt">trunk/LayoutTests/fast/events/dispatch-event-being-dispatched-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventsdispatcheventbeingdispatchedhtml">trunk/LayoutTests/fast/events/dispatch-event-being-dispatched.html</a></li>
<li><a href="#trunkLayoutTestshttptestsw3cdomeventsEventtypeemptyexpectedtxt">trunk/LayoutTests/http/tests/w3c/dom/events/Event-type-empty-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsw3cdomeventsEventTargetdispatchEventexpectedtxt">trunk/LayoutTests/http/tests/w3c/dom/events/EventTarget-dispatchEvent-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomEventcpp">trunk/Source/WebCore/dom/Event.cpp</a></li>
<li><a href="#trunkSourceWebCoredomEventh">trunk/Source/WebCore/dom/Event.h</a></li>
<li><a href="#trunkSourceWebCoredomEventTargetcpp">trunk/Source/WebCore/dom/EventTarget.cpp</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomDOMExceptionEventExceptionexpectedtxt">trunk/LayoutTests/fast/dom/DOMException/EventException-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMExceptionEventExceptionhtml">trunk/LayoutTests/fast/dom/DOMException/EventException.html</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMExceptionresourcesEventExceptionjs">trunk/LayoutTests/fast/dom/DOMException/resources/EventException.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (189385 => 189386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-09-04 21:07:37 UTC (rev 189385)
+++ trunk/LayoutTests/ChangeLog        2015-09-04 21:13:06 UTC (rev 189386)
</span><span class="lines">@@ -1,3 +1,43 @@
</span><ins>+2015-09-04  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        dispatchEvent() should throw an InvalidStateError if the event's initialized flag is not set
+        https://bugs.webkit.org/show_bug.cgi?id=148800
+        &lt;rdar://problem/22565782&gt;
+        &lt;rdar://problem/22565485&gt;
+
+        Reviewed by Geoffrey Garen.
+
+        * dom/html/level2/events/dispatchEvent02-expected.txt:
+        * dom/html/level2/events/dispatchEvent03-expected.txt:
+        * dom/html/level2/events/dispatchEvent04-expected.txt:
+        * dom/html/level2/events/dispatchEvent05-expected.txt:
+        * dom/html/level2/events/dispatchEvent06-expected.txt:
+        * dom/html/level2/events/dispatchEvent07-expected.txt:
+        * dom/xhtml/level2/events/dispatchEvent02-expected.txt:
+        * dom/xhtml/level2/events/dispatchEvent03-expected.txt:
+        * dom/xhtml/level2/events/dispatchEvent04-expected.txt:
+        * dom/xhtml/level2/events/dispatchEvent05-expected.txt:
+        * dom/xhtml/level2/events/dispatchEvent06-expected.txt:
+        * dom/xhtml/level2/events/dispatchEvent07-expected.txt:
+        Rebaseline, those tests are outdated and their expected results no
+        longer matches the behavior of the latest DOM specification.
+
+        * fast/dom/DOMException/EventException-expected.txt: Removed.
+        * fast/dom/DOMException/EventException.html: Removed.
+        * fast/dom/DOMException/resources/EventException.js: Removed.
+        Drop this test we no longer throw an EventException in this case.
+
+        * fast/dom/Window/dispatchEvent-expected.txt:
+        Rebaseline.
+
+        * fast/events/dispatch-event-being-dispatched-expected.txt:
+        * fast/events/dispatch-event-being-dispatched.html:
+        Fix the test to expect the new exception types.
+
+        * http/tests/w3c/dom/events/Event-type-empty-expected.txt:
+        * http/tests/w3c/dom/events/EventTarget-dispatchEvent-expected.txt:
+        Rebaseline.
+
</ins><span class="cx"> 2015-09-04  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Triage some of the failures of the CSS WG's multicolumn tests imported in r189364.
</span></span></pre></div>
<a id="trunkLayoutTestsdomhtmllevel2eventsdispatchEvent02expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/dom/html/level2/events/dispatchEvent02-expected.txt (189385 => 189386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/dom/html/level2/events/dispatchEvent02-expected.txt        2015-09-04 21:07:37 UTC (rev 189385)
+++ trunk/LayoutTests/dom/html/level2/events/dispatchEvent02-expected.txt        2015-09-04 21:13:06 UTC (rev 189386)
</span><span class="lines">@@ -1,2 +1,3 @@
</span><del>-Test:        http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent02
-Status:        Success
</del><ins>+Test:        http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent02        
+Status:        failure
+Detail:        throw_UNSPECIFIED_EVENT_TYPE_ERR: assertTrue failed
</ins></span></pre></div>
<a id="trunkLayoutTestsdomhtmllevel2eventsdispatchEvent03expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/dom/html/level2/events/dispatchEvent03-expected.txt (189385 => 189386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/dom/html/level2/events/dispatchEvent03-expected.txt        2015-09-04 21:07:37 UTC (rev 189385)
+++ trunk/LayoutTests/dom/html/level2/events/dispatchEvent03-expected.txt        2015-09-04 21:13:06 UTC (rev 189386)
</span><span class="lines">@@ -1,2 +1,3 @@
</span><del>-Test:        http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent03
-Status:        Success
</del><ins>+Test:        http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent03        
+Status:        failure
+Detail:        throw_UNSPECIFIED_EVENT_TYPE_ERR: assertTrue failed
</ins></span></pre></div>
<a id="trunkLayoutTestsdomhtmllevel2eventsdispatchEvent04expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/dom/html/level2/events/dispatchEvent04-expected.txt (189385 => 189386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/dom/html/level2/events/dispatchEvent04-expected.txt        2015-09-04 21:07:37 UTC (rev 189385)
+++ trunk/LayoutTests/dom/html/level2/events/dispatchEvent04-expected.txt        2015-09-04 21:13:06 UTC (rev 189386)
</span><span class="lines">@@ -1,2 +1,3 @@
</span><del>-Test:        http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent04
-Status:        Success
</del><ins>+Test:        http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent04        
+Status:        failure
+Detail:        throw_UNSPECIFIED_EVENT_TYPE_ERR: assertTrue failed
</ins></span></pre></div>
<a id="trunkLayoutTestsdomhtmllevel2eventsdispatchEvent05expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/dom/html/level2/events/dispatchEvent05-expected.txt (189385 => 189386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/dom/html/level2/events/dispatchEvent05-expected.txt        2015-09-04 21:07:37 UTC (rev 189385)
+++ trunk/LayoutTests/dom/html/level2/events/dispatchEvent05-expected.txt        2015-09-04 21:13:06 UTC (rev 189386)
</span><span class="lines">@@ -1,2 +1,3 @@
</span><del>-Test:        http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent05
-Status:        Success
</del><ins>+Test:        http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent05        
+Status:        failure
+Detail:        throw_UNSPECIFIED_EVENT_TYPE_ERR: assertTrue failed
</ins></span></pre></div>
<a id="trunkLayoutTestsdomhtmllevel2eventsdispatchEvent06expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/dom/html/level2/events/dispatchEvent06-expected.txt (189385 => 189386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/dom/html/level2/events/dispatchEvent06-expected.txt        2015-09-04 21:07:37 UTC (rev 189385)
+++ trunk/LayoutTests/dom/html/level2/events/dispatchEvent06-expected.txt        2015-09-04 21:13:06 UTC (rev 189386)
</span><span class="lines">@@ -1,2 +1,3 @@
</span><del>-Test:        http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent06
-Status:        Success
</del><ins>+Test:        http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent06        
+Status:        failure
+Detail:        throw_UNSPECIFIED_EVENT_TYPE_ERR: assertTrue failed
</ins></span></pre></div>
<a id="trunkLayoutTestsdomhtmllevel2eventsdispatchEvent07expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/dom/html/level2/events/dispatchEvent07-expected.txt (189385 => 189386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/dom/html/level2/events/dispatchEvent07-expected.txt        2015-09-04 21:07:37 UTC (rev 189385)
+++ trunk/LayoutTests/dom/html/level2/events/dispatchEvent07-expected.txt        2015-09-04 21:13:06 UTC (rev 189386)
</span><span class="lines">@@ -1,2 +1,3 @@
</span><del>-Test:        http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent07
-Status:        Success
</del><ins>+Test:        http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent07        
+Status:        failure
+Detail:        throw_UNSPECIFIED_EVENT_TYPE_ERR: assertTrue failed
</ins></span></pre></div>
<a id="trunkLayoutTestsdomxhtmllevel2eventsdispatchEvent02expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent02-expected.txt (189385 => 189386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent02-expected.txt        2015-09-04 21:07:37 UTC (rev 189385)
+++ trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent02-expected.txt        2015-09-04 21:13:06 UTC (rev 189386)
</span><span class="lines">@@ -1,2 +1,3 @@
</span><span class="cx"> Test        http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent02
</span><del>-Status        Success
</del><ins>+Status        failure
+Message        throw_UNSPECIFIED_EVENT_TYPE_ERR: assertTrue failed
</ins></span></pre></div>
<a id="trunkLayoutTestsdomxhtmllevel2eventsdispatchEvent03expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent03-expected.txt (189385 => 189386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent03-expected.txt        2015-09-04 21:07:37 UTC (rev 189385)
+++ trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent03-expected.txt        2015-09-04 21:13:06 UTC (rev 189386)
</span><span class="lines">@@ -1,2 +1,3 @@
</span><span class="cx"> Test        http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent03
</span><del>-Status        Success
</del><ins>+Status        failure
+Message        throw_UNSPECIFIED_EVENT_TYPE_ERR: assertTrue failed
</ins></span></pre></div>
<a id="trunkLayoutTestsdomxhtmllevel2eventsdispatchEvent04expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent04-expected.txt (189385 => 189386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent04-expected.txt        2015-09-04 21:07:37 UTC (rev 189385)
+++ trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent04-expected.txt        2015-09-04 21:13:06 UTC (rev 189386)
</span><span class="lines">@@ -1,2 +1,3 @@
</span><span class="cx"> Test        http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent04
</span><del>-Status        Success
</del><ins>+Status        failure
+Message        throw_UNSPECIFIED_EVENT_TYPE_ERR: assertTrue failed
</ins></span></pre></div>
<a id="trunkLayoutTestsdomxhtmllevel2eventsdispatchEvent05expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent05-expected.txt (189385 => 189386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent05-expected.txt        2015-09-04 21:07:37 UTC (rev 189385)
+++ trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent05-expected.txt        2015-09-04 21:13:06 UTC (rev 189386)
</span><span class="lines">@@ -1,2 +1,3 @@
</span><span class="cx"> Test        http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent05
</span><del>-Status        Success
</del><ins>+Status        failure
+Message        throw_UNSPECIFIED_EVENT_TYPE_ERR: assertTrue failed
</ins></span></pre></div>
<a id="trunkLayoutTestsdomxhtmllevel2eventsdispatchEvent06expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent06-expected.txt (189385 => 189386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent06-expected.txt        2015-09-04 21:07:37 UTC (rev 189385)
+++ trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent06-expected.txt        2015-09-04 21:13:06 UTC (rev 189386)
</span><span class="lines">@@ -1,2 +1,3 @@
</span><span class="cx"> Test        http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent06
</span><del>-Status        Success
</del><ins>+Status        failure
+Message        throw_UNSPECIFIED_EVENT_TYPE_ERR: assertTrue failed
</ins></span></pre></div>
<a id="trunkLayoutTestsdomxhtmllevel2eventsdispatchEvent07expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent07-expected.txt (189385 => 189386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent07-expected.txt        2015-09-04 21:07:37 UTC (rev 189385)
+++ trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent07-expected.txt        2015-09-04 21:13:06 UTC (rev 189386)
</span><span class="lines">@@ -1,2 +1,3 @@
</span><span class="cx"> Test        http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent07
</span><del>-Status        Success
</del><ins>+Status        failure
+Message        throw_UNSPECIFIED_EVENT_TYPE_ERR: assertTrue failed
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMExceptionEventExceptionexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/dom/DOMException/EventException-expected.txt (189385 => 189386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMException/EventException-expected.txt        2015-09-04 21:07:37 UTC (rev 189385)
+++ trunk/LayoutTests/fast/dom/DOMException/EventException-expected.txt        2015-09-04 21:13:06 UTC (rev 189386)
</span><span class="lines">@@ -1,16 +0,0 @@
</span><del>-Tests the properties of the EventException object.
-
-On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
-
-
-PASS e.toString() is &quot;Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0&quot;
-PASS Object.prototype.toString.call(e) is &quot;[object EventException]&quot;
-PASS Object.prototype.toString.call(e.__proto__) is &quot;[object EventExceptionPrototype]&quot;
-PASS e.constructor.toString() is &quot;[object EventExceptionConstructor]&quot;
-PASS e.constructor is window.EventException
-PASS e.UNSPECIFIED_EVENT_TYPE_ERR is e.constructor.UNSPECIFIED_EVENT_TYPE_ERR
-PASS e.UNSPECIFIED_EVENT_TYPE_ERR is 0
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
</del></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMExceptionEventExceptionhtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/dom/DOMException/EventException.html (189385 => 189386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMException/EventException.html        2015-09-04 21:07:37 UTC (rev 189385)
+++ trunk/LayoutTests/fast/dom/DOMException/EventException.html        2015-09-04 21:13:06 UTC (rev 189386)
</span><span class="lines">@@ -1,10 +0,0 @@
</span><del>-&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
-&lt;html&gt;
-&lt;head&gt;
-&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
-&lt;/head&gt;
-&lt;body&gt;
-&lt;script src=&quot;resources/EventException.js&quot;&gt;&lt;/script&gt;
-&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
-&lt;/body&gt;
-&lt;/html&gt;
</del></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMExceptionresourcesEventExceptionjs"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/dom/DOMException/resources/EventException.js (189385 => 189386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMException/resources/EventException.js        2015-09-04 21:07:37 UTC (rev 189385)
+++ trunk/LayoutTests/fast/dom/DOMException/resources/EventException.js        2015-09-04 21:13:06 UTC (rev 189386)
</span><span class="lines">@@ -1,17 +0,0 @@
</span><del>-description(&quot;Tests the properties of the EventException object.&quot;)
-
-var e;
-try {
-    document.dispatchEvent(null);
-    // raises a UNSPECIFIED_EVENT_TYPE_ERR
-} catch (err) {
-    e = err;
-}
-
-shouldBeEqualToString(&quot;e.toString()&quot;, &quot;Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0&quot;);
-shouldBeEqualToString(&quot;Object.prototype.toString.call(e)&quot;, &quot;[object EventException]&quot;);
-shouldBeEqualToString(&quot;Object.prototype.toString.call(e.__proto__)&quot;, &quot;[object EventExceptionPrototype]&quot;);
-shouldBeEqualToString(&quot;e.constructor.toString()&quot;, &quot;[object EventExceptionConstructor]&quot;);
-shouldBe(&quot;e.constructor&quot;, &quot;window.EventException&quot;);
-shouldBe(&quot;e.UNSPECIFIED_EVENT_TYPE_ERR&quot;, &quot;e.constructor.UNSPECIFIED_EVENT_TYPE_ERR&quot;);
-shouldBe(&quot;e.UNSPECIFIED_EVENT_TYPE_ERR&quot;, &quot;0&quot;);
</del></span></pre></div>
<a id="trunkLayoutTestsfastdomWindowdispatchEventexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/Window/dispatchEvent-expected.txt (189385 => 189386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Window/dispatchEvent-expected.txt        2015-09-04 21:07:37 UTC (rev 189385)
+++ trunk/LayoutTests/fast/dom/Window/dispatchEvent-expected.txt        2015-09-04 21:13:06 UTC (rev 189386)
</span><span class="lines">@@ -3,8 +3,8 @@
</span><span class="cx"> On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-PASS window.dispatchEvent(event) threw exception Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0.
-PASS window.dispatchEvent(event) threw exception Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0.
</del><ins>+PASS window.dispatchEvent(event) threw exception TypeError: Type error.
+PASS window.dispatchEvent(event) threw exception Error: InvalidStateError: DOM Exception 11.
</ins><span class="cx"> PASS myEventDispatched is true
</span><span class="cx"> PASS target is window
</span><span class="cx"> PASS currentTarget is window
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsdispatcheventbeingdispatchedexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/dispatch-event-being-dispatched-expected.txt (189385 => 189386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/dispatch-event-being-dispatched-expected.txt        2015-09-04 21:07:37 UTC (rev 189385)
+++ trunk/LayoutTests/fast/events/dispatch-event-being-dispatched-expected.txt        2015-09-04 21:13:06 UTC (rev 189386)
</span><span class="lines">@@ -1,10 +1,13 @@
</span><del>-Tests that dispatchEvent raises DISPATCH_REQUEST_ERR if the event being dispatched is already being dispatched.
</del><ins>+Tests that dispatchEvent raises INVALID_STATE_ERR if the event being dispatched is already being dispatched.
</ins><span class="cx"> 
</span><del>-PASS should have got DISPATCH_REQUEST_ERR EventException
</del><ins>+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS window.dispatchEvent(event) threw exception Error: InvalidStateError: DOM Exception 11.
</ins><span class="cx"> PASS redispatchCustom.wasInvoked is true
</span><del>-PASS should have got DISPATCH_REQUEST_ERR EventException
</del><ins>+PASS window.dispatchEvent(event) threw exception Error: InvalidStateError: DOM Exception 11.
</ins><span class="cx"> PASS checkCustom.wasInvoked is true
</span><del>-PASS should have got DISPATCH_REQUEST_ERR EventException
</del><ins>+PASS document.dispatchEvent(event) threw exception Error: InvalidStateError: DOM Exception 11.
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsdispatcheventbeingdispatchedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/dispatch-event-being-dispatched.html (189385 => 189386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/dispatch-event-being-dispatched.html        2015-09-04 21:07:37 UTC (rev 189385)
+++ trunk/LayoutTests/fast/events/dispatch-event-being-dispatched.html        2015-09-04 21:13:06 UTC (rev 189386)
</span><span class="lines">@@ -1,43 +1,24 @@
</span><span class="cx"> &lt;!DOCTYPE html&gt;
</span><span class="cx"> &lt;html&gt;
</span><del>-&lt;head&gt;
-&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
-&lt;/head&gt;
</del><span class="cx"> &lt;body&gt;
</span><del>-&lt;p class=&quot;description&quot;&gt;
-Tests that dispatchEvent raises DISPATCH_REQUEST_ERR if the event
-being dispatched is already being dispatched.
-&lt;/p&gt;
-&lt;pre id=&quot;console&quot;&gt;
-&lt;/pre&gt;
</del><ins>+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;div class=&quot;testDiv&quot;&gt;&lt;/div&gt;
</ins><span class="cx"> &lt;script&gt;
</span><del>-if (window.testRunner)
-    testRunner.dumpAsText();
</del><ins>+description(&quot;Tests that dispatchEvent raises INVALID_STATE_ERR if the event being dispatched is already being dispatched.&quot;);
</ins><span class="cx"> 
</span><span class="cx"> jsTestIsAsync = true;
</span><span class="cx"> 
</span><del>-function shouldBeDispatchRequestErr(exception) {
-    var ok = EventException.prototype.isPrototypeOf(exception) &amp;&amp; exception.code == EventException.DISPATCH_REQUEST_ERR;
-    (ok ? testPassed : testFailed)(&quot;should have got DISPATCH_REQUEST_ERR EventException&quot;);
-}
</del><ins>+// try redispatching an event in the process of being dispatched with dispatchEvent
</ins><span class="cx"> 
</span><del>-// try redispatching an event in the process of being dispatched with
-// dispatchEvent
-
</del><span class="cx"> function redispatchCustom(event) {
</span><del>-    try {
-        window.dispatchEvent(event);
-        testFailed('dispatchEvent of an event being dispatched should throw an exception');
-    } catch (ex) {
-        shouldBeDispatchRequestErr(ex);
-    }
</del><ins>+    shouldThrow(&quot;window.dispatchEvent(event)&quot;, &quot;'Error: InvalidStateError: DOM Exception 11'&quot;);
</ins><span class="cx"> 
</span><span class="cx">     redispatchCustom.wasInvoked = true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> var customEvent = document.createEvent('CustomEvent');
</span><span class="cx"> customEvent.initCustomEvent('foo', true, true, null);
</span><del>-var p = document.querySelector('.description');
</del><ins>+var p = document.querySelector('.testDiv');
</ins><span class="cx"> p.addEventListener('foo', redispatchCustom);
</span><span class="cx"> p.dispatchEvent(customEvent);
</span><span class="cx"> shouldBeTrue('redispatchCustom.wasInvoked');
</span><span class="lines">@@ -62,15 +43,9 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    try {
-        redispatchLoad.dispatching = true;
-        document.dispatchEvent(event);
-        testFailed('dispatchEvent of an event being dispatched should throw an exception');
-    } catch (ex) {
-        shouldBeDispatchRequestErr(ex);
-    } finally {
-        delete redispatchLoad.dispatching;
-    }
</del><ins>+    redispatchLoad.dispatching = true;
+    shouldThrow(&quot;document.dispatchEvent(event)&quot;, &quot;'Error: InvalidStateError: DOM Exception 11'&quot;);
+    delete redispatchLoad.dispatching;
</ins><span class="cx"> 
</span><span class="cx">     finishJSTest();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsw3cdomeventsEventtypeemptyexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/w3c/dom/events/Event-type-empty-expected.txt (189385 => 189386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/w3c/dom/events/Event-type-empty-expected.txt        2015-09-04 21:07:37 UTC (rev 189385)
+++ trunk/LayoutTests/http/tests/w3c/dom/events/Event-type-empty-expected.txt        2015-09-04 21:13:06 UTC (rev 189386)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><span class="cx"> 
</span><del>-FAIL initEvent UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0
-FAIL Constructor UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0
</del><ins>+PASS initEvent 
+PASS Constructor 
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsw3cdomeventsEventTargetdispatchEventexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/w3c/dom/events/EventTarget-dispatchEvent-expected.txt (189385 => 189386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/w3c/dom/events/EventTarget-dispatchEvent-expected.txt        2015-09-04 21:07:37 UTC (rev 189385)
+++ trunk/LayoutTests/http/tests/w3c/dom/events/EventTarget-dispatchEvent-expected.txt        2015-09-04 21:13:06 UTC (rev 189386)
</span><span class="lines">@@ -1,21 +1,19 @@
</span><span class="cx"> CONSOLE MESSAGE: line 60: Error
</span><span class="cx"> 
</span><del>-FAIL Calling dispatchEvent(null). assert_throws: function &quot;function () { document.dispatchEvent(null) }&quot; threw object &quot;Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0&quot; (&quot;UNSPECIFIED_EVENT_TYPE_ERR&quot;) expected object &quot;TypeError&quot; (&quot;TypeError&quot;)
-FAIL If the event's initialized flag is not set, an InvalidStateError must be thrown (CustomEvent). assert_throws: function &quot;function () { document.dispatchEvent(e) }&quot; threw object &quot;Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0&quot; that is not a DOMException InvalidStateError: property &quot;code&quot; is equal to 0, expected 11
-FAIL If the event's initialized flag is not set, an InvalidStateError must be thrown (Event). assert_throws: function &quot;function () { document.dispatchEvent(e) }&quot; threw object &quot;Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0&quot; that is not a DOMException InvalidStateError: property &quot;code&quot; is equal to 0, expected 11
-FAIL If the event's initialized flag is not set, an InvalidStateError must be thrown (Events). assert_throws: function &quot;function () { document.dispatchEvent(e) }&quot; threw object &quot;Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0&quot; that is not a DOMException InvalidStateError: property &quot;code&quot; is equal to 0, expected 11
-FAIL If the event's initialized flag is not set, an InvalidStateError must be thrown (HTMLEvents). assert_throws: function &quot;function () { document.dispatchEvent(e) }&quot; threw object &quot;Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0&quot; that is not a DOMException InvalidStateError: property &quot;code&quot; is equal to 0, expected 11
-FAIL If the event's initialized flag is not set, an InvalidStateError must be thrown (KeyboardEvent). assert_throws: function &quot;function () { document.dispatchEvent(e) }&quot; threw object &quot;Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0&quot; that is not a DOMException InvalidStateError: property &quot;code&quot; is equal to 0, expected 11
</del><ins>+PASS Calling dispatchEvent(null). 
+PASS If the event's initialized flag is not set, an InvalidStateError must be thrown (CustomEvent). 
+PASS If the event's initialized flag is not set, an InvalidStateError must be thrown (Event). 
+PASS If the event's initialized flag is not set, an InvalidStateError must be thrown (Events). 
+PASS If the event's initialized flag is not set, an InvalidStateError must be thrown (HTMLEvents). 
+PASS If the event's initialized flag is not set, an InvalidStateError must be thrown (KeyboardEvent). 
</ins><span class="cx"> FAIL If the event's initialized flag is not set, an InvalidStateError must be thrown (KeyEvents). NotSupportedError: DOM Exception 9
</span><del>-FAIL If the event's initialized flag is not set, an InvalidStateError must be thrown (MessageEvent). assert_throws: function &quot;function () { document.dispatchEvent(e) }&quot; threw object &quot;Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0&quot; that is not a DOMException InvalidStateError: property &quot;code&quot; is equal to 0, expected 11
-FAIL If the event's initialized flag is not set, an InvalidStateError must be thrown (MouseEvent). assert_throws: function &quot;function () { document.dispatchEvent(e) }&quot; threw object &quot;Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0&quot; that is not a DOMException InvalidStateError: property &quot;code&quot; is equal to 0, expected 11
-FAIL If the event's initialized flag is not set, an InvalidStateError must be thrown (MouseEvents). assert_throws: function &quot;function () { document.dispatchEvent(e) }&quot; threw object &quot;Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0&quot; that is not a DOMException InvalidStateError: property &quot;code&quot; is equal to 0, expected 11
</del><ins>+PASS If the event's initialized flag is not set, an InvalidStateError must be thrown (MessageEvent). 
+PASS If the event's initialized flag is not set, an InvalidStateError must be thrown (MouseEvent). 
+PASS If the event's initialized flag is not set, an InvalidStateError must be thrown (MouseEvents). 
</ins><span class="cx"> FAIL If the event's initialized flag is not set, an InvalidStateError must be thrown (TouchEvent). NotSupportedError: DOM Exception 9
</span><del>-FAIL If the event's initialized flag is not set, an InvalidStateError must be thrown (UIEvent). assert_throws: function &quot;function () { document.dispatchEvent(e) }&quot; threw object &quot;Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0&quot; that is not a DOMException InvalidStateError: property &quot;code&quot; is equal to 0, expected 11
-FAIL If the event's initialized flag is not set, an InvalidStateError must be thrown (UIEvents). assert_throws: function &quot;function () { document.dispatchEvent(e) }&quot; threw object &quot;Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0&quot; that is not a DOMException InvalidStateError: property &quot;code&quot; is equal to 0, expected 11
-FAIL If the event's dispatch flag is set, an InvalidStateError must be thrown. assert_throws: function &quot;function () {
-      target.dispatchEvent(e)
-    }&quot; threw object &quot;Error: DISPATCH_REQUEST_ERR: DOM Events Exception 1&quot; that is not a DOMException InvalidStateError: property &quot;code&quot; is equal to 1, expected 11
</del><ins>+PASS If the event's initialized flag is not set, an InvalidStateError must be thrown (UIEvent). 
+PASS If the event's initialized flag is not set, an InvalidStateError must be thrown (UIEvents). 
+PASS If the event's dispatch flag is set, an InvalidStateError must be thrown. 
</ins><span class="cx"> PASS Exceptions from event listeners must not be propagated. 
</span><span class="cx"> FAIL Event listeners added during dispatch should be called assert_array_equals: lengths differ, expected 2 got 0
</span><span class="cx"> PASS Event listeners should be called in order of addition 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (189385 => 189386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-09-04 21:07:37 UTC (rev 189385)
+++ trunk/Source/WebCore/ChangeLog        2015-09-04 21:13:06 UTC (rev 189386)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2015-09-04  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        dispatchEvent() should throw an InvalidStateError if the event's initialized flag is not set
+        https://bugs.webkit.org/show_bug.cgi?id=148800
+        &lt;rdar://problem/22565782&gt;
+        &lt;rdar://problem/22565485&gt;
+
+        Reviewed by Geoffrey Garen.
+
+        dispatchEvent() should throw an InvalidStateError if the event's
+        initialized flag is not set or its dispatch flag is 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)
+
+        Previously, WebKit relied on the event type being empty to throw a
+        UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0. However, this
+        exception type is outdated and initializing Event.type to an empty
+        string is legal.
+
+        No new tests, already covered by existing tests that were rebaselined.
+
+        * dom/Event.cpp:
+        (WebCore::Event::Event):
+        (WebCore::Event::initEvent):
+        * dom/Event.h:
+        (WebCore::Event::isInitialized):
+        * dom/EventTarget.cpp:
+        (WebCore::EventTarget::dispatchEvent):
+
</ins><span class="cx"> 2015-09-04  Beth Dakin  &lt;bdakin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Speculative build fix.
</span></span></pre></div>
<a id="trunkSourceWebCoredomEventcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Event.cpp (189385 => 189386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Event.cpp        2015-09-04 21:07:37 UTC (rev 189385)
+++ trunk/Source/WebCore/dom/Event.cpp        2015-09-04 21:13:06 UTC (rev 189386)
</span><span class="lines">@@ -56,7 +56,8 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Event::Event(const AtomicString&amp; eventType, bool canBubbleArg, bool cancelableArg)
</span><del>-    : m_type(eventType)
</del><ins>+    : m_isInitialized(true)
+    , m_type(eventType)
</ins><span class="cx">     , m_canBubble(canBubbleArg)
</span><span class="cx">     , m_cancelable(cancelableArg)
</span><span class="cx">     , m_propagationStopped(false)
</span><span class="lines">@@ -71,7 +72,8 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Event::Event(const AtomicString&amp; eventType, bool canBubbleArg, bool cancelableArg, double timestamp)
</span><del>-    : m_type(eventType)
</del><ins>+    : m_isInitialized(true)
+    , m_type(eventType)
</ins><span class="cx">     , m_canBubble(canBubbleArg)
</span><span class="cx">     , m_cancelable(cancelableArg)
</span><span class="cx">     , m_propagationStopped(false)
</span><span class="lines">@@ -86,7 +88,8 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Event::Event(const AtomicString&amp; eventType, const EventInit&amp; initializer)
</span><del>-    : m_type(eventType)
</del><ins>+    : m_isInitialized(true)
+    , m_type(eventType)
</ins><span class="cx">     , m_canBubble(initializer.bubbles)
</span><span class="cx">     , m_cancelable(initializer.cancelable)
</span><span class="cx">     , m_propagationStopped(false)
</span><span class="lines">@@ -109,6 +112,7 @@
</span><span class="cx">     if (dispatched())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    m_isInitialized = true;
</ins><span class="cx">     m_propagationStopped = false;
</span><span class="cx">     m_immediatePropagationStopped = false;
</span><span class="cx">     m_defaultPrevented = false;
</span></span></pre></div>
<a id="trunkSourceWebCoredomEventh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Event.h (189385 => 189386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Event.h        2015-09-04 21:07:37 UTC (rev 189385)
+++ trunk/Source/WebCore/dom/Event.h        2015-09-04 21:13:06 UTC (rev 189386)
</span><span class="lines">@@ -100,6 +100,7 @@
</span><span class="cx">     virtual ~Event();
</span><span class="cx"> 
</span><span class="cx">     void initEvent(const AtomicString&amp; type, bool canBubble, bool cancelable);
</span><ins>+    bool isInitialized() const { return m_isInitialized; }
</ins><span class="cx"> 
</span><span class="cx">     const AtomicString&amp; type() const { return m_type; }
</span><span class="cx">     void setType(const AtomicString&amp; type) { m_type = type; }
</span><span class="lines">@@ -188,6 +189,7 @@
</span><span class="cx">     bool dispatched() const { return m_target; }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><ins>+    bool m_isInitialized { false };
</ins><span class="cx">     AtomicString m_type;
</span><span class="cx">     bool m_canBubble;
</span><span class="cx">     bool m_cancelable;
</span></span></pre></div>
<a id="trunkSourceWebCoredomEventTargetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/EventTarget.cpp (189385 => 189386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/EventTarget.cpp        2015-09-04 21:07:37 UTC (rev 189385)
+++ trunk/Source/WebCore/dom/EventTarget.cpp        2015-09-04 21:13:06 UTC (rev 189386)
</span><span class="lines">@@ -138,13 +138,13 @@
</span><span class="cx"> 
</span><span class="cx"> bool EventTarget::dispatchEvent(PassRefPtr&lt;Event&gt; event, ExceptionCode&amp; ec)
</span><span class="cx"> {
</span><del>-    if (!event || event-&gt;type().isEmpty()) {
-        ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR;
</del><ins>+    if (!event) {
+        ec = TypeError;
</ins><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (event-&gt;isBeingDispatched()) {
-        ec = EventException::DISPATCH_REQUEST_ERR;
</del><ins>+    if (!event-&gt;isInitialized() || event-&gt;isBeingDispatched()) {
+        ec = INVALID_STATE_ERR;
</ins><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>