Since the "orientationchange" event seems to be only for mobile devices (i.e: see [here](https://searchfox.org/mozilla-central/source/dom/base/nsGlobalWindowInner.cpp#5810) ), 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 listen for a custom "orientationchange" event that can be dispatched when the toolbar's rotate button is clicked. So: So, the first step is to modify the Emulation actor with the following: - add an event listener called "orientationchange". - 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 use `postMessage` to communicate with the ResponsiveUIManager. - In ResponsiveUIManager's [handleMessage](https://searchfox.org/mozilla-central/source/devtools/client/responsive.html/manager.js#521), 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.
Bug 1509255 Comment 3 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Since the "orientationchange" event seems to be only for mobile devices (i.e: see [here](https://searchfox.org/mozilla-central/source/dom/base/nsGlobalWindowInner.cpp#5810) ), 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 use `postMessage` to communicate with the ResponsiveUIManager. - In ResponsiveUIManager's [handleMessage](https://searchfox.org/mozilla-central/source/devtools/client/responsive.html/manager.js#521), 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.