mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: ignore non-absolute session preload script paths when sandboxed (#19066)
This commit is contained in:
committed by
John Kleinschmidt
parent
50b9c7051e
commit
69ea0b4ebf
@@ -545,7 +545,8 @@ describe('BrowserWindow module', () => {
|
||||
describe('session preload scripts', function () {
|
||||
const preloads = [
|
||||
path.join(fixtures, 'module', 'set-global-preload-1.js'),
|
||||
path.join(fixtures, 'module', 'set-global-preload-2.js')
|
||||
path.join(fixtures, 'module', 'set-global-preload-2.js'),
|
||||
path.relative(process.cwd(), path.join(fixtures, 'module', 'set-global-preload-3.js'))
|
||||
]
|
||||
const defaultSession = session.defaultSession
|
||||
|
||||
@@ -564,9 +565,10 @@ describe('BrowserWindow module', () => {
|
||||
const generateSpecs = (description, sandbox) => {
|
||||
describe(description, () => {
|
||||
it('loads the script before other scripts in window including normal preloads', function (done) {
|
||||
ipcMain.once('vars', function (event, preload1, preload2) {
|
||||
ipcMain.once('vars', function (event, preload1, preload2, preload3) {
|
||||
expect(preload1).to.equal('preload-1')
|
||||
expect(preload2).to.equal('preload-1-2')
|
||||
expect(preload3).to.be.null()
|
||||
done()
|
||||
})
|
||||
w.destroy()
|
||||
|
||||
7
spec/fixtures/api/preloads.html
vendored
7
spec/fixtures/api/preloads.html
vendored
@@ -1,7 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
require('electron').ipcRenderer.send('vars', preload1, preload2, preload3);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
2
spec/fixtures/module/get-global-preload.js
vendored
2
spec/fixtures/module/get-global-preload.js
vendored
@@ -1 +1 @@
|
||||
require('electron').ipcRenderer.send('vars', window.preload1, window.preload2)
|
||||
require('electron').ipcRenderer.send('vars', window.preload1, window.preload2, window.preload3)
|
||||
|
||||
1
spec/fixtures/module/set-global-preload-3.js
vendored
Normal file
1
spec/fixtures/module/set-global-preload-3.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
window.preload3 = window.preload2 + '-3'
|
||||
Reference in New Issue
Block a user