Central dispatch and worker dispatch share most of their code now by
inheriting from a new shared dispatch class.
Also, the format of passed messages has been altered to make it easier
to understand in a debugger.
The tests run using TinyWorker, which emulates web workers on Node.
There are quite a few quirks in that situation due to the differences
between Node and Webpack as well as the differences between TinyWorker
and real Web Workers.
The tests also exposed a few bugs in the dispatch system, which have now
been fixed. Most notably, if a method called through the dispatch system
throws an exception that exception will now be passed back to the
caller. Previously the exception would escape the dispatch system and
the caller would never hear any response at all.
Rather than assuming that the storage instance will be attached to a VM,
just return it. Callers may attach it to a `VM` or (in the case of
`import_sb2.js`) to a `Runtime`.
This new test verifies that clones and their associated threads are
cleaned up properly by the `delete this clone` block. The clones run two
stacks each: one which waits and then deletes the clone, and another
which includes a `forever` loop: this is to verify that the thread
running the `forever` loop is ended when the clone itself is deleted.
The project does this with two batches of clones to ensure there are no
problems with reusing array indices previously occupied by now-removed
threads or clones.
When importing a project we know the file extension for each asset to be
loaded. This change provides that information to the storage system so
that we can load assets which don't use the default. For example, this
allows loading JPG-format backdrops.
In support of this change, there's a new function on `StringUtil` called
`splitFirst`, which splits a string on the first instance of a separator
character. This change includes unit tests for this new function.
When no Device Manager instance is present this test takes a long time
and can cause timeouts. We'll need to fake the HTTP requests if we want
to do this sort of test reliably.