mozilla / positron

a experimental, Electron-compatible runtime on top of Gecko
Other
569 stars 64 forks source link

run init.js scripts to initialize environment #19

Open mykmelez opened 8 years ago

mykmelez commented 8 years ago

When Electron starts a process, it creates a Node environment with an init.js script path:

https://github.com/electron/electron/blob/d62d8bbf0aea08e1ab32edf741335c37f92cc58a/atom/common/node_bindings.cc#L163-L166

The init.js script then initializes the environment before running the Electron app.

Even though we don't yet have a real Node implementation, we should be able to evaluate the init.js scripts, stubbing out (or minimally implementing) the Node API calls they invoke, in order to configure the Positron environment similarly to Electron.

This is more of a meta-issue, as the work entrains a variety of separable changes.

At the very least, the work to support the browser (a.k.a. main) process's init.js script (https://github.com/mozilla/positron/blob/master/positron/electron/lib/browser/init.js) can be separated from the work to support renderer processes' init.js script (https://github.com/mozilla/positron/blob/master/positron/electron/lib/renderer/init.js). Pieces like #18 can also be spun off and implemented independently.