Preload doesn't load in sandboxed render if preload path contains special chars (#12037)

* Adding missing headers

* adding ut

* Removing the file path exists check

* fixing test

* exposing window.require in UT
This commit is contained in:
Hari Juturu 2018-03-07 08:40:00 -08:00 committed by Shelley Vohr
parent 69e7afee26
commit 2f4fd3324b
3 changed files with 28 additions and 4 deletions

View file

@ -1186,7 +1186,24 @@ describe('BrowserWindow module', () => {
w.loadURL('file://' + path.join(fixtures, 'api', 'preload.html'))
})
it('exposes "exit" event to preload script', (done) => {
it('exposes ipcRenderer to preload script (path has special chars)', function (done) {
const preloadSpecialChars = path.join(fixtures, 'module', 'preload-sandboxæø åü.js')
ipcMain.once('answer', function (event, test) {
assert.equal(test, 'preload')
done()
})
w.destroy()
w = new BrowserWindow({
show: false,
webPreferences: {
sandbox: true,
preload: preloadSpecialChars
}
})
w.loadURL('file://' + path.join(fixtures, 'api', 'preload.html'))
})
it('exposes "exit" event to preload script', function (done) {
w.destroy()
w = new BrowserWindow({
show: false,