TurboWarp / scratch-vm

Scratch VM with a JIT compiler and more features
https://turbowarp.org/
Mozilla Public License 2.0
75 stars 72 forks source link

vm crash #194

Open JustablockCode opened 8 months ago

JustablockCode commented 8 months ago

when extension returns [Object object] vm crashes

CST1229 commented 8 months ago

https://docs.turbowarp.org/development/extensions/unsandboxed#increased-power-brings-increased-responsibility

Input and boolean blocks must return a valid value. While sandboxed extensions are free to neglect this, unsandboxed extensions that don't return proper values (string, number, or boolean) can break scripts in unknown ways.

FurryR commented 5 months ago
class ReturnValue extends String {
  constructor (value) {
    super(value.toString())
    this.value = value
  }
}
// ...
block (args, util) {
  return new ReturnValue({})
}

may help.