RESOLVED FIXED Bug 32492
Missing support for document.createEvent("OrientationEvent")
https://bugs.webkit.org/show_bug.cgi?id=32492
Summary Missing support for document.createEvent("OrientationEvent")
Greg Bolsinga
Reported 2009-12-13 10:39:57 PST
When support for OrientationEvents went in with http://trac.webkit.org/changeset/48609, it doesn't have create support. <rdar://problem/7458132>
Attachments
Implement document.createEvent("OrientationEvent") to help unit testing onOrientationEvent. (4.42 KB, patch)
2010-10-14 16:24 PDT, Yongjun Zhang
no flags
(2nd try) fix the typo in test description. (4.36 KB, patch)
2010-10-15 09:20 PDT, Yongjun Zhang
no flags
Address Joe's comment. (4.58 KB, patch)
2010-10-18 10:14 PDT, Yongjun Zhang
no flags
fix patch (6.29 KB, patch)
2010-11-30 06:58 PST, Chang Shu
no flags
Joseph Pecoraro
Comment 1 2010-04-08 14:55:39 PDT
Just some background information: Like other events on the window it can be simulated with createEvent and initEvent: var e = document.createEvent("Event"); e.initEvent('orientationchange', false, false); window.dispatchEvent(e);
Yongjun Zhang
Comment 2 2010-10-14 16:24:16 PDT
Created attachment 70795 [details] Implement document.createEvent("OrientationEvent") to help unit testing onOrientationEvent.
Yongjun Zhang
Comment 3 2010-10-14 16:25:54 PDT
(In reply to comment #2) > Created an attachment (id=70795) [details] > Implement document.createEvent("OrientationEvent") to help unit testing onOrientationEvent. Oops! typo, should be onOrientationChange.
Yongjun Zhang
Comment 4 2010-10-15 09:20:34 PDT
Created attachment 70874 [details] (2nd try) fix the typo in test description.
Joseph Pecoraro
Comment 5 2010-10-15 09:45:56 PDT
Comment on attachment 70874 [details] (2nd try) fix the typo in test description. View in context: https://bugs.webkit.org/attachment.cgi?id=70874&action=review > LayoutTests/fast/dom/DeviceOrientation/create-event-onorientationchange-expected.txt:11 > +Tests that document.createEvent() works with orientationChange > + > +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". > + > + > + > + > + > +PASS successfullyParsed is true > + > +TEST COMPLETE This is rather blank. There is no PASS / FAIL message in the common case. > LayoutTests/fast/dom/DeviceOrientation/script-tests/create-event-onorientationchange.js:15 > +try { > + var event = document.createEvent("OrientationEvent"); > + event.initEvent("orientationchange", false, false); > + window.dispatchEvent(event); > +} catch(e) { > +} I would suggest outputting something in the catch { ... } along the lines of "Orientation Events don't appear to be enabled or implemented". I don't know the best way to reduce the overhead of submitting a test which will only pass behind an ENABLE flag.
Yongjun Zhang
Comment 6 2010-10-18 09:37:39 PDT
(In reply to comment #5) > (From update of attachment 70874 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=70874&action=review > > > LayoutTests/fast/dom/DeviceOrientation/create-event-onorientationchange-expected.txt:11 > > +Tests that document.createEvent() works with orientationChange > > + > > +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". > > + > > + > > + > > + > > + > > +PASS successfullyParsed is true > > + > > +TEST COMPLETE > > This is rather blank. There is no PASS / FAIL message in the common case. > > > LayoutTests/fast/dom/DeviceOrientation/script-tests/create-event-onorientationchange.js:15 > > +try { > > + var event = document.createEvent("OrientationEvent"); > > + event.initEvent("orientationchange", false, false); > > + window.dispatchEvent(event); > > +} catch(e) { > > +} > > I would suggest outputting something in the catch { ... } along the lines of > "Orientation Events don't appear to be enabled or implemented". > > I don't know the best way to reduce the overhead of submitting a test which > will only pass behind an ENABLE flag. thanks for the comments. Folder fast/dom/DeviceOrientation/ is skipped for most ports, and for those ports (Android?) that enabled device orientation events but not onorientationchange, this test will fail by default, hence the failed result as expected result. The port need to override the expected result if onorientationchange is implemented.
Yongjun Zhang
Comment 7 2010-10-18 10:14:59 PDT
Created attachment 71051 [details] Address Joe's comment.
WebKit Commit Bot
Comment 8 2010-10-18 12:34:17 PDT
Comment on attachment 71051 [details] Address Joe's comment. Clearing flags on attachment: 71051 Committed r69984: <http://trac.webkit.org/changeset/69984>
WebKit Commit Bot
Comment 9 2010-10-18 12:34:23 PDT
All reviewed patches have been landed. Closing bug.
Steve Block
Comment 10 2010-10-25 08:11:12 PDT
I'm not sure why you've added this test to fast/dom/DeviceOrientation. This LayoutTest directory is to test the implementation of the W3C DeviceOrientationEvent (http://dev.w3.org/geo/api/spec-source-orientation.html, https://bugs.webkit.org/show_bug.cgi?id=30335). Your change seems to be concerned with the OrientationEvent, which is completely separate. Furthermore, as you point out, ports that don't implement DeviceOrientation skip this entire directory of tests. Those that do implement it should pass all tests. So an expected result which represents failure is probably not appropriate. Perhaps you could move the test to a more appropriate location?
Yongjun Zhang
Comment 11 2010-10-25 09:32:40 PDT
(In reply to comment #10) > I'm not sure why you've added this test to fast/dom/DeviceOrientation. This LayoutTest directory is to test the implementation of the W3C DeviceOrientationEvent (http://dev.w3.org/geo/api/spec-source-orientation.html, https://bugs.webkit.org/show_bug.cgi?id=30335). > > Your change seems to be concerned with the OrientationEvent, which is completely separate. > Thanks for the comments, there are indeed different events. I will move this test to a different location. > Furthermore, as you point out, ports that don't implement DeviceOrientation skip this entire directory of tests. Those that do implement it should pass all tests. So an expected result which represents failure is probably not appropriate. > I can add it to skipped tests for each port to get rid of the expected failure result. Thanks.
Steve Block
Comment 12 2010-11-30 02:39:13 PST
> Thanks for the comments, there are indeed different events. I will move this > test to a different location. Please move this test, or let me know where it should be moved to, else I think we should remove it.
Laszlo Gombos
Comment 13 2010-11-30 05:07:43 PST
Perhaps LayoutTests/fast/dom/Orientation ?
Chang Shu
Comment 14 2010-11-30 06:58:28 PST
Created attachment 75142 [details] fix patch move test case
Laszlo Gombos
Comment 15 2010-11-30 09:10:25 PST
Comment on attachment 75142 [details] fix patch LGTM, r+. Thanks.
WebKit Commit Bot
Comment 16 2010-11-30 20:03:39 PST
Comment on attachment 75142 [details] fix patch Rejecting patch 75142 from commit-queue. Failed to run "['./WebKitTools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '--bot-id=eseidel-cq-sl', 'build', '--no-clean', '--no-update', '--build-style=both']" exit_code: 1 ERROR: Working directory has local commits, pass --force-clean to continue. Full output: http://queues.webkit.org/results/6512003
Chang Shu
Comment 17 2010-12-01 07:36:55 PST
Comment on attachment 75142 [details] fix patch cleanup flags after manual commit r73019 http://trac.webkit.org/changeset/73019
Steve Block
Comment 18 2010-12-01 08:25:48 PST
Thanks!
Note You need to log in before you can comment on or make changes to this bug.