Skip to content

June 1, 2022

Compare
Choose a tag to compare
@phoddie phoddie released this 03 Jun 22:53
· 3178 commits to public since this release

This release contains changes to the Moddable SDK from May 2 to June 1, 2022.

Highlights of this release include:

  • Two new MQTT client classes, including one that is API compatible with the widely used MQTT.js package
  • Updates to many ECMA-419 modules, mostly focused on validating features in-progress for 2nd Edition
  • Several fixes for operations on preloaded objects
  • Lots of bug fixes based on unit test, user reports, and fuzz testing

Thank you to everyone who contributed to this release with a PR or an issue report. Especially thank you to Agoric for continuing their amazing support of our fuzzing efforts. The results are making XS more secure, reliable, and conformant on all devices.

If you have questions or suggestions about anything here, drop by our Gitter to chat about it or start a new Discussion on our GitHub repository.

  • Runtime
    • MQTT client
    • ECMA-419
      • New ECMA-419 DNS resolver implementation using UDP. Matches current draft specification.
      • ECMA-419 TCP implementation on macOS no longer drives CPU use to 100% when there is unread data
      • ECMA-419 HTTP client write returns updated writable count, consistent with ECMA-419 MQTT and WebSocket clients
      • ECMA-419 TCP instances have remoteAddress and remotePort properties consistent with Node.js sockets.
      • ECMA-419 WebSocket client no longer gets confused when receiving a 0 tag byte
    • Preloaded objects
      • Proxy constructor and Proxy.revocable now work when passed host function primitives. Reported by @cmidgley.
      • Adding object in read-only memory (flash / ROM) to a WeakMap or WeakSet throws instead of crashing. Reported by @cmidgley.
      • JSON.stringify throws "read-only value" instead of misleading "cyclic value" when trying to serialize objects in read-only memory (flash / ROM). #340. Reported by @takeru.
    • Improved input parameter validation
      • ECMA-419 SPI for ESP8266 and ESP32
      • Hex module (converts between hexadecimal string and binary buffer)
      • Inflate and Deflate (zlib)
      • QRCode
    • Fixes
      • Calling Timer.clear() on a one-shot timer after it fired would crash. Reported by @cmidgley.
      • Inflate and Deflate fixes to work reliably when streaming
      • Piu Text objects no longer crash when trying to render if there is no style set. #887. Reported by @tony-abraham.
      • Top-level await now optionally supported for main module of a Moddable SDK project. Enable by defining MAIN_ASYNC in project manifest. Reported by @dtex to support J5e examples.
    • More general buffer support
      • DNS parser uses xsmcGetBufferReadable to support more kinds of buffers
      • Logical operations module uses xsmcGetBufferReadable to support more kinds of buffers
    • Devices
      • M5Stack Core2 – don't throw exception at start-up if MPU6886 not found
      • ESP8266 and ESP32 hosts no longer crash if the root virtual machine cannot be cloned because of insufficient memory. Instead, a debug build traces can't clone: no memory.
      • ESP32 CPU load instrumentation fixes (as a result of reports by @LokiMetaSmith)
        • Don't get idle task for second core on single core targets
        • Rework native timer callback to work on all ESP-IDF targets
  • XS
    • Fixes for at least 15 crashes found by fuzz testing with Fuzzilli. These generally only occurred in unusual situations that normal JavaScript code would not encounter. A few examples:
      • Calling Symbol() recursively created duplicate symbols and corrupt the global symbol table, eventually causing a crash
      • Fix crashes in lockdown() when environment was in unanticipated states (indexed property added to Date constructor)
      • Fix crash in RegExp parser
      • String.prototype.toUpperCase() and String.prototype.toLowerCase() would crash if the converted string required more bytes to store than the original string and fxRenewChunk couldn't resize the output block
    • Fuzzing support
      • Fix fxRenewChunk when mxNoChunks diagnostic mode is enabled to re-use block when shrinking
      • Fix memory leak of script buffer when fuzzing. Reported by @arirubinstein.
      • Add entry point for Google's OSS-Fuzz. Contributed by @arirubinstein.
      • Option to initialize data buffers to pseudo-random data
    • Snapshots
      • Initialize padding bytes to 0 to generate deterministic output
      • Save and restore stack property of Error instances. Reported by @Agoric.
    • Fixed a subtle memory leak in WeakMap by changing visitation order of delete. Reported by @mhofman.
    • Migrated Secure ECMAScript / Hardened JavaScript built-ins from the xsnap application to xsLockdown.c for wider use
    • String.fromArrayBuffer now also accepts SharedArrayBuffer and host buffers as input. Requested by @cmidgley. Thanks to @HipsterBrown for reporting the Windows build failure.
  • Tools
    • mcsim release build works again
    • xsbug fix for path mapping when the paths are different from the root (for example, mapping a Linux path to Windows path). #882. Reported by @cmidgley.
  • Examples
    • ePaper Photos example is now available on M5Paper
    • Fix typo in font name of Commodetto Fonts example
    • Inflate example demonstrates how to stream using onData and onEnd callbacks
    • ECMA-419 TCP protocol examples updated to use device.network.[protocol] in config.js file. Eventually this will migrate to the network protocol implementations.
  • Documentation
    • Remove Git Bash-based Windows instructions and assume Git Command Prompt integration instead. #510, #632, #897
    • Update documentation on Hex module to describe all arguments