pixiebrix-extension
pixiebrix-extension copied to clipboard
Browser crashes editing button template
Describe the bug
- Browser crashes editing button HTML template
- https://pixiebrix.slack.com/archives/C0436P48QHY/p1717017455901409 (includes Loom)
Definition of Done
- Must have: If the HTML is empty, the starter brick should not insert anything
- Must have: If the HTML is invalid, the starter brick should not insert anything
- Nice to have: add analysis rule that shows error on invalid HTML template. (IIRC, the value should be a valid HTML element even though it's a mustache template)
Discussion
- DOMPurify might fix some invalid HTML automatically
Workaround
- Likely workaround is to only provide valid HTML to for the template
Related Code
- https://github.com/pixiebrix/pixiebrix-extension/blob/f4fcceca65eca7e3c99095b5cda7a55a87a27a16/src/starterBricks/menuItem/menuItemExtension.ts#L554-L554
- Related item: https://github.com/pixiebrix/pixiebrix-extension/blob/f4fcceca65eca7e3c99095b5cda7a55a87a27a16/src/starterBricks/menuItem/menuItemExtension.ts#L912-L912