diff --git a/docs/api.md b/docs/api.md index c996ff7c..44f34273 100644 --- a/docs/api.md +++ b/docs/api.md @@ -1094,6 +1094,7 @@ Creates a new page in the browser context. - `'clipboard-read'` - `'clipboard-write'` - `'payment-handler'` + - `'persistent-storage'` - returns: <[Promise]> ```js diff --git a/src/common/Browser.ts b/src/common/Browser.ts index cbb3932d..914b5b19 100644 --- a/src/common/Browser.ts +++ b/src/common/Browser.ts @@ -56,6 +56,7 @@ const WEB_PERMISSION_TO_PROTOCOL_PERMISSION = new Map< ['clipboard-read', 'clipboardReadWrite'], ['clipboard-write', 'clipboardReadWrite'], ['payment-handler', 'paymentHandler'], + ['persistent-storage', 'durableStorage'], ['idle-detection', 'idleDetection'], // chrome-specific permissions we have. ['midi-sysex', 'midiSysex'], @@ -79,6 +80,7 @@ export type Permission = | 'clipboard-read' | 'clipboard-write' | 'payment-handler' + | 'persistent-storage' | 'idle-detection' | 'midi-sysex'; diff --git a/test/page.spec.ts b/test/page.spec.ts index 0cdcf56e..bc05e757 100644 --- a/test/page.spec.ts +++ b/test/page.spec.ts @@ -339,6 +339,18 @@ describe('Page', function () { await otherContext.close(); } ); + itFailsFirefox('should grant persistent-storage', async () => { + const { page, server, context } = getTestState(); + + await page.goto(server.EMPTY_PAGE); + expect(await getPermission(page, 'persistent-storage')).not.toBe( + 'granted' + ); + await context.overridePermissions(server.EMPTY_PAGE, [ + 'persistent-storage', + ]); + expect(await getPermission(page, 'persistent-storage')).toBe('granted'); + }); }); describe('Page.setGeolocation', function () {