What does it do?
Authors declare required features and type information at the top of a .safe file. The host reads those declarations to configure the execution scope and can identify requests for disallowed methods during load(). The parser accepts only a JavaScript subset that disallows eval, new and access to global objects, among other things. Dynamically computed property access is also checked at runtime. Each file has its own scope and restriction boundary.
Key features
- Declare required features in a .safe file header
- Compare declared types with host-allowed methods during load()
- Configure a separate execution scope and restriction boundary for each file
- Restrict eval, new and global object access at the syntax level
- Block prototype-related properties during dynamic property access
- Compile restricted code to standard JavaScript and PHP