Expose builtin v8 modules to AtomSandboxedRendererClient

- Adapt node.cc code that implements `process.binding` to create a similar
  object in AtomSandboxedRendererClient.
- Replace the ipc binding object passed to `lib/sandboxed_renderer/init.js` by
  the new binding object.
- Refactor the initialization script to use this new object to fetch the ipc
  binding and store as a hidden value using the `v8_util` module.

This change also required applying a patch to node.js, so the submodule commit
was updated.
This commit is contained in:
Thiago de Arruda 2017-02-20 10:59:39 -03:00
parent 85d66d2413
commit d78f3cae7b
7 changed files with 89 additions and 31 deletions

View file

@ -1,18 +1,6 @@
const timers = require('timers')
const {binding} = process
process.atomBinding = function (name) {
try {
return binding(`atom_${process.type}_${name}`)
} catch (error) {
if (/No such module/.test(error.message)) {
return binding(`atom_common_${name}`)
} else {
throw error
}
}
}
process.atomBinding = require('./atom-binding-setup')(process.binding, process.type)
// setImmediate and process.nextTick makes use of uv_check and uv_prepare to
// run the callbacks, however since we only run uv loop on requests, the