chore: mark public methods on server as such (#13271)

This commit is contained in:
Pavel Feldman 2022-04-02 18:02:27 -08:00 committed by GitHub
parent 5d2e8918d8
commit bcb12fcf7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 86 additions and 88 deletions

View File

@ -166,15 +166,15 @@ export class BrowserContextDispatcher extends Dispatcher<BrowserContext, channel
}
async addInitScript(params: channels.BrowserContextAddInitScriptParams): Promise<void> {
await this._context._doAddInitScript(params.source);
await this._context.addInitScript(params.source);
}
async setNetworkInterceptionEnabled(params: channels.BrowserContextSetNetworkInterceptionEnabledParams): Promise<void> {
if (!params.enabled) {
await this._context._setRequestInterceptor(undefined);
await this._context.setRequestInterceptor(undefined);
return;
}
await this._context._setRequestInterceptor((route, request) => {
await this._context.setRequestInterceptor((route, request) => {
this._dispatchEvent('route', { route: RouteDispatcher.from(this._scope, route), request: RequestDispatcher.from(this._scope, request) });
});
}

View File

@ -91,7 +91,7 @@ export class ConnectedBrowserDispatcher extends Dispatcher<Browser, channels.Bro
params.recordVideo.dir = this._object.options.artifactsDir;
const context = await this._object.newContext(metadata, params);
this._contexts.add(context);
context._setSelectors(this.selectors);
context.setSelectors(this.selectors);
context.on(BrowserContext.Events.Close, () => this._contexts.delete(context));
return { context: new BrowserContextDispatcher(this._scope, context) };
}

View File

@ -137,15 +137,15 @@ export class PageDispatcher extends Dispatcher<Page, channels.PageChannel> imple
}
async addInitScript(params: channels.PageAddInitScriptParams, metadata: CallMetadata): Promise<void> {
await this._page._addInitScriptExpression(params.source);
await this._page.addInitScript(params.source);
}
async setNetworkInterceptionEnabled(params: channels.PageSetNetworkInterceptionEnabledParams, metadata: CallMetadata): Promise<void> {
if (!params.enabled) {
await this._page._setClientRequestInterceptor(undefined);
await this._page.setClientRequestInterceptor(undefined);
return;
}
await this._page._setClientRequestInterceptor((route, request) => {
await this._page.setClientRequestInterceptor((route, request) => {
this._dispatchEvent('route', { route: RouteDispatcher.from(this._scope, route), request: RequestDispatcher.from(this._scope, request) });
});
}
@ -191,7 +191,7 @@ export class PageDispatcher extends Dispatcher<Page, channels.PageChannel> imple
}
async setFileChooserInterceptedNoReply(params: channels.PageSetFileChooserInterceptedNoReplyParams, metadata: CallMetadata): Promise<void> {
await this._page._setFileChooserIntercepted(params.intercepted);
await this._page.setFileChooserIntercepted(params.intercepted);
}
async keyboardDown(params: channels.PageKeyboardDownParams, metadata: CallMetadata): Promise<void> {

View File

@ -69,6 +69,7 @@ export abstract class BrowserContext extends SdkObject {
private _customCloseHandler?: () => Promise<any>;
readonly _tempDirs: string[] = [];
private _settingStorageState = false;
readonly initScripts: string[] = [];
constructor(browser: Browser, options: types.BrowserContextOptions, browserContextId: string | undefined) {
super(browser, 'browser-context');
@ -91,7 +92,7 @@ export abstract class BrowserContext extends SdkObject {
return this._isPersistentContext;
}
_setSelectors(selectors: Selectors) {
setSelectors(selectors: Selectors) {
this._selectors = selectors;
}
@ -143,7 +144,7 @@ export abstract class BrowserContext extends SdkObject {
this._downloads.clear();
this.tracing.dispose();
if (this._isPersistentContext)
this._onClosePersistent();
this.onClosePersistent();
this._closePromiseFulfill!(new Error('Context closed'));
this.emit(BrowserContext.Events.Close);
}
@ -151,30 +152,30 @@ export abstract class BrowserContext extends SdkObject {
// BrowserContext methods.
abstract pages(): Page[];
abstract newPageDelegate(): Promise<PageDelegate>;
abstract _doCookies(urls: string[]): Promise<types.NetworkCookie[]>;
abstract addCookies(cookies: types.SetNetworkCookieParam[]): Promise<void>;
abstract clearCookies(): Promise<void>;
abstract _doGrantPermissions(origin: string, permissions: string[]): Promise<void>;
abstract _doClearPermissions(): Promise<void>;
abstract setGeolocation(geolocation?: types.Geolocation): Promise<void>;
abstract _doSetHTTPCredentials(httpCredentials?: types.Credentials): Promise<void>;
abstract setExtraHTTPHeaders(headers: types.HeadersArray): Promise<void>;
abstract setOffline(offline: boolean): Promise<void>;
abstract _doAddInitScript(expression: string): Promise<void>;
abstract _doExposeBinding(binding: PageBinding): Promise<void>;
abstract _doUpdateRequestInterception(): Promise<void>;
abstract _doClose(): Promise<void>;
abstract _onClosePersistent(): void;
abstract _doCancelDownload(uuid: string): Promise<void>;
abstract cancelDownload(uuid: string): Promise<void>;
protected abstract doGetCookies(urls: string[]): Promise<types.NetworkCookie[]>;
protected abstract doGrantPermissions(origin: string, permissions: string[]): Promise<void>;
protected abstract doClearPermissions(): Promise<void>;
protected abstract doSetHTTPCredentials(httpCredentials?: types.Credentials): Promise<void>;
protected abstract doAddInitScript(expression: string): Promise<void>;
protected abstract doExposeBinding(binding: PageBinding): Promise<void>;
protected abstract doUpdateRequestInterception(): Promise<void>;
protected abstract doClose(): Promise<void>;
protected abstract onClosePersistent(): void;
async cookies(urls: string | string[] | undefined = []): Promise<types.NetworkCookie[]> {
if (urls && !Array.isArray(urls))
urls = [ urls ];
return await this._doCookies(urls as string[]);
return await this.doGetCookies(urls as string[]);
}
setHTTPCredentials(httpCredentials?: types.Credentials): Promise<void> {
return this._doSetHTTPCredentials(httpCredentials);
return this.doSetHTTPCredentials(httpCredentials);
}
async exposeBinding(name: string, needsHandle: boolean, playwrightBinding: frames.FunctionWithSource): Promise<void> {
@ -186,7 +187,7 @@ export abstract class BrowserContext extends SdkObject {
}
const binding = new PageBinding(name, playwrightBinding, needsHandle);
this._pageBindings.set(name, binding);
await this._doExposeBinding(binding);
await this.doExposeBinding(binding);
}
async grantPermissions(permissions: string[], origin?: string) {
@ -199,12 +200,12 @@ export abstract class BrowserContext extends SdkObject {
permissions.forEach(p => existing.add(p));
const list = [...existing.values()];
this._permissions.set(resolvedOrigin, list);
await this._doGrantPermissions(resolvedOrigin, list);
await this.doGrantPermissions(resolvedOrigin, list);
}
async clearPermissions() {
this._permissions.clear();
await this._doClearPermissions();
await this.doClearPermissions();
}
setDefaultNavigationTimeout(timeout: number | undefined) {
@ -264,9 +265,14 @@ export abstract class BrowserContext extends SdkObject {
this._options.httpCredentials = { username, password: password || '' };
}
async _setRequestInterceptor(handler: network.RouteHandler | undefined): Promise<void> {
async addInitScript(script: string) {
this.initScripts.push(script);
await this.doAddInitScript(script);
}
async setRequestInterceptor(handler: network.RouteHandler | undefined): Promise<void> {
this._requestInterceptor = handler;
await this._doUpdateRequestInterception();
await this.doUpdateRequestInterception();
}
isClosingOrClosed() {
@ -309,7 +315,7 @@ export abstract class BrowserContext extends SdkObject {
await Promise.all(this.pages().map(page => page.close(metadata)));
} else {
// Close the context.
await this._doClose();
await this.doClose();
}
// We delete downloads after context closure

View File

@ -323,11 +323,9 @@ export class CRBrowserContext extends BrowserContext {
};
declare readonly _browser: CRBrowser;
readonly _evaluateOnNewDocumentSources: string[];
constructor(browser: CRBrowser, browserContextId: string | undefined, options: types.BrowserContextOptions) {
super(browser, options, browserContextId);
this._evaluateOnNewDocumentSources = [];
this._authenticateProxyViaCredentials();
}
@ -382,7 +380,7 @@ export class CRBrowserContext extends BrowserContext {
return this._browser._crPages.get(targetId)!;
}
async _doCookies(urls: string[]): Promise<types.NetworkCookie[]> {
async doGetCookies(urls: string[]): Promise<types.NetworkCookie[]> {
const { cookies } = await this._browser._session.send('Storage.getCookies', { browserContextId: this._browserContextId });
return network.filterCookies(cookies.map(c => {
const copy: any = { sameSite: 'Lax', ...c };
@ -404,7 +402,7 @@ export class CRBrowserContext extends BrowserContext {
await this._browser._session.send('Storage.clearCookies', { browserContextId: this._browserContextId });
}
async _doGrantPermissions(origin: string, permissions: string[]) {
async doGrantPermissions(origin: string, permissions: string[]) {
const webPermissionToProtocol = new Map<string, Protocol.Browser.PermissionType>([
['geolocation', 'geolocation'],
['midi', 'midi'],
@ -432,7 +430,7 @@ export class CRBrowserContext extends BrowserContext {
await this._browser._session.send('Browser.grantPermissions', { origin: origin === '*' ? undefined : origin, browserContextId: this._browserContextId, permissions: filtered });
}
async _doClearPermissions() {
async doClearPermissions() {
await this._browser._session.send('Browser.resetPermissions', { browserContextId: this._browserContextId });
}
@ -455,29 +453,28 @@ export class CRBrowserContext extends BrowserContext {
await (page._delegate as CRPage).updateOffline();
}
async _doSetHTTPCredentials(httpCredentials?: types.Credentials): Promise<void> {
async doSetHTTPCredentials(httpCredentials?: types.Credentials): Promise<void> {
this._options.httpCredentials = httpCredentials;
for (const page of this.pages())
await (page._delegate as CRPage).updateHttpCredentials();
}
async _doAddInitScript(source: string) {
this._evaluateOnNewDocumentSources.push(source);
async doAddInitScript(source: string) {
for (const page of this.pages())
await (page._delegate as CRPage).evaluateOnNewDocument(source);
await (page._delegate as CRPage).addInitScript(source);
}
async _doExposeBinding(binding: PageBinding) {
async doExposeBinding(binding: PageBinding) {
for (const page of this.pages())
await (page._delegate as CRPage).exposeBinding(binding);
}
async _doUpdateRequestInterception(): Promise<void> {
async doUpdateRequestInterception(): Promise<void> {
for (const page of this.pages())
await (page._delegate as CRPage).updateRequestInterception();
}
async _doClose() {
async doClose() {
assert(this._browserContextId);
// Headful chrome cannot dispose browser context with opened 'beforeunload'
// dialogs, so we should close all that are currently opened.
@ -505,7 +502,7 @@ export class CRBrowserContext extends BrowserContext {
}
}
_onClosePersistent() {
onClosePersistent() {
// When persistent context is closed, we do not necessary get Target.detachedFromTarget
// for all the background pages.
for (const [targetId, backgroundPage] of this._browser._backgroundPages.entries()) {
@ -516,7 +513,7 @@ export class CRBrowserContext extends BrowserContext {
}
}
async _doCancelDownload(guid: string) {
async cancelDownload(guid: string) {
// The upstream CDP method is implemented in a way that no explicit error would be given
// regarding the requested `guid`, even if the download is in a state not suitable for
// cancellation (finished, cancelled, etc.) or the guid is invalid at all.

View File

@ -213,7 +213,7 @@ export class CRPage implements PageDelegate {
}
async setFileChooserIntercepted(enabled: boolean) {
await this._forAllFrameSessions(frame => frame._setFileChooserIntercepted(enabled));
await this._forAllFrameSessions(frame => frame.setFileChooserIntercepted(enabled));
}
async reload(): Promise<void> {
@ -237,7 +237,7 @@ export class CRPage implements PageDelegate {
return this._go(+1);
}
async evaluateOnNewDocument(source: string, world: types.World = 'main'): Promise<void> {
async addInitScript(source: string, world: types.World = 'main'): Promise<void> {
await this._forAllFrameSessions(frame => frame._evaluateOnNewDocument(source, world));
}
@ -487,7 +487,7 @@ class FrameSession {
});
for (const binding of this._crPage._browserContext._pageBindings.values())
frame.evaluateExpression(binding.source, false, undefined).catch(e => {});
for (const source of this._crPage._browserContext._evaluateOnNewDocumentSources)
for (const source of this._crPage._browserContext.initScripts)
frame.evaluateExpression(source, false, undefined, 'main').catch(e => {});
}
const isInitialEmptyPage = this._isMainFrame() && this._page.mainFrame().url() === ':';
@ -543,9 +543,9 @@ class FrameSession {
promises.push(this._updateEmulateMedia(true));
for (const binding of this._crPage._page.allBindings())
promises.push(this._initBinding(binding));
for (const source of this._crPage._browserContext._evaluateOnNewDocumentSources)
for (const source of this._crPage._browserContext.initScripts)
promises.push(this._evaluateOnNewDocument(source, 'main'));
for (const source of this._crPage._page._evaluateOnNewDocumentSources)
for (const source of this._crPage._page.initScripts)
promises.push(this._evaluateOnNewDocument(source, 'main'));
if (screencastOptions)
promises.push(this._startVideoRecording(screencastOptions));
@ -1048,7 +1048,7 @@ class FrameSession {
await this._networkManager.setRequestInterception(this._page._needsRequestInterception());
}
async _setFileChooserIntercepted(enabled: boolean) {
async setFileChooserIntercepted(enabled: boolean) {
await this._client.send('Page.setInterceptFileChooserDialog', { enabled }).catch(e => {}); // target can be closed.
}

View File

@ -28,7 +28,7 @@ export class Download {
constructor(page: Page, downloadsPath: string, uuid: string, url: string, suggestedFilename?: string) {
const unaccessibleErrorMessage = !page._browserContext._options.acceptDownloads ? 'Pass { acceptDownloads: true } when you are creating your browser context.' : undefined;
this.artifact = new Artifact(page, path.join(downloadsPath, uuid), unaccessibleErrorMessage, () => {
return this._page._browserContext._doCancelDownload(uuid);
return this._page._browserContext.cancelDownload(uuid);
});
this._page = page;
this.url = url;

View File

@ -153,7 +153,6 @@ export class FFBrowser extends Browser {
export class FFBrowserContext extends BrowserContext {
declare readonly _browser: FFBrowser;
private _initScripts: string[] = [];
constructor(browser: FFBrowser, browserContextId: string | undefined, options: types.BrowserContextOptions) {
super(browser, options, browserContextId);
@ -255,7 +254,7 @@ export class FFBrowserContext extends BrowserContext {
return this._browser._ffPages.get(targetId)!;
}
async _doCookies(urls: string[]): Promise<types.NetworkCookie[]> {
async doGetCookies(urls: string[]): Promise<types.NetworkCookie[]> {
const { cookies } = await this._browser._connection.send('Browser.getCookies', { browserContextId: this._browserContextId });
return network.filterCookies(cookies.map(c => {
const copy: any = { ... c };
@ -277,7 +276,7 @@ export class FFBrowserContext extends BrowserContext {
await this._browser._connection.send('Browser.clearCookies', { browserContextId: this._browserContextId });
}
async _doGrantPermissions(origin: string, permissions: string[]) {
async doGrantPermissions(origin: string, permissions: string[]) {
const webPermissionToProtocol = new Map<string, 'geo' | 'desktop-notification' | 'persistent-storage' | 'push'>([
['geolocation', 'geo'],
['persistent-storage', 'persistent-storage'],
@ -293,7 +292,7 @@ export class FFBrowserContext extends BrowserContext {
await this._browser._connection.send('Browser.grantPermissions', { origin: origin, browserContextId: this._browserContextId, permissions: filtered });
}
async _doClearPermissions() {
async doClearPermissions() {
await this._browser._connection.send('Browser.resetPermissions', { browserContextId: this._browserContextId });
}
@ -316,33 +315,32 @@ export class FFBrowserContext extends BrowserContext {
await this._browser._connection.send('Browser.setOnlineOverride', { browserContextId: this._browserContextId, override: offline ? 'offline' : 'online' });
}
async _doSetHTTPCredentials(httpCredentials?: types.Credentials): Promise<void> {
async doSetHTTPCredentials(httpCredentials?: types.Credentials): Promise<void> {
this._options.httpCredentials = httpCredentials;
await this._browser._connection.send('Browser.setHTTPCredentials', { browserContextId: this._browserContextId, credentials: httpCredentials || null });
}
async _doAddInitScript(source: string) {
this._initScripts.push(source);
await this._browser._connection.send('Browser.setInitScripts', { browserContextId: this._browserContextId, scripts: this._initScripts.map(script => ({ script })) });
async doAddInitScript(source: string) {
await this._browser._connection.send('Browser.setInitScripts', { browserContextId: this._browserContextId, scripts: this.initScripts.map(script => ({ script })) });
}
async _doExposeBinding(binding: PageBinding) {
async doExposeBinding(binding: PageBinding) {
await this._browser._connection.send('Browser.addBinding', { browserContextId: this._browserContextId, name: binding.name, script: binding.source });
}
async _doUpdateRequestInterception(): Promise<void> {
async doUpdateRequestInterception(): Promise<void> {
await this._browser._connection.send('Browser.setRequestInterception', { browserContextId: this._browserContextId, enabled: !!this._requestInterceptor });
}
_onClosePersistent() {}
onClosePersistent() {}
async _doClose() {
async doClose() {
assert(this._browserContextId);
await this._browser._connection.send('Browser.removeBrowserContext', { browserContextId: this._browserContextId });
this._browser._contexts.delete(this._browserContextId);
}
async _doCancelDownload(uuid: string) {
async cancelDownload(uuid: string) {
await this._browser._connection.send('Browser.cancelDownload', { uuid });
}
}

View File

@ -113,7 +113,7 @@ export class FFPage implements PageDelegate {
});
// Ideally, we somehow ensure that utility world is created before Page.ready arrives, but currently it is racy.
// Therefore, we can end up with an initialized page without utility world, although very unlikely.
this.evaluateOnNewDocument('', UTILITY_WORLD_NAME).catch(e => this._markAsError(e));
this.addInitScript('', UTILITY_WORLD_NAME).catch(e => this._markAsError(e));
}
potentiallyUninitializedPage(): Page {
@ -398,7 +398,7 @@ export class FFPage implements PageDelegate {
return success;
}
async evaluateOnNewDocument(script: string, worldName?: string): Promise<void> {
async addInitScript(script: string, worldName?: string): Promise<void> {
this._initScripts.push({ script, worldName });
await this._session.send('Page.setInitScripts', { scripts: this._initScripts });
}

View File

@ -47,7 +47,7 @@ export interface PageDelegate {
goBack(): Promise<boolean>;
goForward(): Promise<boolean>;
exposeBinding(binding: PageBinding): Promise<void>;
evaluateOnNewDocument(source: string): Promise<void>;
addInitScript(source: string): Promise<void>;
closePage(runBeforeUnload: boolean): Promise<void>;
potentiallyUninitializedPage(): Page;
pageOrError(): Promise<Page | Error>;
@ -145,7 +145,7 @@ export class Page extends SdkObject {
readonly _delegate: PageDelegate;
readonly _state: PageState;
private readonly _pageBindings = new Map<string, PageBinding>();
readonly _evaluateOnNewDocumentSources: string[] = [];
readonly initScripts: string[] = [];
readonly _screenshotter: Screenshotter;
readonly _frameManager: frames.FrameManager;
readonly accessibility: accessibility.Accessibility;
@ -411,16 +411,16 @@ export class Page extends SdkObject {
await this._delegate.bringToFront();
}
async _addInitScriptExpression(source: string) {
this._evaluateOnNewDocumentSources.push(source);
await this._delegate.evaluateOnNewDocument(source);
async addInitScript(source: string) {
this.initScripts.push(source);
await this._delegate.addInitScript(source);
}
_needsRequestInterception(): boolean {
return !!this._clientRequestInterceptor || !!this._serverRequestInterceptor || !!this._browserContext._requestInterceptor;
}
async _setClientRequestInterceptor(handler: network.RouteHandler | undefined): Promise<void> {
async setClientRequestInterceptor(handler: network.RouteHandler | undefined): Promise<void> {
this._clientRequestInterceptor = handler;
await this._delegate.updateRequestInterception();
}
@ -591,7 +591,7 @@ export class Page extends SdkObject {
}
}
async _setFileChooserIntercepted(enabled: boolean): Promise<void> {
async setFileChooserIntercepted(enabled: boolean): Promise<void> {
await this._delegate.setFileChooserIntercepted(enabled);
}

View File

@ -80,7 +80,7 @@ export class Snapshotter {
];
const initScript = `(${frameSnapshotStreamer})("${this._snapshotStreamer}")`;
await this._context._doAddInitScript(initScript);
await this._context.addInitScript(initScript);
await this._runInAllFrames(initScript);
}

View File

@ -202,11 +202,9 @@ export class WKBrowser extends Browser {
export class WKBrowserContext extends BrowserContext {
declare readonly _browser: WKBrowser;
readonly _evaluateOnNewDocumentSources: string[];
constructor(browser: WKBrowser, browserContextId: string | undefined, options: types.BrowserContextOptions) {
super(browser, options, browserContextId);
this._evaluateOnNewDocumentSources = [];
this._authenticateProxyViaHeader();
}
@ -248,7 +246,7 @@ export class WKBrowserContext extends BrowserContext {
return this._browser._wkPages.get(pageProxyId)!;
}
async _doCookies(urls: string[]): Promise<types.NetworkCookie[]> {
async doGetCookies(urls: string[]): Promise<types.NetworkCookie[]> {
const { cookies } = await this._browser._browserSession.send('Playwright.getAllCookies', { browserContextId: this._browserContextId });
return network.filterCookies(cookies.map((c: types.NetworkCookie) => {
const copy: any = { ... c };
@ -271,11 +269,11 @@ export class WKBrowserContext extends BrowserContext {
await this._browser._browserSession.send('Playwright.deleteAllCookies', { browserContextId: this._browserContextId });
}
async _doGrantPermissions(origin: string, permissions: string[]) {
async doGrantPermissions(origin: string, permissions: string[]) {
await Promise.all(this.pages().map(page => (page._delegate as WKPage)._grantPermissions(origin, permissions)));
}
async _doClearPermissions() {
async doClearPermissions() {
await Promise.all(this.pages().map(page => (page._delegate as WKPage)._clearPermissions()));
}
@ -298,37 +296,36 @@ export class WKBrowserContext extends BrowserContext {
await (page._delegate as WKPage).updateOffline();
}
async _doSetHTTPCredentials(httpCredentials?: types.Credentials): Promise<void> {
async doSetHTTPCredentials(httpCredentials?: types.Credentials): Promise<void> {
this._options.httpCredentials = httpCredentials;
for (const page of this.pages())
await (page._delegate as WKPage).updateHttpCredentials();
}
async _doAddInitScript(source: string) {
this._evaluateOnNewDocumentSources.push(source);
async doAddInitScript(source: string) {
for (const page of this.pages())
await (page._delegate as WKPage)._updateBootstrapScript();
}
async _doExposeBinding(binding: PageBinding) {
async doExposeBinding(binding: PageBinding) {
for (const page of this.pages())
await (page._delegate as WKPage).exposeBinding(binding);
}
async _doUpdateRequestInterception(): Promise<void> {
async doUpdateRequestInterception(): Promise<void> {
for (const page of this.pages())
await (page._delegate as WKPage).updateRequestInterception();
}
_onClosePersistent() {}
onClosePersistent() {}
async _doClose() {
async doClose() {
assert(this._browserContextId);
await this._browser._browserSession.send('Playwright.deleteContext', { browserContextId: this._browserContextId });
this._browser._contexts.delete(this._browserContextId);
}
async _doCancelDownload(uuid: string) {
async cancelDownload(uuid: string) {
await this._browser._browserSession.send('Playwright.cancelDownload', { uuid });
}
}

View File

@ -758,7 +758,7 @@ export class WKPage implements PageDelegate {
await Promise.all(this._page.frames().map(frame => frame.evaluateExpression(script, false, {}).catch(e => {})));
}
async evaluateOnNewDocument(script: string): Promise<void> {
async addInitScript(script: string): Promise<void> {
await this._updateBootstrapScript();
}
@ -775,8 +775,8 @@ export class WKPage implements PageDelegate {
}
for (const binding of this._page.allBindings())
scripts.push(this._bindingToScript(binding));
scripts.push(...this._browserContext._evaluateOnNewDocumentSources);
scripts.push(...this._page._evaluateOnNewDocumentSources);
scripts.push(...this._browserContext.initScripts);
scripts.push(...this._page.initScripts);
return scripts.join(';');
}