Title: [189419] trunk
Revision
189419
Author
[email protected]
Date
2015-09-04 22:29:24 -0700 (Fri, 04 Sep 2015)

Log Message

Unreviewed, rolling out r189386.
https://bugs.webkit.org/show_bug.cgi?id=148883

Made several event dispatch tests assert (Requested by ap on
#webkit).

Reverted changeset:

"dispatchEvent() should throw an InvalidStateError if the
event's initialized flag is not set"
https://bugs.webkit.org/show_bug.cgi?id=148800
http://trac.webkit.org/changeset/189386

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (189418 => 189419)


--- trunk/LayoutTests/ChangeLog	2015-09-05 04:20:54 UTC (rev 189418)
+++ trunk/LayoutTests/ChangeLog	2015-09-05 05:29:24 UTC (rev 189419)
@@ -1,3 +1,18 @@
+2015-09-04  Commit Queue  <[email protected]>
+
+        Unreviewed, rolling out r189386.
+        https://bugs.webkit.org/show_bug.cgi?id=148883
+
+        Made several event dispatch tests assert (Requested by ap on
+        #webkit).
+
+        Reverted changeset:
+
+        "dispatchEvent() should throw an InvalidStateError if the
+        event's initialized flag is not set"
+        https://bugs.webkit.org/show_bug.cgi?id=148800
+        http://trac.webkit.org/changeset/189386
+
 2015-09-04  Zalan Bujtas  <[email protected]>
 
         Repaint cleanup:

Modified: trunk/LayoutTests/dom/html/level2/events/dispatchEvent02-expected.txt (189418 => 189419)


--- trunk/LayoutTests/dom/html/level2/events/dispatchEvent02-expected.txt	2015-09-05 04:20:54 UTC (rev 189418)
+++ trunk/LayoutTests/dom/html/level2/events/dispatchEvent02-expected.txt	2015-09-05 05:29:24 UTC (rev 189419)
@@ -1,3 +1,2 @@
-Test:	http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent02	
-Status:	failure
-Detail:	throw_UNSPECIFIED_EVENT_TYPE_ERR: assertTrue failed
+Test:	http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent02
+Status:	Success

Modified: trunk/LayoutTests/dom/html/level2/events/dispatchEvent03-expected.txt (189418 => 189419)


--- trunk/LayoutTests/dom/html/level2/events/dispatchEvent03-expected.txt	2015-09-05 04:20:54 UTC (rev 189418)
+++ trunk/LayoutTests/dom/html/level2/events/dispatchEvent03-expected.txt	2015-09-05 05:29:24 UTC (rev 189419)
@@ -1,3 +1,2 @@
-Test:	http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent03	
-Status:	failure
-Detail:	throw_UNSPECIFIED_EVENT_TYPE_ERR: assertTrue failed
+Test:	http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent03
+Status:	Success

Modified: trunk/LayoutTests/dom/html/level2/events/dispatchEvent04-expected.txt (189418 => 189419)


--- trunk/LayoutTests/dom/html/level2/events/dispatchEvent04-expected.txt	2015-09-05 04:20:54 UTC (rev 189418)
+++ trunk/LayoutTests/dom/html/level2/events/dispatchEvent04-expected.txt	2015-09-05 05:29:24 UTC (rev 189419)
@@ -1,3 +1,2 @@
-Test:	http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent04	
-Status:	failure
-Detail:	throw_UNSPECIFIED_EVENT_TYPE_ERR: assertTrue failed
+Test:	http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent04
+Status:	Success

Modified: trunk/LayoutTests/dom/html/level2/events/dispatchEvent05-expected.txt (189418 => 189419)


--- trunk/LayoutTests/dom/html/level2/events/dispatchEvent05-expected.txt	2015-09-05 04:20:54 UTC (rev 189418)
+++ trunk/LayoutTests/dom/html/level2/events/dispatchEvent05-expected.txt	2015-09-05 05:29:24 UTC (rev 189419)
@@ -1,3 +1,2 @@
-Test:	http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent05	
-Status:	failure
-Detail:	throw_UNSPECIFIED_EVENT_TYPE_ERR: assertTrue failed
+Test:	http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent05
+Status:	Success

Modified: trunk/LayoutTests/dom/html/level2/events/dispatchEvent06-expected.txt (189418 => 189419)


--- trunk/LayoutTests/dom/html/level2/events/dispatchEvent06-expected.txt	2015-09-05 04:20:54 UTC (rev 189418)
+++ trunk/LayoutTests/dom/html/level2/events/dispatchEvent06-expected.txt	2015-09-05 05:29:24 UTC (rev 189419)
@@ -1,3 +1,2 @@
-Test:	http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent06	
-Status:	failure
-Detail:	throw_UNSPECIFIED_EVENT_TYPE_ERR: assertTrue failed
+Test:	http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent06
+Status:	Success

Modified: trunk/LayoutTests/dom/html/level2/events/dispatchEvent07-expected.txt (189418 => 189419)


--- trunk/LayoutTests/dom/html/level2/events/dispatchEvent07-expected.txt	2015-09-05 04:20:54 UTC (rev 189418)
+++ trunk/LayoutTests/dom/html/level2/events/dispatchEvent07-expected.txt	2015-09-05 05:29:24 UTC (rev 189419)
@@ -1,3 +1,2 @@
-Test:	http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent07	
-Status:	failure
-Detail:	throw_UNSPECIFIED_EVENT_TYPE_ERR: assertTrue failed
+Test:	http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent07
+Status:	Success

Modified: trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent02-expected.txt (189418 => 189419)


--- trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent02-expected.txt	2015-09-05 04:20:54 UTC (rev 189418)
+++ trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent02-expected.txt	2015-09-05 05:29:24 UTC (rev 189419)
@@ -1,3 +1,2 @@
 Test	http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent02
-Status	failure
-Message	throw_UNSPECIFIED_EVENT_TYPE_ERR: assertTrue failed
+Status	Success

Modified: trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent03-expected.txt (189418 => 189419)


--- trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent03-expected.txt	2015-09-05 04:20:54 UTC (rev 189418)
+++ trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent03-expected.txt	2015-09-05 05:29:24 UTC (rev 189419)
@@ -1,3 +1,2 @@
 Test	http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent03
-Status	failure
-Message	throw_UNSPECIFIED_EVENT_TYPE_ERR: assertTrue failed
+Status	Success

Modified: trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent04-expected.txt (189418 => 189419)


--- trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent04-expected.txt	2015-09-05 04:20:54 UTC (rev 189418)
+++ trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent04-expected.txt	2015-09-05 05:29:24 UTC (rev 189419)
@@ -1,3 +1,2 @@
 Test	http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent04
-Status	failure
-Message	throw_UNSPECIFIED_EVENT_TYPE_ERR: assertTrue failed
+Status	Success

Modified: trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent05-expected.txt (189418 => 189419)


--- trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent05-expected.txt	2015-09-05 04:20:54 UTC (rev 189418)
+++ trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent05-expected.txt	2015-09-05 05:29:24 UTC (rev 189419)
@@ -1,3 +1,2 @@
 Test	http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent05
-Status	failure
-Message	throw_UNSPECIFIED_EVENT_TYPE_ERR: assertTrue failed
+Status	Success

Modified: trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent06-expected.txt (189418 => 189419)


--- trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent06-expected.txt	2015-09-05 04:20:54 UTC (rev 189418)
+++ trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent06-expected.txt	2015-09-05 05:29:24 UTC (rev 189419)
@@ -1,3 +1,2 @@
 Test	http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent06
-Status	failure
-Message	throw_UNSPECIFIED_EVENT_TYPE_ERR: assertTrue failed
+Status	Success

Modified: trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent07-expected.txt (189418 => 189419)


--- trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent07-expected.txt	2015-09-05 04:20:54 UTC (rev 189418)
+++ trunk/LayoutTests/dom/xhtml/level2/events/dispatchEvent07-expected.txt	2015-09-05 05:29:24 UTC (rev 189419)
@@ -1,3 +1,2 @@
 Test	http://www.w3.org/2001/DOM-Test-Suite/level2/events/dispatchEvent07
-Status	failure
-Message	throw_UNSPECIFIED_EVENT_TYPE_ERR: assertTrue failed
+Status	Success

Added: trunk/LayoutTests/fast/dom/DOMException/EventException-expected.txt (0 => 189419)


--- trunk/LayoutTests/fast/dom/DOMException/EventException-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMException/EventException-expected.txt	2015-09-05 05:29:24 UTC (rev 189419)
@@ -0,0 +1,16 @@
+Tests the properties of the EventException object.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS e.toString() is "Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0"
+PASS Object.prototype.toString.call(e) is "[object EventException]"
+PASS Object.prototype.toString.call(e.__proto__) is "[object EventExceptionPrototype]"
+PASS e.constructor.toString() is "[object EventExceptionConstructor]"
+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
+

Added: trunk/LayoutTests/fast/dom/DOMException/EventException.html (0 => 189419)


--- trunk/LayoutTests/fast/dom/DOMException/EventException.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMException/EventException.html	2015-09-05 05:29:24 UTC (rev 189419)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/dom/DOMException/resources/EventException.js (0 => 189419)


--- trunk/LayoutTests/fast/dom/DOMException/resources/EventException.js	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMException/resources/EventException.js	2015-09-05 05:29:24 UTC (rev 189419)
@@ -0,0 +1,17 @@
+description("Tests the properties of the EventException object.")
+
+var e;
+try {
+    document.dispatchEvent(null);
+    // raises a UNSPECIFIED_EVENT_TYPE_ERR
+} catch (err) {
+    e = err;
+}
+
+shouldBeEqualToString("e.toString()", "Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0");
+shouldBeEqualToString("Object.prototype.toString.call(e)", "[object EventException]");
+shouldBeEqualToString("Object.prototype.toString.call(e.__proto__)", "[object EventExceptionPrototype]");
+shouldBeEqualToString("e.constructor.toString()", "[object EventExceptionConstructor]");
+shouldBe("e.constructor", "window.EventException");
+shouldBe("e.UNSPECIFIED_EVENT_TYPE_ERR", "e.constructor.UNSPECIFIED_EVENT_TYPE_ERR");
+shouldBe("e.UNSPECIFIED_EVENT_TYPE_ERR", "0");

Modified: trunk/LayoutTests/fast/dom/Window/dispatchEvent-expected.txt (189418 => 189419)


--- trunk/LayoutTests/fast/dom/Window/dispatchEvent-expected.txt	2015-09-05 04:20:54 UTC (rev 189418)
+++ trunk/LayoutTests/fast/dom/Window/dispatchEvent-expected.txt	2015-09-05 05:29:24 UTC (rev 189419)
@@ -3,8 +3,8 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS window.dispatchEvent(event) threw exception TypeError: Type error.
-PASS window.dispatchEvent(event) threw exception Error: InvalidStateError: DOM Exception 11.
+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.
 PASS myEventDispatched is true
 PASS target is window
 PASS currentTarget is window

Modified: trunk/LayoutTests/fast/events/dispatch-event-being-dispatched-expected.txt (189418 => 189419)


--- trunk/LayoutTests/fast/events/dispatch-event-being-dispatched-expected.txt	2015-09-05 04:20:54 UTC (rev 189418)
+++ trunk/LayoutTests/fast/events/dispatch-event-being-dispatched-expected.txt	2015-09-05 05:29:24 UTC (rev 189419)
@@ -1,13 +1,10 @@
-Tests that dispatchEvent raises INVALID_STATE_ERR if the event being dispatched is already being dispatched.
+Tests that dispatchEvent raises DISPATCH_REQUEST_ERR if the event being dispatched is already being dispatched.
 
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS window.dispatchEvent(event) threw exception Error: InvalidStateError: DOM Exception 11.
+PASS should have got DISPATCH_REQUEST_ERR EventException
 PASS redispatchCustom.wasInvoked is true
-PASS window.dispatchEvent(event) threw exception Error: InvalidStateError: DOM Exception 11.
+PASS should have got DISPATCH_REQUEST_ERR EventException
 PASS checkCustom.wasInvoked is true
-PASS document.dispatchEvent(event) threw exception Error: InvalidStateError: DOM Exception 11.
+PASS should have got DISPATCH_REQUEST_ERR EventException
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/events/dispatch-event-being-dispatched.html (189418 => 189419)


--- trunk/LayoutTests/fast/events/dispatch-event-being-dispatched.html	2015-09-05 04:20:54 UTC (rev 189418)
+++ trunk/LayoutTests/fast/events/dispatch-event-being-dispatched.html	2015-09-05 05:29:24 UTC (rev 189419)
@@ -1,24 +1,43 @@
 <!DOCTYPE html>
 <html>
+<head>
+<script src=""
+</head>
 <body>
-<script src=""
-<div class="testDiv"></div>
+<p class="description">
+Tests that dispatchEvent raises DISPATCH_REQUEST_ERR if the event
+being dispatched is already being dispatched.
+</p>
+<pre id="console">
+</pre>
 <script>
-description("Tests that dispatchEvent raises INVALID_STATE_ERR if the event being dispatched is already being dispatched.");
+if (window.testRunner)
+    testRunner.dumpAsText();
 
 jsTestIsAsync = true;
 
-// try redispatching an event in the process of being dispatched with dispatchEvent
+function shouldBeDispatchRequestErr(exception) {
+    var ok = EventException.prototype.isPrototypeOf(exception) && exception.code == EventException.DISPATCH_REQUEST_ERR;
+    (ok ? testPassed : testFailed)("should have got DISPATCH_REQUEST_ERR EventException");
+}
 
+// try redispatching an event in the process of being dispatched with
+// dispatchEvent
+
 function redispatchCustom(event) {
-    shouldThrow("window.dispatchEvent(event)", "'Error: InvalidStateError: DOM Exception 11'");
+    try {
+        window.dispatchEvent(event);
+        testFailed('dispatchEvent of an event being dispatched should throw an exception');
+    } catch (ex) {
+        shouldBeDispatchRequestErr(ex);
+    }
 
     redispatchCustom.wasInvoked = true;
 }
 
 var customEvent = document.createEvent('CustomEvent');
 customEvent.initCustomEvent('foo', true, true, null);
-var p = document.querySelector('.testDiv');
+var p = document.querySelector('.description');
 p.addEventListener('foo', redispatchCustom);
 p.dispatchEvent(customEvent);
 shouldBeTrue('redispatchCustom.wasInvoked');
@@ -43,9 +62,15 @@
         return;
     }
 
-    redispatchLoad.dispatching = true;
-    shouldThrow("document.dispatchEvent(event)", "'Error: InvalidStateError: DOM Exception 11'");
-    delete redispatchLoad.dispatching;
+    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;
+    }
 
     finishJSTest();
 }

Modified: trunk/LayoutTests/http/tests/w3c/dom/events/Event-type-empty-expected.txt (189418 => 189419)


--- trunk/LayoutTests/http/tests/w3c/dom/events/Event-type-empty-expected.txt	2015-09-05 04:20:54 UTC (rev 189418)
+++ trunk/LayoutTests/http/tests/w3c/dom/events/Event-type-empty-expected.txt	2015-09-05 05:29:24 UTC (rev 189419)
@@ -1,4 +1,4 @@
 
-PASS initEvent 
-PASS Constructor 
+FAIL initEvent UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0
+FAIL Constructor UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0
 

Modified: trunk/LayoutTests/http/tests/w3c/dom/events/EventTarget-dispatchEvent-expected.txt (189418 => 189419)


--- trunk/LayoutTests/http/tests/w3c/dom/events/EventTarget-dispatchEvent-expected.txt	2015-09-05 04:20:54 UTC (rev 189418)
+++ trunk/LayoutTests/http/tests/w3c/dom/events/EventTarget-dispatchEvent-expected.txt	2015-09-05 05:29:24 UTC (rev 189419)
@@ -1,19 +1,21 @@
 CONSOLE MESSAGE: line 60: Error
 
-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). 
+FAIL Calling dispatchEvent(null). assert_throws: function "function () { document.dispatchEvent(null) }" threw object "Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0" ("UNSPECIFIED_EVENT_TYPE_ERR") expected object "TypeError" ("TypeError")
+FAIL If the event's initialized flag is not set, an InvalidStateError must be thrown (CustomEvent). assert_throws: function "function () { document.dispatchEvent(e) }" threw object "Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0" that is not a DOMException InvalidStateError: property "code" 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 "function () { document.dispatchEvent(e) }" threw object "Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0" that is not a DOMException InvalidStateError: property "code" 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 "function () { document.dispatchEvent(e) }" threw object "Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0" that is not a DOMException InvalidStateError: property "code" 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 "function () { document.dispatchEvent(e) }" threw object "Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0" that is not a DOMException InvalidStateError: property "code" 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 "function () { document.dispatchEvent(e) }" threw object "Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0" that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
 FAIL If the event's initialized flag is not set, an InvalidStateError must be thrown (KeyEvents). NotSupportedError: DOM Exception 9
-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). 
+FAIL If the event's initialized flag is not set, an InvalidStateError must be thrown (MessageEvent). assert_throws: function "function () { document.dispatchEvent(e) }" threw object "Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0" that is not a DOMException InvalidStateError: property "code" 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 "function () { document.dispatchEvent(e) }" threw object "Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0" that is not a DOMException InvalidStateError: property "code" 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 "function () { document.dispatchEvent(e) }" threw object "Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0" that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
 FAIL If the event's initialized flag is not set, an InvalidStateError must be thrown (TouchEvent). NotSupportedError: DOM Exception 9
-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. 
+FAIL If the event's initialized flag is not set, an InvalidStateError must be thrown (UIEvent). assert_throws: function "function () { document.dispatchEvent(e) }" threw object "Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0" that is not a DOMException InvalidStateError: property "code" 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 "function () { document.dispatchEvent(e) }" threw object "Error: UNSPECIFIED_EVENT_TYPE_ERR: DOM Events Exception 0" that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
+FAIL If the event's dispatch flag is set, an InvalidStateError must be thrown. assert_throws: function "function () {
+      target.dispatchEvent(e)
+    }" threw object "Error: DISPATCH_REQUEST_ERR: DOM Events Exception 1" that is not a DOMException InvalidStateError: property "code" is equal to 1, expected 11
 PASS Exceptions from event listeners must not be propagated. 
 FAIL Event listeners added during dispatch should be called assert_array_equals: lengths differ, expected 2 got 0
 PASS Event listeners should be called in order of addition 

Modified: trunk/Source/WebCore/ChangeLog (189418 => 189419)


--- trunk/Source/WebCore/ChangeLog	2015-09-05 04:20:54 UTC (rev 189418)
+++ trunk/Source/WebCore/ChangeLog	2015-09-05 05:29:24 UTC (rev 189419)
@@ -1,3 +1,18 @@
+2015-09-04  Commit Queue  <[email protected]>
+
+        Unreviewed, rolling out r189386.
+        https://bugs.webkit.org/show_bug.cgi?id=148883
+
+        Made several event dispatch tests assert (Requested by ap on
+        #webkit).
+
+        Reverted changeset:
+
+        "dispatchEvent() should throw an InvalidStateError if the
+        event's initialized flag is not set"
+        https://bugs.webkit.org/show_bug.cgi?id=148800
+        http://trac.webkit.org/changeset/189386
+
 2015-09-04  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: Add tests for DOM highlight commands

Modified: trunk/Source/WebCore/dom/Event.cpp (189418 => 189419)


--- trunk/Source/WebCore/dom/Event.cpp	2015-09-05 04:20:54 UTC (rev 189418)
+++ trunk/Source/WebCore/dom/Event.cpp	2015-09-05 05:29:24 UTC (rev 189419)
@@ -56,8 +56,7 @@
 }
 
 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg)
-    : m_isInitialized(true)
-    , m_type(eventType)
+    : m_type(eventType)
     , m_canBubble(canBubbleArg)
     , m_cancelable(cancelableArg)
     , m_propagationStopped(false)
@@ -72,8 +71,7 @@
 }
 
 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, double timestamp)
-    : m_isInitialized(true)
-    , m_type(eventType)
+    : m_type(eventType)
     , m_canBubble(canBubbleArg)
     , m_cancelable(cancelableArg)
     , m_propagationStopped(false)
@@ -88,8 +86,7 @@
 }
 
 Event::Event(const AtomicString& eventType, const EventInit& initializer)
-    : m_isInitialized(true)
-    , m_type(eventType)
+    : m_type(eventType)
     , m_canBubble(initializer.bubbles)
     , m_cancelable(initializer.cancelable)
     , m_propagationStopped(false)
@@ -112,7 +109,6 @@
     if (dispatched())
         return;
 
-    m_isInitialized = true;
     m_propagationStopped = false;
     m_immediatePropagationStopped = false;
     m_defaultPrevented = false;

Modified: trunk/Source/WebCore/dom/Event.h (189418 => 189419)


--- trunk/Source/WebCore/dom/Event.h	2015-09-05 04:20:54 UTC (rev 189418)
+++ trunk/Source/WebCore/dom/Event.h	2015-09-05 05:29:24 UTC (rev 189419)
@@ -100,7 +100,6 @@
     virtual ~Event();
 
     void initEvent(const AtomicString& type, bool canBubble, bool cancelable);
-    bool isInitialized() const { return m_isInitialized; }
 
     const AtomicString& type() const { return m_type; }
     void setType(const AtomicString& type) { m_type = type; }
@@ -189,7 +188,6 @@
     bool dispatched() const { return m_target; }
 
 private:
-    bool m_isInitialized { false };
     AtomicString m_type;
     bool m_canBubble;
     bool m_cancelable;

Modified: trunk/Source/WebCore/dom/EventTarget.cpp (189418 => 189419)


--- trunk/Source/WebCore/dom/EventTarget.cpp	2015-09-05 04:20:54 UTC (rev 189418)
+++ trunk/Source/WebCore/dom/EventTarget.cpp	2015-09-05 05:29:24 UTC (rev 189419)
@@ -138,13 +138,13 @@
 
 bool EventTarget::dispatchEvent(PassRefPtr<Event> event, ExceptionCode& ec)
 {
-    if (!event) {
-        ec = TypeError;
+    if (!event || event->type().isEmpty()) {
+        ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR;
         return false;
     }
 
-    if (!event->isInitialized() || event->isBeingDispatched()) {
-        ec = INVALID_STATE_ERR;
+    if (event->isBeingDispatched()) {
+        ec = EventException::DISPATCH_REQUEST_ERR;
         return false;
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to