fix: ensure standard schemes are registered in nw service process (#22867)
* fix: ensure standard schemes are registered in nw service process Refs https://github.com/electron/electron/pull/20546 * chore: add test * chore: apply suggestions from code review Co-Authored-By: Jeremy Apthorp <jeremya@chromium.org> Co-authored-by: Jeremy Apthorp <jeremya@chromium.org>
This commit is contained in:
parent
d74ad631e7
commit
bac1c7f532
4 changed files with 66 additions and 8 deletions
|
@ -2,6 +2,7 @@ import { expect } from 'chai';
|
|||
import { protocol, webContents, WebContents, session, BrowserWindow, ipcMain } from 'electron';
|
||||
import { promisify } from 'util';
|
||||
import { AddressInfo } from 'net';
|
||||
import * as ChildProcess from 'child_process';
|
||||
import * as path from 'path';
|
||||
import * as http from 'http';
|
||||
import * as fs from 'fs';
|
||||
|
@ -637,6 +638,26 @@ describe('protocol module', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('protocol.registerSchemeAsPrivileged', () => {
|
||||
it('does not crash on exit', async () => {
|
||||
const appPath = path.join(__dirname, 'fixtures', 'api', 'custom-protocol-shutdown.js');
|
||||
const appProcess = ChildProcess.spawn(process.execPath, ['--enable-logging', appPath]);
|
||||
let stdout = '';
|
||||
let stderr = '';
|
||||
appProcess.stdout.on('data', data => { stdout += data; });
|
||||
appProcess.stderr.on('data', data => { stderr += data; });
|
||||
const [code] = await emittedOnce(appProcess, 'exit');
|
||||
if (code !== 0) {
|
||||
console.log('Exit code : ', code);
|
||||
console.log('stdout : ', stdout);
|
||||
console.log('stderr : ', stderr);
|
||||
}
|
||||
expect(code).to.equal(0);
|
||||
expect(stdout).to.not.contain('VALIDATION_ERROR_DESERIALIZATION_FAILED');
|
||||
expect(stderr).to.not.contain('VALIDATION_ERROR_DESERIALIZATION_FAILED');
|
||||
});
|
||||
});
|
||||
|
||||
describe.skip('protocol.registerSchemesAsPrivileged standard', () => {
|
||||
const standardScheme = (global as any).standardScheme;
|
||||
const origin = `${standardScheme}://fake-host`;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue