Use remote/fs to read preload script during sandboxed setup
Also expose the "fs" module to preload scripts, as a shortcut to `require('electron').remote.require('fs')`
This commit is contained in:
parent
f6befbe764
commit
e9b955b9ec
2 changed files with 9 additions and 15 deletions
|
@ -7,8 +7,6 @@ const {WebContents} = process.atomBinding('web_contents')
|
|||
|
||||
const {ipcMain, isPromise, webContents} = electron
|
||||
|
||||
const fs = require('fs')
|
||||
|
||||
const objectsRegistry = require('./objects-registry')
|
||||
|
||||
const hasProp = {}.hasOwnProperty
|
||||
|
@ -268,13 +266,6 @@ ipcMain.on('ELECTRON_BROWSER_REQUIRE', function (event, module) {
|
|||
}
|
||||
})
|
||||
|
||||
ipcMain.on('ELECTRON_BROWSER_READ_FILE', function (event, file) {
|
||||
fs.readFile(file, (err, data) => {
|
||||
if (err) event.returnValue = {err: err.message}
|
||||
else event.returnValue = {data: data.toString()}
|
||||
})
|
||||
})
|
||||
|
||||
ipcMain.on('ELECTRON_BROWSER_GET_BUILTIN', function (event, module) {
|
||||
try {
|
||||
event.returnValue = valueToMeta(event.sender, electron[module])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue