Skip to content

Commit

Permalink
feat: add durableStorage to allowed permissions (#5295)
Browse files Browse the repository at this point in the history
  • Loading branch information
mushishi78 committed Sep 16, 2021
1 parent 54c4318 commit eda5171
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/api.md
Expand Up @@ -1094,6 +1094,7 @@ Creates a new page in the browser context.
- `'clipboard-read'`
- `'clipboard-write'`
- `'payment-handler'`
- `'persistent-storage'`
- returns: <[Promise]>

```js
Expand Down
2 changes: 2 additions & 0 deletions src/common/Browser.ts
Expand Up @@ -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'],
Expand All @@ -79,6 +80,7 @@ export type Permission =
| 'clipboard-read'
| 'clipboard-write'
| 'payment-handler'
| 'persistent-storage'
| 'idle-detection'
| 'midi-sysex';

Expand Down
12 changes: 12 additions & 0 deletions test/page.spec.ts
Expand Up @@ -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 () {
Expand Down

0 comments on commit eda5171

Please sign in to comment.