Skip to content

Library blocks unjustifiably assume certain blocks are instances of BlockSvg #6905

@cpcallen

Description

@cpcallen

Check for duplicates

  • I have searched for similar issues before opening a new one.

Description

There are several places where library blocks make assumptions that certain Block values are BlockSvg instances.

In some cases these assumptions might be justified—for example, block types that are intended to be used only in mutators will normally be BlockSvg instances—but is risky and prevents those blocks from being safely instantiated in headless mode.

In blocks/lists.ts

  • lists_create_with:
    • init method calls new Mutator(/*...*/, this).
    • decompose method calls workspace.newBlock('lists_create_with_container').initSvg() and workspace.newBlock('lists_create_with_item').initSvg().

Reproduction steps

These are theoretical / type safety issues; I have not verified if it's actually possible to cause a crash.

Additional Info

Part of #6920.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions