This getContentSize API is rather hairy: * Web extension popups use getContentSize to measure the document in https://searchfox.org/mozilla-central/rev/fcf53e1685bfb990b5abc7312ac1daf617f0991f/toolkit/components/extensions/ext-browser-content.js#253 * That leaves the returned size as the layout viewport (so innerHeight and innerWidth are the "right" size): https://searchfox.org/mozilla-central/rev/fcf53e1685bfb990b5abc7312ac1daf617f0991f/layout/base/nsDocumentViewer.cpp#2634 * However the visual viewport is not updated, and that's what we scroll into view into. That's only updated way later, via: ``` MobileViewportManager::RefreshViewportSize in nsDocumentViewer::SetBoundsWithFlags in nsDocShell::SetPositionAndSize in nsWebBrowser::SetPositionAndSize in mozilla::dom::BrowserChild::RecvUpdateDimensions in mozilla::dom::PBrowserChild::OnMessageReceived [snip] ``` Make sure we leave the layout and visual viewport in a consistent state. Differential Revision: https://phabricator.services.mozilla.com/D228119