fix: Chrome Extensions service worker host registration (#39290)
This commit is contained in:
parent
b2c62d6ad1
commit
c8f7a0e052
5 changed files with 50 additions and 1 deletions
|
@ -711,5 +711,20 @@ describe('chrome extensions', () => {
|
|||
const scope = await registrationPromise;
|
||||
expect(scope).equals(extension.url);
|
||||
});
|
||||
|
||||
it('can run chrome extension APIs', async () => {
|
||||
const customSession = session.fromPartition(`persist:${uuid.v4()}`);
|
||||
const w = new BrowserWindow({ show: false, webPreferences: { session: customSession, nodeIntegration: true } });
|
||||
await customSession.loadExtension(path.join(fixtures, 'extensions', 'mv3-service-worker'));
|
||||
|
||||
await w.loadURL(url);
|
||||
|
||||
w.webContents.executeJavaScript('window.postMessage(\'fetch-confirmation\', \'*\')');
|
||||
|
||||
const [, , responseString] = await once(w.webContents, 'console-message');
|
||||
const { message } = JSON.parse(responseString);
|
||||
|
||||
expect(message).to.equal('Hello from background.js');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue