Handle Buffer deserialization in sandboxed renderers
In sandboxed renderers we use browserify to provide a node-like environment. The Buffer class used by browserify is actually just a wrapper around Uint8Array, but to deserialize Buffer correctly we must expose the class as a hidden value and use it in V8ValueConverter.
This commit is contained in:
parent
019883f2fa
commit
a6e4867111
4 changed files with 64 additions and 4 deletions
|
@ -5,6 +5,9 @@ const events = require('events')
|
|||
process.atomBinding = require('../common/atom-binding-setup')(binding.get, 'renderer')
|
||||
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
// Expose browserify Buffer as a hidden value. This is used by C++ code to
|
||||
// deserialize Buffer instances sent from browser process.
|
||||
v8Util.setHiddenValue(global, 'Buffer', Buffer)
|
||||
// The `lib/renderer/api/ipc-renderer.js` module looks for the ipc object in the
|
||||
// "ipc" hidden value
|
||||
v8Util.setHiddenValue(global, 'ipc', new events.EventEmitter())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue