mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 15:25:52 +00:00
81a88a63e8
The existing tests didn't catch this problem, because calling scrollTo(), which is both what a) the session store and session history itself are currently using to set the scroll position to be restored, as well as b) how the existing session store test is setting the page up to be scrolled ready for testing forces both the layout and visual viewport positions to the respective coordinates, even if the same configuration of visual and layout viewport offsets could never be achieved through manual scrolling (i.e. bug 1516056). This then triggers all the expected events and makes it so that reading the scroll position through the layout viewport returns the expected values, which is why the existing tests never noticed that something is off. Therefore, we introduce a test here that has a page where the layout viewport can never scroll (at least horizontally) and where we simulate scrolling by actually inputting fake touch events instead of simply calling scrollTo(). This will result in only the visual viewport scrolling, ensuring that we can properly test the new expected behaviour of the session store and session history. Because layout and visual viewport scroll positions aren't necessarily updated at exactly the same time and the session store is currently still relying on the conventional "scroll" events (relating to the layout viewport), which means the tests have to rely on the same events, too, we don't yet switch all session store tests to generally verify the current scroll position of the page using the visual viewport, and temporarily make this only opt-in via the corresponding helper function in head_scroll.js. I know that the proper way to reference "foreign" files in text manifests is to use !/absolute/path/to/file/helper.js, but as one of the files originally comes from a chrome mochitest and the other one (apz_test_utils.js) doesn't and this test itself is a chrome mochitest, this was the best way I found to get both files copied into the correct directory on the test device so the test could access them. Differential Revision: https://phabricator.services.mozilla.com/D15685 --HG-- extra : moz-landing-system : lando |
||
---|---|---|
.. | ||
android | ||
locales |