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
18
spec-main/fixtures/api/custom-protocol-shutdown.js
Normal file
18
spec-main/fixtures/api/custom-protocol-shutdown.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
const { app, webContents, protocol, session } = require('electron');
|
||||
|
||||
protocol.registerSchemesAsPrivileged([
|
||||
{ scheme: 'test', privileges: { standard: true, secure: true } }
|
||||
]);
|
||||
|
||||
app.whenReady().then(function () {
|
||||
const ses = session.fromPartition('persist:test-standard-shutdown');
|
||||
const web = webContents.create({ session: ses });
|
||||
|
||||
ses.protocol.registerStringProtocol('test', (request, callback) => {
|
||||
callback('Hello World!');
|
||||
});
|
||||
|
||||
web.webContents.loadURL('test://abc/hello.txt');
|
||||
|
||||
web.webContents.on('did-finish-load', () => app.quit());
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue