@@ -145,7 +145,9 @@ export class CRPage implements PageDelegate {
145
145
if ( options . ignoreHTTPSErrors )
146
146
promises . push ( this . _client . send ( 'Security.setIgnoreCertificateErrors' , { ignore : true } ) ) ;
147
147
if ( options . viewport )
148
- promises . push ( this . _updateViewport ( true /* updateTouch */ ) ) ;
148
+ promises . push ( this . _updateViewport ( ) ) ;
149
+ if ( options . hasTouch )
150
+ promises . push ( this . _client . send ( 'Emulation.setTouchEmulationEnabled' , { enabled : true } ) ) ;
149
151
if ( options . javaScriptEnabled === false )
150
152
promises . push ( this . _client . send ( 'Emulation.setScriptExecutionDisabled' , { value : true } ) ) ;
151
153
if ( options . userAgent || options . locale )
@@ -378,10 +380,10 @@ export class CRPage implements PageDelegate {
378
380
379
381
async setViewportSize ( viewportSize : types . Size ) : Promise < void > {
380
382
assert ( this . _page . _state . viewportSize === viewportSize ) ;
381
- await this . _updateViewport ( false /* updateTouch */ ) ;
383
+ await this . _updateViewport ( ) ;
382
384
}
383
385
384
- async _updateViewport ( updateTouch : boolean ) : Promise < void > {
386
+ async _updateViewport ( ) : Promise < void > {
385
387
const options = this . _browserContext . _options ;
386
388
let viewport = options . viewport || { width : 0 , height : 0 } ;
387
389
const viewportSize = this . _page . _state . viewportSize ;
@@ -399,8 +401,6 @@ export class CRPage implements PageDelegate {
399
401
screenOrientation : isLandscape ? { angle : 90 , type : 'landscapePrimary' } : { angle : 0 , type : 'portraitPrimary' } ,
400
402
} ) ,
401
403
] ;
402
- if ( updateTouch )
403
- promises . push ( this . _client . send ( 'Emulation.setTouchEmulationEnabled' , { enabled : ! ! options . hasTouch } ) ) ;
404
404
await Promise . all ( promises ) ;
405
405
}
406
406
0 commit comments