Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const settingsState = settingsStore.getState()
const userState = userStore.getState()
const ses = session.fromPartition(partitionId)
// Downloads
DownloadManager.setupUserDownloadHandlerForPartition(partitionId)
// Permissions & env
PermissionManager.setupPermissionHandler(partitionId)
// UA
if (useCustomUserAgent && customUserAgentString) {
ses.setUserAgent(customUserAgentString)
this[privManagedUsingCustomUA].add(partitionId)
} else if (!settingsState.launched.app.polyfillUserAgents) {
ses.setUserAgent(this._replaceUAChromeVersion(ses.getUserAgent(), e2c.fullVersions[process.versions.electron]))
} else if (userState.wireConfigLatestCVersion()) {
ses.setUserAgent(this._replaceUAChromeVersion(ses.getUserAgent(), userState.wireConfigLatestCVersion()))
}
// Cookies
if (artificiallyPersistCookies) {
SessionManager.webRequestEmitterFromSession(ses).completed.on(undefined, (evt) => {
this._artificiallyPersistCookies(partitionId)
})
}
// Extensions: CSP
SessionManager.webRequestEmitterFromSession(ses).headersReceived.onBlocking(undefined, (details, responder) => {
const updatedHeaders = CRExtensionManager.runtimeHandler.updateContentSecurityPolicy(details.url, details.responseHeaders)
if (updatedHeaders) {
responder({ responseHeaders: updatedHeaders })