Skip to content

Commit 3680dc5

Browse files
authored
chore: unship context.setStorageState (#37021)
1 parent 247fe62 commit 3680dc5

File tree

11 files changed

+1
-251
lines changed

11 files changed

+1
-251
lines changed

docs/src/api/class-browsercontext.md

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,28 +1496,6 @@ its geolocation.
14961496
Whether to emulate network being offline for the browser context.
14971497

14981498

1499-
## async method: BrowserContext.setStorageState
1500-
* since: v1.55
1501-
1502-
Resets storage state in the context by clearing cookies, cache and storage, and then applying the new storage state.
1503-
1504-
### param: BrowserContext.setStorageState.storageState = %%-js-python-context-option-storage-state-%%
1505-
* since: v1.55
1506-
1507-
### param: BrowserContext.setStorageState.storageState = %%-csharp-java-context-option-storage-state-%%
1508-
* since: v1.55
1509-
1510-
1511-
## async method: BrowserContext.setStorageStatePath
1512-
* since: v1.55
1513-
* langs: csharp, java
1514-
1515-
Resets storage state in the context by clearing cookies, cache and storage, and then applying the new storage state from a file.
1516-
1517-
### param: BrowserContext.setStorageStatePath.storageStatePath = %%-csharp-java-context-option-storage-state-path-%%
1518-
* since: v1.55
1519-
1520-
15211499
## async method: BrowserContext.storageState
15221500
* since: v1.8
15231501
- returns: <[Object]>

packages/playwright-client/types/types.d.ts

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -9273,64 +9273,6 @@ export interface BrowserContext {
92739273
*/
92749274
setOffline(offline: boolean): Promise<void>;
92759275

9276-
/**
9277-
* Resets storage state in the context by clearing cookies, cache and storage, and then applying the new storage
9278-
* state.
9279-
* @param storageState Learn more about [storage state and auth](https://playwright.dev/docs/auth).
9280-
*
9281-
* Populates context with given storage state. This option can be used to initialize context with logged-in
9282-
* information obtained via
9283-
* [browserContext.storageState([options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-storage-state).
9284-
*/
9285-
setStorageState(storageState: string|{
9286-
/**
9287-
* Cookies to set for context
9288-
*/
9289-
cookies: Array<{
9290-
name: string;
9291-
9292-
value: string;
9293-
9294-
/**
9295-
* Domain and path are required. For the cookie to apply to all subdomains as well, prefix domain with a dot, like
9296-
* this: ".example.com"
9297-
*/
9298-
domain: string;
9299-
9300-
/**
9301-
* Domain and path are required
9302-
*/
9303-
path: string;
9304-
9305-
/**
9306-
* Unix time in seconds.
9307-
*/
9308-
expires: number;
9309-
9310-
httpOnly: boolean;
9311-
9312-
secure: boolean;
9313-
9314-
/**
9315-
* sameSite flag
9316-
*/
9317-
sameSite: "Strict"|"Lax"|"None";
9318-
}>;
9319-
9320-
origins: Array<{
9321-
origin: string;
9322-
9323-
/**
9324-
* localStorage to set for context
9325-
*/
9326-
localStorage: Array<{
9327-
name: string;
9328-
9329-
value: string;
9330-
}>;
9331-
}>;
9332-
}): Promise<void>;
9333-
93349276
/**
93359277
* Returns storage state for this browser context, contains current cookies, local storage snapshot and IndexedDB
93369278
* snapshot.

packages/playwright-core/src/client/browserContext.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -455,10 +455,6 @@ export class BrowserContext extends ChannelOwner<channels.BrowserContextChannel>
455455
return state;
456456
}
457457

458-
async setStorageState(storageState: string | SetStorageState) {
459-
await this._channel.setStorageState({ storageState: await prepareStorageState(this._platform, storageState) });
460-
}
461-
462458
backgroundPages(): Page[] {
463459
return [...this._backgroundPages];
464460
}

packages/playwright-core/src/protocol/validator.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,13 +1071,6 @@ scheme.BrowserContextStorageStateResult = tObject({
10711071
cookies: tArray(tType('NetworkCookie')),
10721072
origins: tArray(tType('OriginStorage')),
10731073
});
1074-
scheme.BrowserContextSetStorageStateParams = tObject({
1075-
storageState: tObject({
1076-
cookies: tOptional(tArray(tType('SetNetworkCookie'))),
1077-
origins: tOptional(tArray(tType('SetOriginStorage'))),
1078-
}),
1079-
});
1080-
scheme.BrowserContextSetStorageStateResult = tOptional(tObject({}));
10811074
scheme.BrowserContextPauseParams = tOptional(tObject({}));
10821075
scheme.BrowserContextPauseResult = tOptional(tObject({}));
10831076
scheme.BrowserContextEnableRecorderParams = tObject({

packages/playwright-core/src/server/browserContext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ export abstract class BrowserContext extends SdkObject {
616616
return this._creatingStorageStatePage;
617617
}
618618

619-
async setStorageState(progress: Progress, state: channels.BrowserNewContextParams['storageState'], mode: 'initial' | 'resetForReuse' | 'update') {
619+
async setStorageState(progress: Progress, state: channels.BrowserNewContextParams['storageState'], mode: 'initial' | 'resetForReuse') {
620620
let page: Page | undefined;
621621
let interceptor: network.RouteHandler | undefined;
622622
try {

packages/playwright-core/src/server/dispatchers/browserContextDispatcher.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,6 @@ export class BrowserContextDispatcher extends Dispatcher<BrowserContext, channel
330330
return await progress.race(this._context.storageState(progress, params.indexedDB));
331331
}
332332

333-
async setStorageState(params: channels.BrowserContextSetStorageStateParams, progress: Progress): Promise<channels.BrowserContextSetStorageStateResult> {
334-
await this._context.setStorageState(progress, params.storageState, 'update');
335-
}
336-
337333
async close(params: channels.BrowserContextCloseParams, progress: Progress): Promise<void> {
338334
progress.metadata.potentiallyClosesScope = true;
339335
await this._context.close(params);

packages/playwright-core/src/utils/isomorphic/protocolMetainfo.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ export const methodMetainfo = new Map<string, { internal?: boolean, title?: stri
8282
['BrowserContext.setWebSocketInterceptionPatterns', { title: 'Route WebSockets', group: 'route', }],
8383
['BrowserContext.setOffline', { title: 'Set offline mode', }],
8484
['BrowserContext.storageState', { title: 'Get storage state', }],
85-
['BrowserContext.setStorageState', { title: 'Set storage state', group: 'configuration', }],
8685
['BrowserContext.pause', { title: 'Pause', }],
8786
['BrowserContext.enableRecorder', { internal: true, }],
8887
['BrowserContext.disableRecorder', { internal: true, }],

packages/playwright-core/types/types.d.ts

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -9273,64 +9273,6 @@ export interface BrowserContext {
92739273
*/
92749274
setOffline(offline: boolean): Promise<void>;
92759275

9276-
/**
9277-
* Resets storage state in the context by clearing cookies, cache and storage, and then applying the new storage
9278-
* state.
9279-
* @param storageState Learn more about [storage state and auth](https://playwright.dev/docs/auth).
9280-
*
9281-
* Populates context with given storage state. This option can be used to initialize context with logged-in
9282-
* information obtained via
9283-
* [browserContext.storageState([options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-storage-state).
9284-
*/
9285-
setStorageState(storageState: string|{
9286-
/**
9287-
* Cookies to set for context
9288-
*/
9289-
cookies: Array<{
9290-
name: string;
9291-
9292-
value: string;
9293-
9294-
/**
9295-
* Domain and path are required. For the cookie to apply to all subdomains as well, prefix domain with a dot, like
9296-
* this: ".example.com"
9297-
*/
9298-
domain: string;
9299-
9300-
/**
9301-
* Domain and path are required
9302-
*/
9303-
path: string;
9304-
9305-
/**
9306-
* Unix time in seconds.
9307-
*/
9308-
expires: number;
9309-
9310-
httpOnly: boolean;
9311-
9312-
secure: boolean;
9313-
9314-
/**
9315-
* sameSite flag
9316-
*/
9317-
sameSite: "Strict"|"Lax"|"None";
9318-
}>;
9319-
9320-
origins: Array<{
9321-
origin: string;
9322-
9323-
/**
9324-
* localStorage to set for context
9325-
*/
9326-
localStorage: Array<{
9327-
name: string;
9328-
9329-
value: string;
9330-
}>;
9331-
}>;
9332-
}): Promise<void>;
9333-
93349276
/**
93359277
* Returns storage state for this browser context, contains current cookies, local storage snapshot and IndexedDB
93369278
* snapshot.

packages/protocol/src/channels.d.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,7 +1612,6 @@ export interface BrowserContextChannel extends BrowserContextEventTarget, EventT
16121612
setWebSocketInterceptionPatterns(params: BrowserContextSetWebSocketInterceptionPatternsParams, progress?: Progress): Promise<BrowserContextSetWebSocketInterceptionPatternsResult>;
16131613
setOffline(params: BrowserContextSetOfflineParams, progress?: Progress): Promise<BrowserContextSetOfflineResult>;
16141614
storageState(params: BrowserContextStorageStateParams, progress?: Progress): Promise<BrowserContextStorageStateResult>;
1615-
setStorageState(params: BrowserContextSetStorageStateParams, progress?: Progress): Promise<BrowserContextSetStorageStateResult>;
16161615
pause(params?: BrowserContextPauseParams, progress?: Progress): Promise<BrowserContextPauseResult>;
16171616
enableRecorder(params: BrowserContextEnableRecorderParams, progress?: Progress): Promise<BrowserContextEnableRecorderResult>;
16181617
disableRecorder(params?: BrowserContextDisableRecorderParams, progress?: Progress): Promise<BrowserContextDisableRecorderResult>;
@@ -1863,16 +1862,6 @@ export type BrowserContextStorageStateResult = {
18631862
cookies: NetworkCookie[],
18641863
origins: OriginStorage[],
18651864
};
1866-
export type BrowserContextSetStorageStateParams = {
1867-
storageState: {
1868-
cookies?: SetNetworkCookie[],
1869-
origins?: SetOriginStorage[],
1870-
},
1871-
};
1872-
export type BrowserContextSetStorageStateOptions = {
1873-
1874-
};
1875-
export type BrowserContextSetStorageStateResult = void;
18761865
export type BrowserContextPauseParams = {};
18771866
export type BrowserContextPauseOptions = {};
18781867
export type BrowserContextPauseResult = void;

packages/protocol/src/protocol.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,20 +1346,6 @@ BrowserContext:
13461346
type: array
13471347
items: OriginStorage
13481348

1349-
setStorageState:
1350-
title: Set storage state
1351-
group: configuration
1352-
parameters:
1353-
storageState:
1354-
type: object
1355-
properties:
1356-
cookies:
1357-
type: array?
1358-
items: SetNetworkCookie
1359-
origins:
1360-
type: array?
1361-
items: SetOriginStorage
1362-
13631349
pause:
13641350
title: Pause
13651351

0 commit comments

Comments
 (0)