mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
@@ -718,6 +718,14 @@ void ElectronBrowserClient::GetAdditionalWebUISchemes(
|
||||
additional_schemes->push_back(content::kChromeDevToolsScheme);
|
||||
}
|
||||
|
||||
bool ElectronBrowserClient::ArePersistentMediaDeviceIDsAllowed(
|
||||
content::BrowserContext* browser_context,
|
||||
const GURL& scope,
|
||||
const GURL& site_for_cookies,
|
||||
const base::Optional<url::Origin>& top_frame_origin) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void ElectronBrowserClient::SiteInstanceDeleting(
|
||||
content::SiteInstance* site_instance) {
|
||||
// We are storing weak_ptr, is it fundamental to maintain the map up-to-date
|
||||
|
||||
@@ -228,6 +228,11 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
|
||||
scoped_refptr<net::HttpResponseHeaders> response_headers,
|
||||
bool first_auth_attempt,
|
||||
LoginAuthRequiredCallback auth_required_callback) override;
|
||||
bool ArePersistentMediaDeviceIDsAllowed(
|
||||
content::BrowserContext* browser_context,
|
||||
const GURL& scope,
|
||||
const GURL& site_for_cookies,
|
||||
const base::Optional<url::Origin>& top_frame_origin) override;
|
||||
|
||||
// content::RenderProcessHostObserver:
|
||||
void RenderProcessHostDestroyed(content::RenderProcessHost* host) override;
|
||||
|
||||
@@ -697,6 +697,21 @@ describe('chromium features', () => {
|
||||
expect(labels.some((l: any) => l)).to.be.false()
|
||||
})
|
||||
|
||||
it('returns the same device ids across reloads', async () => {
|
||||
const ses = session.fromPartition('persist:media-device-id')
|
||||
const w = new BrowserWindow({
|
||||
show: false,
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
session: ses
|
||||
}
|
||||
})
|
||||
w.loadFile(path.join(fixturesPath, 'pages', 'media-id-reset.html'))
|
||||
const [, firstDeviceIds] = await emittedOnce(ipcMain, 'deviceIds')
|
||||
const [, secondDeviceIds] = await emittedOnce(ipcMain, 'deviceIds', () => w.webContents.reload())
|
||||
expect(firstDeviceIds).to.deep.equal(secondDeviceIds)
|
||||
})
|
||||
|
||||
it('can return new device id when cookie storage is cleared', async () => {
|
||||
const ses = session.fromPartition('persist:media-device-id')
|
||||
const w = new BrowserWindow({
|
||||
@@ -709,8 +724,7 @@ describe('chromium features', () => {
|
||||
w.loadFile(path.join(fixturesPath, 'pages', 'media-id-reset.html'))
|
||||
const [, firstDeviceIds] = await emittedOnce(ipcMain, 'deviceIds')
|
||||
await ses.clearStorageData({ storages: ['cookies'] })
|
||||
w.webContents.reload()
|
||||
const [, secondDeviceIds] = await emittedOnce(ipcMain, 'deviceIds')
|
||||
const [, secondDeviceIds] = await emittedOnce(ipcMain, 'deviceIds', () => w.webContents.reload())
|
||||
expect(firstDeviceIds).to.not.deep.equal(secondDeviceIds)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user