rework to make ff pass
This commit is contained in:
parent
88e6d380bd
commit
961e71f9ad
|
|
@ -1662,7 +1662,7 @@ export class Frame extends SdkObject {
|
|||
}
|
||||
|
||||
async resetStorageForCurrentOriginBestEffort(newStorage: channels.OriginStorage | undefined) {
|
||||
const context = await this._mainContext();
|
||||
const context = await this._utilityContext();
|
||||
await context.evaluate(async ({ ls }) => {
|
||||
// Clean DOMStorage.
|
||||
sessionStorage.clear();
|
||||
|
|
@ -1693,13 +1693,16 @@ export class Frame extends SdkObject {
|
|||
indexedDB.deleteDatabase(db.name!);
|
||||
}
|
||||
|
||||
try {
|
||||
// Clean StorageManager
|
||||
const root = await navigator.storage.getDirectory();
|
||||
// @ts-expect-error
|
||||
for await (const [name] of await root.entries())
|
||||
await root.removeEntry(name, { recursive: true });
|
||||
} catch (e) {}
|
||||
// Clean StorageManager
|
||||
const root = await navigator.storage.getDirectory();
|
||||
const entries = await (root as any).entries();
|
||||
// Manual loop instead of for await because in Firefox's utility context instanceof AsyncIterable is not working.
|
||||
let entry = await entries.next();
|
||||
while (!entry.done) {
|
||||
const [name] = entry.value;
|
||||
await root.removeEntry(name, { recursive: true });
|
||||
entry = await entries.next();
|
||||
}
|
||||
}, { ls: newStorage?.localStorage }).catch(() => {});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -254,7 +254,6 @@ test('should reset Origin Private File System', async ({ reusedContext, httpsSer
|
|||
context = await reusedContext({ ignoreHTTPSErrors: true });
|
||||
page = await context.newPage();
|
||||
await page.goto(httpsServer.EMPTY_PAGE);
|
||||
|
||||
const { directoryExits, fileExits } = await page.evaluate(async () => {
|
||||
const root = await navigator.storage.getDirectory();
|
||||
let directoryExits = true, fileExits = true;
|
||||
|
|
|
|||
Loading…
Reference in a new issue