OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <meta charset=utf-8> | 2 <meta charset=utf-8> |
3 <title>Document.createEvent</title> | 3 <title>Document.createEvent</title> |
4 <link rel=help href="https://dom.spec.whatwg.org/#dom-document-createevent"> | 4 <link rel=help href="https://dom.spec.whatwg.org/#dom-document-createevent"> |
5 <script src="../../../../resources/testharness.js"></script> | 5 <script src="../../../../resources/testharness.js"></script> |
6 <script src="../../../../resources/testharnessreport.js"></script> | 6 <script src="../../../../resources/testharnessreport.js"></script> |
7 <script src="Document-createEvent.js"></script> | 7 <script src="Document-createEvent.js"></script> |
8 <div id="log"></div> | 8 <div id="log"></div> |
9 <script> | 9 <script> |
10 function testAlias(arg, iface) { | 10 function testAlias(arg, iface) { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 }); | 65 }); |
66 }, "Should throw NOT_SUPPORTED_ERR for unrecognized arguments"); | 66 }, "Should throw NOT_SUPPORTED_ERR for unrecognized arguments"); |
67 | 67 |
68 /* | 68 /* |
69 * The following are event interfaces which do actually exist, but must still | 69 * The following are event interfaces which do actually exist, but must still |
70 * throw since they're absent from the table in the spec for | 70 * throw since they're absent from the table in the spec for |
71 * document.createEvent(). This list is not exhaustive, but includes all | 71 * document.createEvent(). This list is not exhaustive, but includes all |
72 * interfaces that it is known some UA does or did not throw for. | 72 * interfaces that it is known some UA does or did not throw for. |
73 */ | 73 */ |
74 var someNonCreateableEvents = [ | 74 var someNonCreateableEvents = [ |
75 "AnimationEvent", | |
76 "AnimationPlayerEvent", | 75 "AnimationPlayerEvent", |
77 "ApplicationCacheErrorEvent", | 76 "ApplicationCacheErrorEvent", |
78 "AudioProcessingEvent", | 77 "AudioProcessingEvent", |
79 "AutocompleteErrorEvent", | 78 "AutocompleteErrorEvent", |
80 "BeforeInstallPromptEvent", | 79 "BeforeInstallPromptEvent", |
81 "BeforeUnloadEvent", | |
82 "BlobEvent", | 80 "BlobEvent", |
83 "ClipboardEvent", | 81 "ClipboardEvent", |
84 "CloseEvent", | |
85 "CommandEvent", | 82 "CommandEvent", |
86 "CompositionEvent", | |
87 "DataContainerEvent", | 83 "DataContainerEvent", |
88 "DeviceLightEvent", | 84 "DeviceLightEvent", |
89 "DeviceMotionEvent", | |
90 "DeviceOrientationEvent", | |
91 "DragEvent", | |
92 "ErrorEvent", | |
93 "ExtendableEvent", | 85 "ExtendableEvent", |
94 "ExtendableMessageEvent", | 86 "ExtendableMessageEvent", |
95 "FetchEvent", | 87 "FetchEvent", |
96 "FocusEvent", | |
97 "FontFaceSetLoadEvent", | 88 "FontFaceSetLoadEvent", |
98 "GamepadEvent", | 89 "GamepadEvent", |
99 "GeofencingEvent", | 90 "GeofencingEvent", |
100 "HashChangeEvent", | |
101 "IDBVersionChangeEvent", | |
102 "InstallEvent", | 91 "InstallEvent", |
103 "KeyEvent", | 92 "KeyEvent", |
104 "MIDIConnectionEvent", | 93 "MIDIConnectionEvent", |
105 "MIDIMessageEvent", | 94 "MIDIMessageEvent", |
106 "MediaEncryptedEvent", | 95 "MediaEncryptedEvent", |
107 "MediaKeyEvent", | 96 "MediaKeyEvent", |
108 "MediaKeyMessageEvent", | 97 "MediaKeyMessageEvent", |
109 "MediaQueryListEvent", | 98 "MediaQueryListEvent", |
110 "MediaStreamEvent", | 99 "MediaStreamEvent", |
111 "MediaStreamTrackEvent", | 100 "MediaStreamTrackEvent", |
112 "MouseScrollEvent", | 101 "MouseScrollEvent", |
113 "MutationEvent", | 102 "MutationEvent", |
114 "NotificationEvent", | 103 "NotificationEvent", |
115 "NotifyPaintEvent", | 104 "NotifyPaintEvent", |
116 "OfflineAudioCompletionEvent", | 105 "OfflineAudioCompletionEvent", |
117 "OrientationEvent", | 106 "OrientationEvent", |
118 "PageTransition", // Yes, with no "Event" | 107 "PageTransition", // Yes, with no "Event" |
119 "PageTransitionEvent", | |
120 "PointerEvent", | 108 "PointerEvent", |
121 "PopStateEvent", | |
122 "PopUpEvent", | 109 "PopUpEvent", |
123 "PresentationConnectionAvailableEvent", | 110 "PresentationConnectionAvailableEvent", |
124 "PresentationConnectionCloseEvent", | 111 "PresentationConnectionCloseEvent", |
125 "ProgressEvent", | |
126 "PromiseRejectionEvent", | 112 "PromiseRejectionEvent", |
127 "PushEvent", | 113 "PushEvent", |
128 "RTCDTMFToneChangeEvent", | 114 "RTCDTMFToneChangeEvent", |
129 "RTCDataChannelEvent", | 115 "RTCDataChannelEvent", |
130 "RTCIceCandidateEvent", | 116 "RTCIceCandidateEvent", |
131 "RelatedEvent", | 117 "RelatedEvent", |
132 "ResourceProgressEvent", | 118 "ResourceProgressEvent", |
133 "SVGEvent", | 119 "SVGEvent", |
134 "SVGZoomEvent", | |
135 "ScrollAreaEvent", | 120 "ScrollAreaEvent", |
136 "SecurityPolicyViolationEvent", | 121 "SecurityPolicyViolationEvent", |
137 "ServicePortConnectEvent", | 122 "ServicePortConnectEvent", |
138 "ServiceWorkerMessageEvent", | 123 "ServiceWorkerMessageEvent", |
139 "SimpleGestureEvent", | 124 "SimpleGestureEvent", |
140 "SpeechRecognitionError", | 125 "SpeechRecognitionError", |
141 "SpeechRecognitionEvent", | 126 "SpeechRecognitionEvent", |
142 "SpeechSynthesisEvent", | 127 "SpeechSynthesisEvent", |
143 "StorageEvent", | |
144 "SyncEvent", | 128 "SyncEvent", |
145 "TextEvent", | |
146 "TimeEvent", | 129 "TimeEvent", |
147 "TrackEvent", | |
148 "TransitionEvent", | |
149 "WebGLContextEvent", | |
150 "WebKitAnimationEvent", | 130 "WebKitAnimationEvent", |
151 "WebKitTransitionEvent", | 131 "WebKitTransitionEvent", |
152 "WheelEvent", | |
153 "XULCommandEvent", | 132 "XULCommandEvent", |
154 ]; | 133 ]; |
155 someNonCreateableEvents.forEach(function (eventInterface) { | 134 someNonCreateableEvents.forEach(function (eventInterface) { |
156 test(function () { | 135 // SVGEvents is allowed, but not SVGEvent. Make sure we only test if it's |
157 assert_throws("NOT_SUPPORTED_ERR", function () { | 136 // not whitelisted. |
158 var evt = document.createEvent(eventInterface); | 137 if (!(eventInterface in aliases)) { |
159 }); | 138 test(function () { |
160 }, 'Should throw NOT_SUPPORTED_ERR for non-legacy event interface "' + eventIn
terface + '"'); | 139 assert_throws("NOT_SUPPORTED_ERR", function () { |
| 140 var evt = document.createEvent(eventInterface); |
| 141 }); |
| 142 }, 'Should throw NOT_SUPPORTED_ERR for non-legacy event interface "' + event
Interface + '"'); |
| 143 } |
161 | 144 |
162 test(function () { | 145 if (!(eventInterface + "s" in aliases)) { |
163 assert_throws("NOT_SUPPORTED_ERR", function () { | 146 test(function () { |
164 var evt = document.createEvent(eventInterface + "s"); | 147 assert_throws("NOT_SUPPORTED_ERR", function () { |
165 }); | 148 var evt = document.createEvent(eventInterface + "s"); |
166 }, 'Should throw NOT_SUPPORTED_ERR for pluralized non-legacy event interface "
' + eventInterface + 's"'); | 149 }); |
| 150 }, 'Should throw NOT_SUPPORTED_ERR for pluralized non-legacy event interface
"' + eventInterface + 's"'); |
| 151 } |
167 }); | 152 }); |
168 </script> | 153 </script> |
OLD | NEW |