Since we will only have builtin extensions for a while, the
more-complicated, watchdog-based extension duplication prevention has
been replaced with one that treats the extension URL as equivalent to
the extension ID. This is true only for built-in extensions, so once we
start supporting third-party extensions we will likely need to bring
back the watchdog (commit e4381b4693) and
the more-complex duplication prevention (commit
670e51d335).
The code here should be treated as a last resort: ideally the GUI should
check if a particular extension is loaded (maybe by calling the
Extension Manager's new `isExtensionLoaded` method) and avoid calling
`loadExtensionURL` if it is.
If an extension attempts to register with the same ID as another
extension which has already registered, the new registration is refused.
If the extension is in a worker and no other extension is successfully
registered by that worker, the watchdog system will terminate the
"empty" worker.
If an extension worker does not complete initialization in a reasonable
amount of time (currently 15 seconds) then the worker will be
terminated. A complete initialization includes registering an extension.
Due to a typo (I believe) we were overwriting a horizontal hat block's
fields list when collecting hat block inputs. Now we collect inputs into
a temporary object in this case.
Dynamic menus are not yet supported for extension menus, though they are
part of the extension spec. This change provides more thorough feedback
if an extension tries to register an unsupported dynamic menu.
- Remove WeDo 2 extension from the runtime's default block packages list
- The WeDo 2.0 extension now calls its own `connect` method on startup
I also renamed `EXTENSION_NAME` to `EXTENSION_ID` for consistency with
the rest of the extension system.
This prevents generation of invalid XML due to characters like '<' or
'>' in fields' default values. Unfortunately the value comes back in its
escaped form, so there's still more work to be done.
WeDo2 and Pen blocks have been converted to internal extensions, and can
now be loaded by giving `loadExtensionURL` the string 'pen' or 'wedo2'
instead of an actual URL.
The new `_registerInternalExtension` method on the extension manager
will register an extension object (an object with a `getInfo()` method)
with the extension system without sandboxing the object in a Worker.