fix: assign session to remote webContents (#23989)

* fix: assign session to remote webContents

* fix: test name
This commit is contained in:
Eryk Rakowski 2020-06-11 05:57:51 +02:00 committed by GitHub
commit 04be1ac4a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 1 deletions

View file

@ -1,5 +1,5 @@
import { expect } from 'chai';
import { session, BrowserWindow, ipcMain, WebContents, Extension } from 'electron/main';
import { app, session, BrowserWindow, ipcMain, WebContents, Extension } from 'electron/main';
import { closeAllWindows, closeWindow } from './window-helpers';
import * as http from 'http';
import { AddressInfo } from 'net';
@ -269,6 +269,16 @@ describe('chrome extensions', () => {
});
});
it('has session in background page', async () => {
const customSession = session.fromPartition(`persist:${require('uuid').v4()}`);
await customSession.loadExtension(path.join(fixtures, 'extensions', 'persistent-background-page'));
const w = new BrowserWindow({ show: false, webPreferences: { session: customSession } });
const promise = emittedOnce(app, 'web-contents-created');
await w.loadURL(`about:blank`);
const [, bgPageContents] = await promise;
expect(bgPageContents.session).to.not.equal(undefined);
});
describe('devtools extensions', () => {
let showPanelTimeoutId: any = null;
afterEach(() => {