Skip to content

Commit 35468cf

Browse files
cherry-pick(#30342): Revert "fix(reuse): reset Origin Private File System API (#29921)" (#30344)
This PR cherry-picks the following commits: - 96053ed Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 5332639 commit 35468cf

File tree

2 files changed

+4
-45
lines changed

2 files changed

+4
-45
lines changed

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

-11
Original file line numberDiff line numberDiff line change
@@ -1692,17 +1692,6 @@ export class Frame extends SdkObject {
16921692
if (db.name)
16931693
indexedDB.deleteDatabase(db.name!);
16941694
}
1695-
1696-
// Clean StorageManager
1697-
const root = await navigator.storage.getDirectory();
1698-
const entries = await (root as any).entries();
1699-
// Manual loop instead of for await because in Firefox's utility context instanceof AsyncIterable is not working.
1700-
let entry = await entries.next();
1701-
while (!entry.done) {
1702-
const [name] = entry.value;
1703-
await root.removeEntry(name, { recursive: true });
1704-
entry = await entries.next();
1705-
}
17061695
}, { ls: newStorage?.localStorage }).catch(() => {});
17071696
}
17081697

tests/library/browsercontext-reuse.spec.ts

+4-34
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,13 @@
1515
*/
1616

1717
import { browserTest, expect } from '../config/browserTest';
18-
import type { BrowserContext, BrowserContextOptions } from '@playwright/test';
18+
import type { BrowserContext } from '@playwright/test';
1919

20-
const test = browserTest.extend<{ reusedContext: (options?: BrowserContextOptions) => Promise<BrowserContext> }>({
20+
const test = browserTest.extend<{ reusedContext: () => Promise<BrowserContext> }>({
2121
reusedContext: async ({ browserType, browser }, use) => {
22-
await use(async (options: BrowserContextOptions = {}) => {
22+
await use(async () => {
2323
const defaultContextOptions = (browserType as any)._defaultContextOptions;
24-
const context = await (browser as any)._newContextForReuse({
25-
...defaultContextOptions,
26-
...options,
27-
});
24+
const context = await (browser as any)._newContextForReuse(defaultContextOptions);
2825
return context;
2926
});
3027
},
@@ -238,33 +235,6 @@ test('should reset mouse position', async ({ reusedContext, browserName, platfor
238235
await expect(page.locator('#two')).toHaveCSS('background-color', 'rgb(0, 0, 255)');
239236
});
240237

241-
test('should reset Origin Private File System', async ({ reusedContext, httpsServer, browserName }) => {
242-
test.skip(browserName === 'webkit', 'getDirectory is not supported in ephemeral context in WebKit https://github.com/microsoft/playwright/issues/18235#issuecomment-1289792576');
243-
test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/29901' });
244-
245-
let context = await reusedContext({ ignoreHTTPSErrors: true });
246-
let page = await context.newPage();
247-
await page.goto(httpsServer.EMPTY_PAGE);
248-
await page.evaluate(async () => {
249-
const root = await navigator.storage.getDirectory();
250-
await root.getDirectoryHandle('someDirectoryName', { create: true });
251-
await root.getFileHandle('foo.txt', { create: true });
252-
});
253-
254-
context = await reusedContext({ ignoreHTTPSErrors: true });
255-
page = await context.newPage();
256-
await page.goto(httpsServer.EMPTY_PAGE);
257-
const { directoryExits, fileExits } = await page.evaluate(async () => {
258-
const root = await navigator.storage.getDirectory();
259-
let directoryExits = true, fileExits = true;
260-
await root.getDirectoryHandle('someDirectoryName').catch(() => { directoryExits = false; });
261-
await root.getFileHandle('foo.txt').catch(() => { fileExits = false; });
262-
return { directoryExits, fileExits };
263-
});
264-
expect(directoryExits).toBe(false);
265-
expect(fileExits).toBe(false);
266-
});
267-
268238
test('should reset tracing', async ({ reusedContext, trace }, testInfo) => {
269239
test.skip(trace === 'on');
270240

0 commit comments

Comments
 (0)