@@ -94,6 +94,7 @@ export class FFBrowser extends platform.EventEmitter implements Browser {
94
94
bypassCSP : options . bypassCSP ,
95
95
javaScriptDisabled : options . javaScriptEnabled === false ? true : undefined ,
96
96
viewport,
97
+ locale : options . locale ,
97
98
removeOnDetach : true
98
99
} ) ;
99
100
// TODO: move ignoreHTTPSErrors to browser context level.
@@ -174,6 +175,8 @@ export class FFBrowserContext extends BrowserContextBase {
174
175
await this . setOffline ( this . _options . offline ) ;
175
176
if ( this . _options . httpCredentials )
176
177
await this . setHTTPCredentials ( this . _options . httpCredentials ) ;
178
+ if ( this . _options . geolocation )
179
+ await this . setGeolocation ( this . _options . geolocation ) ;
177
180
}
178
181
179
182
_ffPages ( ) : FFPage [ ] {
@@ -249,8 +252,7 @@ export class FFBrowserContext extends BrowserContextBase {
249
252
if ( geolocation )
250
253
geolocation = verifyGeolocation ( geolocation ) ;
251
254
this . _options . geolocation = geolocation || undefined ;
252
- for ( const page of this . pages ( ) )
253
- await ( page . _delegate as FFPage ) . _setGeolocation ( geolocation ) ;
255
+ await this . _browser . _connection . send ( 'Browser.setGeolocationOverride' , { browserContextId : this . _browserContextId || undefined , geolocation } ) ;
254
256
}
255
257
256
258
async setExtraHTTPHeaders ( headers : network . Headers ) : Promise < void > {
@@ -292,8 +294,8 @@ export class FFBrowserContext extends BrowserContextBase {
292
294
293
295
async route ( url : types . URLMatch , handler : network . RouteHandler ) : Promise < void > {
294
296
this . _routes . push ( { url, handler } ) ;
295
- throw new Error ( 'Not implemented' ) ;
296
- // TODO: update interception on the context if this is a first route.
297
+ if ( this . _routes . length === 1 )
298
+ await this . _browser . _connection . send ( 'Browser.setRequestInterception' , { browserContextId : this . _browserContextId || undefined , enabled : true } ) ;
297
299
}
298
300
299
301
async close ( ) {
0 commit comments