fix: backport patch that ensures that cookie store is always created (#15836)

* fix: backport patch that ensures that cookie store is always created

* fix: disable cookie encryption

* fix: flush the cookie store when NetworkContext shuts down

* test: add test for cookie store persistance

* Update patches/common/chromium/ensure_cookie_store.patch

Co-Authored-By: brenca <benecene@gmail.com>

* Update patches/common/chromium/ensure_cookie_store.patch

Co-Authored-By: brenca <benecene@gmail.com>
This commit is contained in:
Heilig Benedek 2018-11-29 19:51:13 +01:00 committed by Shelley Vohr
parent 165d168ee5
commit 78b88a70bb
6 changed files with 486 additions and 0 deletions

View file

@ -6,6 +6,7 @@ const path = require('path')
const fs = require('fs')
const send = require('send')
const auth = require('basic-auth')
const ChildProcess = require('child_process')
const { closeWindow } = require('./window-helpers')
const { ipcRenderer, remote } = require('electron')
@ -213,6 +214,33 @@ describe('session module', () => {
})
})
})
it('should survive an app restart for persistent partition', async () => {
const appPath = path.join(__dirname, 'fixtures', 'api', 'cookie-app')
const electronPath = remote.getGlobal('process').execPath
const test = (result, phase) => {
return new Promise((resolve, reject) => {
let output = ''
const appProcess = ChildProcess.spawn(
electronPath,
[appPath],
{ env: { PHASE: phase, ...process.env } }
)
appProcess.stdout.on('data', (data) => { output += data })
appProcess.stdout.on('end', () => {
output = output.replace(/(\r\n|\n|\r)/gm, '')
assert.strictEqual(output, result)
resolve()
})
})
}
await test('011', 'one')
await test('110', 'two')
})
})
describe('ses.clearStorageData(options)', () => {