fix: also pass securityOrigin to media permissions request handler (#31357)
This commit is contained in:
parent
a751845afc
commit
b2a2b077da
3 changed files with 29 additions and 0 deletions
|
@ -947,6 +947,7 @@ describe('chromium features', () => {
|
|||
afterEach(closeAllWindows);
|
||||
afterEach(() => {
|
||||
session.defaultSession.setPermissionCheckHandler(null);
|
||||
session.defaultSession.setPermissionRequestHandler(null);
|
||||
});
|
||||
|
||||
it('can return labels of enumerated devices', async () => {
|
||||
|
@ -996,6 +997,32 @@ describe('chromium features', () => {
|
|||
const [, secondDeviceIds] = await emittedOnce(ipcMain, 'deviceIds', () => w.webContents.reload());
|
||||
expect(firstDeviceIds).to.not.deep.equal(secondDeviceIds);
|
||||
});
|
||||
|
||||
it('provides a securityOrigin to the request handler', async () => {
|
||||
session.defaultSession.setPermissionRequestHandler(
|
||||
(wc, permission, callback, details) => {
|
||||
if (details.securityOrigin !== undefined) {
|
||||
callback(true);
|
||||
} else {
|
||||
callback(false);
|
||||
}
|
||||
}
|
||||
);
|
||||
const w = new BrowserWindow({ show: false });
|
||||
w.loadFile(path.join(fixturesPath, 'pages', 'blank.html'));
|
||||
const labels = await w.webContents.executeJavaScript(`navigator.mediaDevices.getUserMedia({
|
||||
video: {
|
||||
mandatory: {
|
||||
chromeMediaSource: "desktop",
|
||||
minWidth: 1280,
|
||||
maxWidth: 1280,
|
||||
minHeight: 720,
|
||||
maxHeight: 720
|
||||
}
|
||||
}
|
||||
}).then((stream) => stream.getVideoTracks())`);
|
||||
expect(labels.some((l: any) => l)).to.be.true();
|
||||
});
|
||||
});
|
||||
|
||||
describe('window.opener access', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue