move default to server
This commit is contained in:
parent
39bfa40983
commit
c33f548e49
|
|
@ -426,7 +426,7 @@ export class BrowserContext extends ChannelOwner<channels.BrowserContextChannel>
|
|||
}
|
||||
|
||||
async storageState(options: { path?: string, indexedDB?: boolean } = {}): Promise<StorageState> {
|
||||
const state = await this._channel.storageState({ indexedDB: options.indexedDB ?? true });
|
||||
const state = await this._channel.storageState({ indexedDB: options.indexedDB });
|
||||
if (options.path) {
|
||||
await mkdirIfNeeded(options.path);
|
||||
await fs.promises.writeFile(options.path, JSON.stringify(state, undefined, 2), 'utf8');
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@ export class APIRequestContext extends ChannelOwner<channels.APIRequestContextCh
|
|||
}
|
||||
|
||||
async storageState(options: { path?: string, indexedDB?: boolean } = {}): Promise<StorageState> {
|
||||
const state = await this._channel.storageState({ indexedDB: options.indexedDB ?? true });
|
||||
const state = await this._channel.storageState({ indexedDB: options.indexedDB });
|
||||
if (options.path) {
|
||||
await mkdirIfNeeded(options.path);
|
||||
await fs.promises.writeFile(options.path, JSON.stringify(state, undefined, 2), 'utf8');
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ scheme.APIRequestContextFetchLogResult = tObject({
|
|||
log: tArray(tString),
|
||||
});
|
||||
scheme.APIRequestContextStorageStateParams = tObject({
|
||||
indexedDB: tBoolean,
|
||||
indexedDB: tOptional(tBoolean),
|
||||
});
|
||||
scheme.APIRequestContextStorageStateResult = tObject({
|
||||
cookies: tArray(tType('NetworkCookie')),
|
||||
|
|
@ -995,7 +995,7 @@ scheme.BrowserContextSetOfflineParams = tObject({
|
|||
});
|
||||
scheme.BrowserContextSetOfflineResult = tOptional(tObject({}));
|
||||
scheme.BrowserContextStorageStateParams = tObject({
|
||||
indexedDB: tBoolean,
|
||||
indexedDB: tOptional(tBoolean),
|
||||
});
|
||||
scheme.BrowserContextStorageStateResult = tObject({
|
||||
cookies: tArray(tType('NetworkCookie')),
|
||||
|
|
|
|||
|
|
@ -508,7 +508,7 @@ export abstract class BrowserContext extends SdkObject {
|
|||
this._origins.add(origin);
|
||||
}
|
||||
|
||||
async storageState(indexedDB: boolean): Promise<channels.BrowserContextStorageStateResult> {
|
||||
async storageState(indexedDB = true): Promise<channels.BrowserContextStorageStateResult> {
|
||||
const result: channels.BrowserContextStorageStateResult = {
|
||||
cookies: await this.cookies(),
|
||||
origins: []
|
||||
|
|
|
|||
|
|
@ -194,8 +194,8 @@ export class APIRequestContextDispatcher extends Dispatcher<APIRequestContext, c
|
|||
this.adopt(tracing);
|
||||
}
|
||||
|
||||
async storageState(): Promise<channels.APIRequestContextStorageStateResult> {
|
||||
return this._object.storageState();
|
||||
async storageState(params: channels.APIRequestContextStorageStateParams): Promise<channels.APIRequestContextStorageStateResult> {
|
||||
return this._object.storageState(params.indexedDB);
|
||||
}
|
||||
|
||||
async dispose(params: channels.APIRequestContextDisposeParams, metadata: CallMetadata): Promise<void> {
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ export abstract class APIRequestContext extends SdkObject {
|
|||
abstract _defaultOptions(): FetchRequestOptions;
|
||||
abstract _addCookies(cookies: channels.NetworkCookie[]): Promise<void>;
|
||||
abstract _cookies(url: URL): Promise<channels.NetworkCookie[]>;
|
||||
abstract storageState(indexedDB: boolean): Promise<channels.APIRequestContextStorageStateResult>;
|
||||
abstract storageState(indexedDB?: boolean): Promise<channels.APIRequestContextStorageStateResult>;
|
||||
|
||||
private _storeResponseBody(body: Buffer): string {
|
||||
const uid = createGuid();
|
||||
|
|
@ -618,7 +618,7 @@ export class BrowserContextAPIRequestContext extends APIRequestContext {
|
|||
return await this._context.cookies(url.toString());
|
||||
}
|
||||
|
||||
override async storageState(indexedDB: boolean): Promise<channels.APIRequestContextStorageStateResult> {
|
||||
override async storageState(indexedDB?: boolean): Promise<channels.APIRequestContextStorageStateResult> {
|
||||
return this._context.storageState(indexedDB);
|
||||
}
|
||||
}
|
||||
|
|
@ -684,7 +684,7 @@ export class GlobalAPIRequestContext extends APIRequestContext {
|
|||
return this._cookieStore.cookies(url);
|
||||
}
|
||||
|
||||
override async storageState(indexedDB: boolean): Promise<channels.APIRequestContextStorageStateResult> {
|
||||
override async storageState(indexedDB = true): Promise<channels.APIRequestContextStorageStateResult> {
|
||||
return {
|
||||
cookies: this._cookieStore.allCookies(),
|
||||
origins: (this._origins || []).map(origin => ({ ...origin, indexedDB: indexedDB ? origin.indexedDB : [] })),
|
||||
|
|
|
|||
8
packages/protocol/src/channels.d.ts
vendored
8
packages/protocol/src/channels.d.ts
vendored
|
|
@ -403,10 +403,10 @@ export type APIRequestContextFetchLogResult = {
|
|||
log: string[],
|
||||
};
|
||||
export type APIRequestContextStorageStateParams = {
|
||||
indexedDB: boolean,
|
||||
indexedDB?: boolean,
|
||||
};
|
||||
export type APIRequestContextStorageStateOptions = {
|
||||
|
||||
indexedDB?: boolean,
|
||||
};
|
||||
export type APIRequestContextStorageStateResult = {
|
||||
cookies: NetworkCookie[],
|
||||
|
|
@ -1802,10 +1802,10 @@ export type BrowserContextSetOfflineOptions = {
|
|||
};
|
||||
export type BrowserContextSetOfflineResult = void;
|
||||
export type BrowserContextStorageStateParams = {
|
||||
indexedDB: boolean,
|
||||
indexedDB?: boolean,
|
||||
};
|
||||
export type BrowserContextStorageStateOptions = {
|
||||
|
||||
indexedDB?: boolean,
|
||||
};
|
||||
export type BrowserContextStorageStateResult = {
|
||||
cookies: NetworkCookie[],
|
||||
|
|
|
|||
|
|
@ -377,7 +377,7 @@ APIRequestContext:
|
|||
|
||||
storageState:
|
||||
parameters:
|
||||
indexedDB: boolean
|
||||
indexedDB: boolean?
|
||||
returns:
|
||||
cookies:
|
||||
type: array
|
||||
|
|
@ -1237,7 +1237,7 @@ BrowserContext:
|
|||
|
||||
storageState:
|
||||
parameters:
|
||||
indexedDB: boolean
|
||||
indexedDB: boolean?
|
||||
returns:
|
||||
cookies:
|
||||
type: array
|
||||
|
|
|
|||
Loading…
Reference in a new issue