responsive design mode does not simulate orientationchange event
Categories
(DevTools :: Responsive Design Mode, enhancement, P1)
Tracking
(firefox68 verified, firefox69 verified)
People
(Reporter: baptx.is, Assigned: mtigley)
References
(Blocks 1 open bug)
Details
(Whiteboard: [rdm-mvp] [qa-68b-p2])
Attachments
(2 files)
Comment 2•6 years ago
|
||
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Comment 3•6 years ago
•
|
||
Since the "orientationchange" event seems to be only for mobile devices (i.e: see here ), we will have to simulate this same event on the content window whenever the viewport is rotated via the RDM UI. To do this I believe we can fake this by having RDM's emulation actor's target window dispatch a custom "orientationchange" event when the toolbar's rotate button is clicked. So:
So, the first step is to modify the Emulation actor with the following:
- Add a new method on the emulation actor called
rotateViewport
. This will be used by the ResponsiveUIManager to communicate to the server that the viewport has been rotated so dispatch the custom "orientationchange" event.
Next we wire up the client to have the rotate button tell the ResponsiveUIManager the user has pressed:
- The rotate button dispatches a
ROTATE_VIEWPORT
action when pressed. In this same action we can usepostMessage
to communicate with the ResponsiveUIManager. - In ResponsiveUIManager's handleMessage, add a case for the rotate viewport message where we handle calling the emulation front's
rotateViewport
method.
Once the server receives the rotateViewport
message from the client, a custom event called "orientationchange" will be dispatched to be received by the target window.
Assignee | ||
Comment 4•6 years ago
•
|
||
Note that the above does not update window.screen.orientation
's value. This will be fixed in Bug 1357774.
Assignee | ||
Comment 5•6 years ago
|
||
Assignee | ||
Comment 6•6 years ago
|
||
Comment 8•6 years ago
|
||
Backed out changeset 20874bfade8e (bug 1509255) for xpcshell failures at devtools/client/responsive.html/test/unit/test_rotate_viewport.js
Backout: https://hg.mozilla.org/integration/autoland/rev/8f500d15db58b1c794f029c56b30af26bca317fe
Failure push: https://treeherder.mozilla.org/#/jobs?repo=autoland&selectedJob=244497253&revision=20874bfade8ee324a3d4b1c54501a690e8d34a6b
Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=244497253&repo=autoland&lineNumber=2144
[task 2019-05-03T14:57:31.514Z] 14:57:31 INFO - TEST-START | devtools/client/responsive.html/test/unit/test_rotate_viewport.js
[task 2019-05-03T14:57:32.073Z] 14:57:32 WARNING - TEST-UNEXPECTED-FAIL | devtools/client/responsive.html/test/unit/test_rotate_viewport.js | xpcshell return code: 0
[task 2019-05-03T14:57:32.073Z] 14:57:32 INFO - TEST-INFO took 559ms
[task 2019-05-03T14:57:32.074Z] 14:57:32 INFO - >>>>>>>
[task 2019-05-03T14:57:32.075Z] 14:57:32 INFO - PID 11523 | JavaScript strict warning: resource://devtools/shared/Loader.jsm, line 231: ReferenceError: reference to undefined property "name"
[task 2019-05-03T14:57:32.076Z] 14:57:32 INFO - (xpcshell/head.js) | test MAIN run_test pending (1)
[task 2019-05-03T14:57:32.077Z] 14:57:32 INFO - (xpcshell/head.js) | test run_next_test 0 pending (2)
[task 2019-05-03T14:57:32.077Z] 14:57:32 INFO - (xpcshell/head.js) | test MAIN run_test finished (2)
[task 2019-05-03T14:57:32.078Z] 14:57:32 INFO - running event loop
[task 2019-05-03T14:57:32.080Z] 14:57:32 INFO - "CONSOLE_MESSAGE: (warn) [JavaScript Warning: "ReferenceError: reference to undefined property "name"" {file: "resource://devtools/shared/Loader.jsm" line: 231}]"
[task 2019-05-03T14:57:32.085Z] 14:57:32 INFO - devtools/client/responsive.html/test/unit/test_rotate_viewport.js | Starting
[task 2019-05-03T14:57:32.085Z] 14:57:32 INFO - (xpcshell/head.js) | test pending (2)
[task 2019-05-03T14:57:32.087Z] 14:57:32 INFO - PID 11523 | console.log: "[DISPATCH] action type:" "ADD_VIEWPORT"
[task 2019-05-03T14:57:32.088Z] 14:57:32 INFO - TEST-PASS | devtools/client/responsive.html/test/unit/test_rotate_viewport.js | - Default width of 320 - 320 == 320
[task 2019-05-03T14:57:32.089Z] 14:57:32 INFO - TEST-PASS | devtools/client/responsive.html/test/unit/test_rotate_viewport.js | - Default height of 480 - 480 == 480
[task 2019-05-03T14:57:32.089Z] 14:57:32 INFO - (xpcshell/head.js) | test run_next_test 0 finished (2)
[task 2019-05-03T14:57:32.090Z] 14:57:32 INFO - Unexpected exception ReferenceError: window is not defined at resource://devtools/client/responsive.html/actions/viewports.js:99
[task 2019-05-03T14:57:32.090Z] 14:57:32 INFO - rotateViewport@resource://devtools/client/responsive.html/actions/viewports.js:99:5
[task 2019-05-03T14:57:32.091Z] 14:57:32 INFO - @/builds/worker/workspace/build/tests/xpcshell/tests/devtools/client/responsive.html/test/unit/test_rotate_viewport.js:21:12
[task 2019-05-03T14:57:32.092Z] 14:57:32 INFO - run_next_test/_run_next_test/<@/builds/worker/workspace/build/tests/xpcshell/head.js:1437:22
[task 2019-05-03T14:57:32.092Z] 14:57:32 INFO - _run_next_test@/builds/worker/workspace/build/tests/xpcshell/head.js:1437:38
[task 2019-05-03T14:57:32.093Z] 14:57:32 INFO - run@/builds/worker/workspace/build/tests/xpcshell/head.js:688:9
[task 2019-05-03T14:57:32.094Z] 14:57:32 INFO - _do_main@/builds/worker/workspace/build/tests/xpcshell/head.js:227:6
[task 2019-05-03T14:57:32.095Z] 14:57:32 INFO - _execute_test@/builds/worker/workspace/build/tests/xpcshell/head.js:529:5
[task 2019-05-03T14:57:32.095Z] 14:57:32 INFO - @-e:1:1
[task 2019-05-03T14:57:32.096Z] 14:57:32 INFO - exiting test
[task 2019-05-03T14:57:32.097Z] 14:57:32 INFO - <<<<<<<
Comment 10•6 years ago
|
||
bugherder |
Assignee | ||
Updated•6 years ago
|
Updated•6 years ago
|
Comment 11•6 years ago
|
||
Hi Guys, I was testing this issue using this link : https://bug1509255.bmoattachments.org/attachment.cgi?id=9026900
and for the Vertical alignment I'm getting 0 for the orientation of the device but when using landscape instead of 90, i'm getting 270 and I'm not sure its correct.
Can you please let me know if this is ok or is there another issue logged for it ?
Assignee | ||
Comment 12•6 years ago
|
||
Hi, yes it should be 90 instead of 270. I filed an issue for this at: Bug 1554695
Assignee | ||
Comment 13•6 years ago
|
||
I found that refreshing the page using https://bug1509255.bmoattachments.org/attachment.cgi?id=9026900 will also trigger an orientationchange
event, which shouldn't happen. I filed the appropriate bug at: Bug 1556533
Comment 14•6 years ago
|
||
This issue is verified as fixed in our nightly 69.0a1 (2019-06-03).
Description
•