mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: add const
to UserContext.DEFAULT (#11846)
This commit is contained in:
parent
799058cc7b
commit
b63ebc721d
@ -28,7 +28,7 @@ import {BrowsingContext, BrowsingContextEvent} from './BrowsingContext.js';
|
|||||||
import type {BidiConnection} from './Connection.js';
|
import type {BidiConnection} from './Connection.js';
|
||||||
import type {Browser as BrowserCore} from './core/Browser.js';
|
import type {Browser as BrowserCore} from './core/Browser.js';
|
||||||
import {Session} from './core/Session.js';
|
import {Session} from './core/Session.js';
|
||||||
import type {UserContext} from './core/UserContext.js';
|
import {UserContext} from './core/UserContext.js';
|
||||||
import {
|
import {
|
||||||
BiDiBrowserTarget,
|
BiDiBrowserTarget,
|
||||||
BiDiBrowsingContextTarget,
|
BiDiBrowsingContextTarget,
|
||||||
@ -181,7 +181,7 @@ export class BidiBrowser extends Browser {
|
|||||||
);
|
);
|
||||||
this.connection.registerBrowsingContexts(context);
|
this.connection.registerBrowsingContexts(context);
|
||||||
const browserContext =
|
const browserContext =
|
||||||
event.userContext === 'default'
|
event.userContext === UserContext.DEFAULT
|
||||||
? this.defaultBrowserContext()
|
? this.defaultBrowserContext()
|
||||||
: this.browserContexts().find(browserContext => {
|
: this.browserContexts().find(browserContext => {
|
||||||
return browserContext.id === event.userContext;
|
return browserContext.id === event.userContext;
|
||||||
|
@ -135,7 +135,7 @@ export class BidiBrowserContext extends BrowserContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override get id(): string | undefined {
|
override get id(): string | undefined {
|
||||||
if (this.#userContext.id === 'default') {
|
if (this.#userContext.id === UserContext.DEFAULT) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return this.#userContext.id;
|
return this.#userContext.id;
|
||||||
|
@ -43,7 +43,7 @@ export class UserContext extends EventEmitter<{
|
|||||||
reason: string;
|
reason: string;
|
||||||
};
|
};
|
||||||
}> {
|
}> {
|
||||||
static DEFAULT = 'default';
|
static DEFAULT = 'default' as const;
|
||||||
|
|
||||||
static create(browser: Browser, id: string): UserContext {
|
static create(browser: Browser, id: string): UserContext {
|
||||||
const context = new UserContext(browser, id);
|
const context = new UserContext(browser, id);
|
||||||
|
Loading…
Reference in New Issue
Block a user