OLD | NEW |
1 <head> | 1 <head> |
2 <script src="../../resources/js-test.js"></script> | 2 <script src="../../resources/js-test.js"></script> |
3 </head> | 3 </head> |
4 <body> | 4 <body> |
5 <script> | 5 <script> |
6 description("This tests that document.createEvent is hooked up for all Event
interfaces (and alternatives) and creates the right instance.") | 6 description("This tests that document.createEvent is hooked up for all Event
interfaces (and alternatives) and creates the right instance.") |
7 | 7 |
8 // AnimationEvent | 8 // AnimationEvent |
9 shouldBeTrue("document.createEvent('AnimationEvent') instanceof window.Anima
tionEvent"); | 9 shouldBeTrue("document.createEvent('AnimationEvent') instanceof window.Anima
tionEvent"); |
10 shouldBeTrue("document.createEvent('AnimationEvent') instanceof window.Event
"); | 10 shouldBeTrue("document.createEvent('AnimationEvent') instanceof window.Event
"); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 shouldBeTrue("document.createEvent('SVGEvents') instanceof window.Event"); | 166 shouldBeTrue("document.createEvent('SVGEvents') instanceof window.Event"); |
167 shouldBeTrue("document.createEvent('SVGEvents').constructor === window.Event
"); | 167 shouldBeTrue("document.createEvent('SVGEvents').constructor === window.Event
"); |
168 | 168 |
169 // CloseEvent | 169 // CloseEvent |
170 shouldBeTrue("document.createEvent('CloseEvent') instanceof window.CloseEven
t"); | 170 shouldBeTrue("document.createEvent('CloseEvent') instanceof window.CloseEven
t"); |
171 shouldBeTrue("document.createEvent('CloseEvent') instanceof window.Event"); | 171 shouldBeTrue("document.createEvent('CloseEvent') instanceof window.Event"); |
172 shouldBeTrue("document.createEvent('CloseEvent').constructor === window.Clos
eEvent"); | 172 shouldBeTrue("document.createEvent('CloseEvent').constructor === window.Clos
eEvent"); |
173 | 173 |
174 // The following are here for completeness, but won't until there is more wi
despread support for them. | 174 // The following are here for completeness, but won't until there is more wi
despread support for them. |
175 | 175 |
176 // #if ENABLE(WEB_AUDIO) | |
177 // AudioProcessingEvent | |
178 // shouldBeTrue("document.createEvent('AudioProcessingEvent') instanceof win
dow.AudioProcessingEvent"); | |
179 // shouldBeTrue("document.createEvent('AudioProcessingEvent') instanceof win
dow.Event"); | |
180 // shouldBeTrue("document.createEvent('AudioProcessingEvent').constructor ==
= window.AudioProcessingEvent"); | |
181 | |
182 // #if ENABLE(WEB_AUDIO) | |
183 // OfflineAudioCompletionEvent | |
184 // shouldBeTrue("document.createEvent('OfflineAudioCompletionEvent') instanc
eof window.OfflineAudioCompletionEvent"); | |
185 // shouldBeTrue("document.createEvent('OfflineAudioCompletionEvent') instanc
eof window.Event"); | |
186 // shouldBeTrue("document.createEvent('OfflineAudioCompletionEvent').constru
ctor === window.OfflineAudioCompletionEvent"); | |
187 | |
188 // MediaStreamEvent | |
189 // shouldBeTrue("document.createEvent('MediaStreamEvent') instanceof window.
MediaStreamEvent"); | |
190 // shouldBeTrue("document.createEvent('MediaStreamEvent') instanceof window.
Event"); | |
191 // shouldBeTrue("document.createEvent('MediaStreamEvent').constructor === wi
ndow.MediaStreamEvent"); | |
192 | |
193 // #if ENABLE(WEBGL) | 176 // #if ENABLE(WEBGL) |
194 // WebGLContextEvent | 177 // WebGLContextEvent |
195 // shouldBeTrue("document.createEvent('WebGLContextEvent') instanceof window
.WebGLContextEvent"); | 178 // shouldBeTrue("document.createEvent('WebGLContextEvent') instanceof window
.WebGLContextEvent"); |
196 // shouldBeTrue("document.createEvent('WebGLContextEvent') instanceof window
.Event"); | 179 // shouldBeTrue("document.createEvent('WebGLContextEvent') instanceof window
.Event"); |
197 // shouldBeTrue("document.createEvent('WebGLContextEvent').constructor === w
indow.WebGLContextEvent"); | 180 // shouldBeTrue("document.createEvent('WebGLContextEvent').constructor === w
indow.WebGLContextEvent"); |
198 | 181 |
199 // TouchEvent | 182 // TouchEvent |
200 shouldBeTrue("document.createEvent('TouchEvent') instanceof window.TouchEven
t"); | 183 shouldBeTrue("document.createEvent('TouchEvent') instanceof window.TouchEven
t"); |
201 shouldBeTrue("document.createEvent('TouchEvent') instanceof window.Event"); | 184 shouldBeTrue("document.createEvent('TouchEvent') instanceof window.Event"); |
202 shouldBeTrue("document.createEvent('TouchEvent').constructor === window.Touc
hEvent"); | 185 shouldBeTrue("document.createEvent('TouchEvent').constructor === window.Touc
hEvent"); |
203 | 186 |
204 // DeviceMotionEvent | 187 // DeviceMotionEvent |
205 // shouldBeTrue("document.createEvent('DeviceMotionEvent') instanceof window
.DeviceMotionEvent"); | 188 // shouldBeTrue("document.createEvent('DeviceMotionEvent') instanceof window
.DeviceMotionEvent"); |
206 // shouldBeTrue("document.createEvent('DeviceMotionEvent') instanceof window
.Event"); | 189 // shouldBeTrue("document.createEvent('DeviceMotionEvent') instanceof window
.Event"); |
207 // shouldBeTrue("document.createEvent('DeviceMotionEvent').constructor === w
indow.DeviceMotionEvent"); | 190 // shouldBeTrue("document.createEvent('DeviceMotionEvent').constructor === w
indow.DeviceMotionEvent"); |
208 | 191 |
209 // DeviceOrientationEvent | 192 // DeviceOrientationEvent |
210 // shouldBeTrue("document.createEvent('DeviceOrientationEvent') instanceof w
indow.DeviceOrientationEvent"); | 193 // shouldBeTrue("document.createEvent('DeviceOrientationEvent') instanceof w
indow.DeviceOrientationEvent"); |
211 // shouldBeTrue("document.createEvent('DeviceOrientationEvent') instanceof w
indow.Event"); | 194 // shouldBeTrue("document.createEvent('DeviceOrientationEvent') instanceof w
indow.Event"); |
212 // shouldBeTrue("document.createEvent('DeviceOrientationEvent').constructor
=== window.DeviceOrientationEvent"); | 195 // shouldBeTrue("document.createEvent('DeviceOrientationEvent').constructor
=== window.DeviceOrientationEvent"); |
213 | 196 |
214 // OrientationEvent (Event alternative) | |
215 // shouldBeTrue("document.createEvent('OrientationEvent') instanceof window.
Event"); | |
216 // shouldBeTrue("document.createEvent('OrientationEvent').constructor === wi
ndow.Event"); | |
217 | |
218 // We test both a hard coded set and the automated set below (using enumerat
ion) to ensure that a constructor being removed | 197 // We test both a hard coded set and the automated set below (using enumerat
ion) to ensure that a constructor being removed |
219 // from the window is caught a regression. | 198 // from the window is caught a regression. |
220 | 199 |
221 var allEventInterfacesCreateEvents = true; | 200 var allEventInterfacesCreateEvents = true; |
222 for (var propertyName in window) { | 201 for (var propertyName in window) { |
223 if (propertyName.match(/Event$/) && window[propertyName].toString().matc
h(/EventConstructor\]$/)) { | 202 if (propertyName.match(/Event$/) && window[propertyName].toString().matc
h(/EventConstructor\]$/)) { |
224 try { | 203 try { |
225 if (!(document.createEvent(propertyName) instanceof window.Event
)) { | 204 if (!(document.createEvent(propertyName) instanceof window.Event
)) { |
226 allEventInterfacesCreateEvents = false; | 205 allEventInterfacesCreateEvents = false; |
227 debug("'document.createEvent(propertyName) instanceof window
.Event' with propertyName: " + propertyName + " should be true but isn't"); | 206 debug("'document.createEvent(propertyName) instanceof window
.Event' with propertyName: " + propertyName + " should be true but isn't"); |
(...skipping 23 matching lines...) Expand all Loading... |
251 debug("'document.createEvent(propertyName).constructor === windo
w[propertyName]' with propertyName: " + propertyName + " threw an exception: " +
e); | 230 debug("'document.createEvent(propertyName).constructor === windo
w[propertyName]' with propertyName: " + propertyName + " threw an exception: " +
e); |
252 } | 231 } |
253 } | 232 } |
254 } | 233 } |
255 shouldBeTrue('allEventInterfacesCreateEvents'); | 234 shouldBeTrue('allEventInterfacesCreateEvents'); |
256 </script> | 235 </script> |
257 | 236 |
258 | 237 |
259 | 238 |
260 </body> | 239 </body> |
OLD | NEW |