mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
feat(extensions): add support for some chrome.management APIs (#25098)
* fix: initialize management policy * fix(extensions): crash when using chrome.management * test: add tests * docs: add a note about chrome.management * fix: lint errors * fix: lint errors * fix: remove favicon_service include * fix: add missing management permission * docs: more supported apis * fix: extensions.md line endings
This commit is contained in:
@@ -37,6 +37,26 @@ describe('chrome extensions', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('does not crash when using chrome.management', async () => {
|
||||
const customSession = session.fromPartition(`persist:${require('uuid').v4()}`);
|
||||
const w = new BrowserWindow({ show: false, webPreferences: { session: customSession, sandbox: true } });
|
||||
w.loadURL('about:blank');
|
||||
|
||||
await emittedOnce(w.webContents, 'dom-ready');
|
||||
await customSession.loadExtension(path.join(fixtures, 'extensions', 'persistent-background-page'));
|
||||
const args: any = await emittedOnce(app, 'web-contents-created');
|
||||
const wc: Electron.WebContents = args[1];
|
||||
await expect(wc.executeJavaScript(`
|
||||
(() => {
|
||||
return new Promise((resolve) => {
|
||||
chrome.management.getSelf((info) => {
|
||||
resolve(info);
|
||||
});
|
||||
})
|
||||
})();
|
||||
`)).to.eventually.have.property('id');
|
||||
});
|
||||
|
||||
it('can open WebSQLDatabase in a background page', async () => {
|
||||
const customSession = session.fromPartition(`persist:${require('uuid').v4()}`);
|
||||
const w = new BrowserWindow({ show: false, webPreferences: { session: customSession, sandbox: true } });
|
||||
|
||||
Reference in New Issue
Block a user