fix: fetch-dependent interfaces in Web Workers (#42597)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
parent
82664bfdcc
commit
3d139fc424
6 changed files with 101 additions and 13 deletions
|
@ -1014,12 +1014,35 @@ describe('chromium features', () => {
|
|||
});
|
||||
|
||||
it('Worker has node integration with nodeIntegrationInWorker', async () => {
|
||||
const w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true, nodeIntegrationInWorker: true, contextIsolation: false } });
|
||||
const w = new BrowserWindow({
|
||||
show: false,
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
nodeIntegrationInWorker: true,
|
||||
contextIsolation: false
|
||||
}
|
||||
});
|
||||
|
||||
w.loadURL(`file://${fixturesPath}/pages/worker.html`);
|
||||
const [, data] = await once(ipcMain, 'worker-result');
|
||||
expect(data).to.equal('object function object function');
|
||||
});
|
||||
|
||||
it('Worker has access to fetch-dependent interfaces with nodeIntegrationInWorker', async () => {
|
||||
const w = new BrowserWindow({
|
||||
show: false,
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
nodeIntegrationInWorker: true,
|
||||
contextIsolation: false
|
||||
}
|
||||
});
|
||||
|
||||
w.loadURL(`file://${fixturesPath}/pages/worker-fetch.html`);
|
||||
const [, data] = await once(ipcMain, 'worker-fetch-result');
|
||||
expect(data).to.equal('function function function function function');
|
||||
});
|
||||
|
||||
describe('SharedWorker', () => {
|
||||
it('can work', async () => {
|
||||
const w = new BrowserWindow({ show: false });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue