endojs / endo

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

lockdown() fails in `eshost` environments #1819

Closed gibson042 closed 11 months ago

gibson042 commented 11 months ago

Describe the bug

lockdown() throws errors in eshost environments.

Steps to reproduce

cd /path/to/endo
printf 'import "@endo/init";\n' | npx rollup -p @rollup/plugin-node-resolve -f iife > bug.js
eshost bug.js

Actual behavior

Errors in every engine.

$ eshost bug.js
#### GraalJS

ReferenceError: TextEncoder is not defined

#### JavaScriptCore

TypeError: baseConsole is not an Object. (evaluating 'name in baseConsole')

#### Moddable XS

ReferenceError: (anonymous-586): get console: undefined variable

#### SpiderMonkey

TypeError: baseConsole[level] is not a function

#### V8
console.warn: Removing intrinsics.Promise.withResolvers
ReferenceError: TextEncoder is not defined

Expected behavior

Successful evaluation.