fix: supress viewport errors for pages that do not support changing it (#11970)

This commit is contained in:
Alex Rudenko 2024-02-22 13:10:59 +01:00 committed by GitHub
parent 5bbee1068f
commit 753a954456
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -267,13 +267,23 @@ export class EmulationManager {
const hasTouch = viewport.hasTouch || false;
await Promise.all([
client.send('Emulation.setDeviceMetricsOverride', {
mobile,
width,
height,
deviceScaleFactor,
screenOrientation,
}),
client
.send('Emulation.setDeviceMetricsOverride', {
mobile,
width,
height,
deviceScaleFactor,
screenOrientation,
})
.catch(err => {
if (
err.message.includes('Target does not support metrics override')
) {
debugError(err);
return;
}
throw err;
}),
client.send('Emulation.setTouchEmulationEnabled', {
enabled: hasTouch,
}),