Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ensure standard schemes are registered in nw service process (#2…
…2867) * fix: ensure standard schemes are registered in nw service process Refs #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>
- Loading branch information
1 parent
d74ad63
commit bac1c7f
Showing
4 changed files
with
66 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()); | ||
}); |