WebCore:
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 30 Dec 2007 22:24:47 +0000 (22:24 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 30 Dec 2007 22:24:47 +0000 (22:24 +0000)
        Reviewed by Oliver Hunt.

        Patch for http://bugs.webkit.org/show_bug.cgi?id=10686
        event instanceof MouseEvent throws exception

        Add JS constructors for all the Event types.

        Test: fast/events/event-instanceof.html

        * WebCore.xcodeproj/project.pbxproj:
        * dom/KeyboardEvent.idl:
        * dom/MouseEvent.idl:
        * dom/MutationEvent.idl:
        * dom/OverflowEvent.idl:
        * dom/ProgressEvent.idl:
        * dom/TextEvent.idl:
        * dom/UIEvent.idl:
        * dom/WheelEvent.idl:
        * page/DOMWindow.idl:

LayoutTests:

        Reviewed by Oliver Hunt.

        Test for http://bugs.webkit.org/show_bug.cgi?id=10686
        event instanceof MouseEvent throws exception

        * fast/dom/Window/window-properties-expected.txt:
        * fast/events/event-instanceof.html: Added.
        * fast/events/resources/event-instanceof.js: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@29041 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/Window/window-properties-expected.txt
LayoutTests/fast/events/event-instanceof.html [new file with mode: 0644]
LayoutTests/fast/events/resources/event-instanceof.js [new file with mode: 0644]
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/dom/KeyboardEvent.idl
WebCore/dom/MouseEvent.idl
WebCore/dom/MutationEvent.idl
WebCore/dom/OverflowEvent.idl
WebCore/dom/ProgressEvent.idl
WebCore/dom/TextEvent.idl
WebCore/dom/UIEvent.idl
WebCore/dom/WheelEvent.idl
WebCore/page/DOMWindow.idl

index d359434dd3430b686f9097d2788e291c6cc0cfb1..096eef11a91345e8a8b618572f2aec06b0178f31 100644 (file)
@@ -1,3 +1,14 @@
+2007-12-30  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Oliver Hunt.
+
+        Test for http://bugs.webkit.org/show_bug.cgi?id=10686
+        event instanceof MouseEvent throws exception
+
+        * fast/dom/Window/window-properties-expected.txt:
+        * fast/events/event-instanceof.html: Added.
+        * fast/events/resources/event-instanceof.js: Added.
+
 2007-12-30  David Kilzer  <ddkilzer@webkit.org>
 
         Reviewed by Darin.
index 6b056364094f9708389fe9c025b956b4a35f63ea..5c3005e30fc81c51c9e72c9b2869aa72c4146d6c 100644 (file)
@@ -689,6 +689,8 @@ window.HTMLUListElement.prototype [printed above as window.Element.prototype]
 window.HTMLVideoElement [object HTMLVideoElementConstructor]
 window.HTMLVideoElement.prototype [printed above as window.Element.prototype]
 window.Image [object Object]
+window.KeyboardEvent [object KeyboardEventConstructor]
+window.KeyboardEvent.prototype [printed above as window.Event.prototype]
 window.MediaError [object MediaErrorConstructor]
 window.MediaError.MEDIA_ERR_ABORTED [number]
 window.MediaError.MEDIA_ERR_DECODE [number]
@@ -702,6 +704,8 @@ window.MediaList.prototype [object MediaListPrototype]
 window.MediaList.prototype.appendMedium [function]
 window.MediaList.prototype.deleteMedium [function]
 window.MediaList.prototype.item [function]
+window.MouseEvent [object MouseEventConstructor]
+window.MouseEvent.prototype [printed above as window.Event.prototype]
 window.MutationEvent [object MutationEventConstructor]
 window.MutationEvent.ADDITION [number]
 window.MutationEvent.MODIFICATION [number]
@@ -797,8 +801,15 @@ window.NodeList.prototype.item [function]
 window.Notation [object NotationConstructor]
 window.Notation.prototype [printed above as window.Node.prototype]
 window.Option [object Object]
+window.OverflowEvent [object OverflowEventConstructor]
+window.OverflowEvent.BOTH [number]
+window.OverflowEvent.HORIZONTAL [number]
+window.OverflowEvent.VERTICAL [number]
+window.OverflowEvent.prototype [printed above as window.Event.prototype]
 window.ProcessingInstruction [object ProcessingInstructionConstructor]
 window.ProcessingInstruction.prototype [printed above as window.Node.prototype]
+window.ProgressEvent [object ProgressEventConstructor]
+window.ProgressEvent.prototype [printed above as window.Event.prototype]
 window.Range [object RangeConstructor]
 window.Range.END_TO_END [number]
 window.Range.END_TO_START [number]
@@ -1066,8 +1077,14 @@ window.StyleSheetList.prototype.item [function]
 window.SyntaxError [function]
 window.Text [object TextConstructor]
 window.Text.prototype [printed above as window.CharacterData.prototype]
+window.TextEvent [object TextEventConstructor]
+window.TextEvent.prototype [printed above as window.Event.prototype]
 window.TypeError [function]
+window.UIEvent [object UIEventConstructor]
+window.UIEvent.prototype [printed above as window.Event.prototype]
 window.URIError [function]
+window.WheelEvent [object WheelEventConstructor]
+window.WheelEvent.prototype [printed above as window.Event.prototype]
 window.XMLDocument [printed above as window.Document]
 window.XMLHttpRequest [object Object]
 window.XMLHttpRequest.prototype [object JSXMLHttpRequestPrototype]
diff --git a/LayoutTests/fast/events/event-instanceof.html b/LayoutTests/fast/events/event-instanceof.html
new file mode 100644 (file)
index 0000000..6c3264f
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="resources/js-test-style.css">
+<script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/event-instanceof.js"></script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/events/resources/event-instanceof.js b/LayoutTests/fast/events/resources/event-instanceof.js
new file mode 100644 (file)
index 0000000..af3601d
--- /dev/null
@@ -0,0 +1,50 @@
+description("This tests that the Event classes have constructors.");
+
+var event = document.createEvent("Event");
+shouldBeTrue("event instanceof window.Event");
+shouldBeTrue("event.constructor === window.Event");
+
+var uiEvent = document.createEvent("UIEvent");
+shouldBeTrue("uiEvent instanceof window.UIEvent");
+shouldBeTrue("uiEvent instanceof window.Event");
+shouldBeTrue("uiEvent.constructor === window.UIEvent");
+
+var keyboardEvent = document.createEvent("KeyboardEvent");
+shouldBeTrue("keyboardEvent instanceof window.KeyboardEvent");
+shouldBeTrue("keyboardEvent instanceof window.UIEvent");
+shouldBeTrue("keyboardEvent instanceof window.Event");
+shouldBeTrue("keyboardEvent.constructor === window.KeyboardEvent");
+
+var mouseEvent = document.createEvent("MouseEvent");
+shouldBeTrue("mouseEvent instanceof window.MouseEvent");
+shouldBeTrue("mouseEvent instanceof window.UIEvent");
+shouldBeTrue("mouseEvent instanceof window.Event");
+shouldBeTrue("mouseEvent.constructor === window.MouseEvent");
+
+var wheelEvent = document.createEvent("WheelEvent");
+shouldBeTrue("wheelEvent instanceof window.WheelEvent");
+shouldBeTrue("wheelEvent instanceof window.UIEvent");
+shouldBeTrue("wheelEvent instanceof window.Event");
+shouldBeTrue("wheelEvent.constructor === window.WheelEvent");
+
+var mutationEvent = document.createEvent("MutationEvent");
+shouldBeTrue("mutationEvent instanceof window.MutationEvent");
+shouldBeTrue("mutationEvent instanceof window.Event");
+shouldBeTrue("mutationEvent.constructor === window.MutationEvent");
+
+var overflowEvent = document.createEvent("OverflowEvent");
+shouldBeTrue("overflowEvent instanceof window.OverflowEvent");
+shouldBeTrue("overflowEvent instanceof window.Event");
+shouldBeTrue("overflowEvent.constructor === window.OverflowEvent");
+
+var progressEvent = document.createEvent("ProgressEvent");
+shouldBeTrue("progressEvent instanceof window.ProgressEvent");
+shouldBeTrue("progressEvent instanceof window.Event");
+shouldBeTrue("progressEvent.constructor === window.ProgressEvent");
+
+var textEvent = document.createEvent("TextEvent");
+shouldBeTrue("textEvent instanceof window.TextEvent");
+shouldBeTrue("textEvent instanceof window.Event");
+shouldBeTrue("textEvent.constructor === window.TextEvent");
+
+var successfullyParsed = true;
index b745c96fb33cec3e531b853fbe8e33b55899570c..a11bbfca7a38302269e77773e254bb5217f440f5 100644 (file)
@@ -1,3 +1,25 @@
+2007-12-30  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Oliver Hunt.
+
+        Patch for http://bugs.webkit.org/show_bug.cgi?id=10686
+        event instanceof MouseEvent throws exception
+
+        Add JS constructors for all the Event types.
+
+        Test: fast/events/event-instanceof.html
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/KeyboardEvent.idl:
+        * dom/MouseEvent.idl:
+        * dom/MutationEvent.idl:
+        * dom/OverflowEvent.idl:
+        * dom/ProgressEvent.idl:
+        * dom/TextEvent.idl:
+        * dom/UIEvent.idl:
+        * dom/WheelEvent.idl:
+        * page/DOMWindow.idl:
+
 2007-12-30  David Kilzer  <ddkilzer@webkit.org>
 
         Reviewed by Darin.
index 8fe6aec3c40d7be065252686e98ef1578c410fb6..8507898f25bf91423d4371200a786bdb828b0f04 100644 (file)
                0867D690FE84028FC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
+                       compatibilityVersion = "Xcode 2.4";
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
index afa95abc50bf5c915abca47c6b697f7b2946c096..7e1f1ee283e21cc310ecbf97acda3a409ec4b832 100644 (file)
@@ -21,7 +21,9 @@
 module events {
 
     // Introduced in DOM Level 3:
-    interface KeyboardEvent : UIEvent {
+    interface [
+        GenerateConstructor
+    ] KeyboardEvent : UIEvent {
 
 #if !defined(LANGUAGE_JAVASCRIPT)
         // KeyLocationCode
index 5248e0301c301bb0fdb7a5e6cef9d5d09bf4da64..01f521585f09ec8ee215501f0d31d9bab4f11c71 100644 (file)
@@ -20,7 +20,9 @@
 module events {
 
     // Introduced in DOM Level 2:
-    interface MouseEvent : UIEvent {
+    interface [
+        GenerateConstructor
+    ] MouseEvent : UIEvent {
         readonly attribute long             screenX;
         readonly attribute long             screenY;
         readonly attribute long             clientX;
index bc5a75600c1dc0191184068f6f2844fc6a502cf1..a38309113a7c7b9e69a0df4fd74088d6a3e5efb3 100644 (file)
@@ -20,7 +20,9 @@
 module events {
 
     // Introduced in DOM Level 2:
-    interface [GenerateConstructor] MutationEvent : Event {
+    interface [
+        GenerateConstructor
+    ] MutationEvent : Event {
 
         // attrChangeType
         const unsigned short MODIFICATION = 1;
index 0b4f5c603787ebfd8c4d3f4439b829e16edc3655..4a1bed58a47f690ad58f731ca6afd7a0ae4494b8 100644 (file)
@@ -24,7 +24,9 @@
  */
 module events {
 
-    interface OverflowEvent : Event {
+    interface [
+        GenerateConstructor
+    ] OverflowEvent : Event {
         const unsigned short HORIZONTAL = 0;
         const unsigned short VERTICAL   = 1;
         const unsigned short BOTH       = 2;
index 36659ab2cd5ef0d2eea0b34b5272ec4c9ccfcd80..4bc27c24bd91842609ec0a23cc84f870a34431db 100644 (file)
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
+
 module events {
 
-interface ProgressEvent : Event {
-     readonly attribute boolean         lengthComputable;
-     readonly attribute unsigned long   loaded;
-     readonly attribute unsigned long   total;
-     void               initProgressEvent(in DOMString typeArg,
-                                          in boolean       canBubbleArg,
-                                          in boolean       cancelableArg,
-                                          in boolean       lengthComputableArg,
-                                          in unsigned long loadedArg,
-                                          in unsigned long totalArg);
-     void               initProgressEventNS(in DOMString namespaceURI,
-                                            in DOMString typeArg,
-                                            in boolean       canBubbleArg,
-                                            in boolean       cancelableArg,
-                                            in boolean       lengthComputableArg,
-                                            in unsigned long loadedArg,
-                                            in unsigned long totalArg);
-};
+    interface [
+        GenerateConstructor
+    ] ProgressEvent : Event {
+         readonly attribute boolean         lengthComputable;
+         readonly attribute unsigned long   loaded;
+         readonly attribute unsigned long   total;
+         void               initProgressEvent(in DOMString typeArg,
+                                              in boolean       canBubbleArg,
+                                              in boolean       cancelableArg,
+                                              in boolean       lengthComputableArg,
+                                              in unsigned long loadedArg,
+                                              in unsigned long totalArg);
+         void               initProgressEventNS(in DOMString namespaceURI,
+                                                in DOMString typeArg,
+                                                in boolean       canBubbleArg,
+                                                in boolean       cancelableArg,
+                                                in boolean       lengthComputableArg,
+                                                in unsigned long loadedArg,
+                                                in unsigned long totalArg);
+    };
 
 }
index 83b0e3bb371f19aa08cbb88ee89b7d3f4924f1ad..779afd1acf55adaffac38de1462f0c5afbfa32aa 100644 (file)
@@ -26,7 +26,9 @@
 module events {
 
     // Introduced in DOM Level 3:
-    interface TextEvent : UIEvent {
+    interface [
+        GenerateConstructor
+    ] TextEvent : UIEvent {
 
         readonly attribute DOMString data;
 
index b267e31b52272644f33a11b10dbfdcc944ad277b..f6eeb8d81a546e6c51e93754e8c4ebf594aa7cf7 100644 (file)
@@ -20,7 +20,9 @@
 module events {
 
     // Introduced in DOM Level 2:
-    interface UIEvent : Event {
+    interface [
+        GenerateConstructor
+    ] UIEvent : Event {
         readonly attribute DOMWindow            view;
         readonly attribute long                 detail;
         
index f403168cdc433ce55af917dfed34161ff1793140..1445509431407c905d0716f7893c8b6d40c470c8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
  * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
  *
  * This library is free software; you can redistribute it and/or
@@ -21,7 +21,9 @@
 module events {
 
     // Based off of proposed IDL interface for WheelEvent:
-    interface WheelEvent : UIEvent {
+    interface [
+        GenerateConstructor
+    ] WheelEvent : UIEvent {
         readonly attribute long    screenX;
         readonly attribute long    screenY;
         readonly attribute long    clientX;
index 64f774c38682c17ae20b16d15fd95b76b21f4ddb..d1af2672fcf95e21ffd2b25ebd7f908c730899d8 100644 (file)
@@ -240,7 +240,14 @@ module window {
         attribute HTMLUListElementConstructor HTMLUListElement;
 
         attribute EventConstructor Event;
+        attribute KeyboardEventConstructor KeyboardEvent;
+        attribute MouseEventConstructor MouseEvent;
         attribute MutationEventConstructor MutationEvent;
+        attribute OverflowEventConstructor OverflowEvent;
+        attribute ProgressEventConstructor ProgressEvent;
+        attribute TextEventConstructor TextEvent;
+        attribute UIEventConstructor UIEvent;
+        attribute WheelEventConstructor WheelEvent;
 
         attribute NodeFilterConstructor NodeFilter;
         attribute RangeConstructor Range;