New JavaScript engine sjs-4


Boomla has received a new ECMAScript 5.1 compilant JavaScript engine called sjs-4.

Key differences to sjs-3:

  • Full ECMAScript 5.1 support including regex and strict mode,

  • 7x faster,

  • SourceMap support.

This opens the door to running Babel, TypeScript, etc on Boomla.

It is based on the Goja VM.

Full list of differences compared to sjs-3

  • Not included:

    • os.print() - use response.body() directly,

    • os.inline(file) - use file.inline() instead,

    • app - use source instead,

    • File.prototype.placeholder() - use .bucketId() instead.

  • 'use strict' is supported. It is on by default; you can turn it off via the file attribute { "useStrict int32": 0 }.

  • Math.random() is seeded from the random attribute on the //request/info file, which contains a base64 string, currently 16 bytes long, storing a 64bit number. Its length may change in the future. You may want to override it when testing.

  • new Date() returns the current time with second granularity (the same value as returned by request.createdBy()).

  • require() asserts that the target file uses the same file type sjs-4.

  • ContentSecurityPolicy rules are not preloaded from the .ContentSecurityPolicy file. You have to set it yourself via response.attrStr('content-security-policy', '...').


The sjs-3 engine is now DEPRECATED.

It is advised to migrate to the sjs-4 engine, although the sjs-3 engine will continue to be available for at least 1 year or until all sjs-3 code has been migrated.


you can follow me on Twitter