ecmascript: Add support for plugin.getDescriptor()

Fixes #2244