1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-07 03:12:33 +01:00

Wait a bit longer before testing viewport width

This commit is contained in:
Raymond Hill 2020-05-07 15:42:30 -04:00
parent 2d960cf530
commit b226873bdb
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -1157,6 +1157,12 @@ const getPopupData = async function(tabId) {
});
};
const nextFrames = async n => {
for ( let i = 0; i < n; i++ ) {
await nextFrame();
}
};
// The purpose of the following code is to reset to a vertical layout
// should the viewport not be enough wide to accomodate the horizontal
// layout.
@ -1171,7 +1177,7 @@ const getPopupData = async function(tabId) {
const checkViewport = async function() {
void document.body.offsetWidth;
await nextFrame();
await nextFrames(4);
const root = document.querySelector(':root');
if ( root.classList.contains('desktop') ) {