endojs / endo

Endo is a distributed secure JavaScript sandbox, based on SES
Apache License 2.0
829 stars 72 forks source link

Loading SES fails if `globalThis.process` is shimmed #1917

Closed mhofman closed 10 months ago

mhofman commented 10 months ago

Describe the bug

Console taming assumes that if globalThis.process exists, then we're in node, and get to use some process APIs like .on() .exit() etc. https://github.com/endojs/endo/blob/2179108cb9247e9499c1f319de907d7cd365f314/packages/ses/src/error/tame-console.js#L97-L126

If globalThis.process is shimmed with something like {env: {FOO: 'bar'}}, then loading SES fails with globalThis.process.on is not a function.

Expected behavior

Console taming should more fully feature test the Node features it expects

Platform environment

Browser

Screenshots

image