mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix: supress viewport errors for pages that do not support changing it (#11970)
This commit is contained in:
parent
5bbee1068f
commit
753a954456
@ -267,12 +267,22 @@ export class EmulationManager {
|
|||||||
const hasTouch = viewport.hasTouch || false;
|
const hasTouch = viewport.hasTouch || false;
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
client.send('Emulation.setDeviceMetricsOverride', {
|
client
|
||||||
|
.send('Emulation.setDeviceMetricsOverride', {
|
||||||
mobile,
|
mobile,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
deviceScaleFactor,
|
deviceScaleFactor,
|
||||||
screenOrientation,
|
screenOrientation,
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
if (
|
||||||
|
err.message.includes('Target does not support metrics override')
|
||||||
|
) {
|
||||||
|
debugError(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw err;
|
||||||
}),
|
}),
|
||||||
client.send('Emulation.setTouchEmulationEnabled', {
|
client.send('Emulation.setTouchEmulationEnabled', {
|
||||||
enabled: hasTouch,
|
enabled: hasTouch,
|
||||||
|
Loading…
Reference in New Issue
Block a user