Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic menu potential bug in sandboxed extension #229

Open
totchi-lagawi opened this issue Oct 25, 2024 · 0 comments
Open

Dynamic menu potential bug in sandboxed extension #229

totchi-lagawi opened this issue Oct 25, 2024 · 0 comments

Comments

@totchi-lagawi
Copy link

Expected Behavior

When loading a sandboxed extension with a defined dynamic menu, the dynamic menu should work as expected.

Actual Behavior

All the blocks in the block panel stack together at the top of the panel (which isn't important, as it is caused by the following problem), and the console throws the error Uncaught TypeError: e[t] is undefined. The problem came from the function _getExtensionMenuItems. It takes as argument argumentObject, and menuItemFunctionName. It tries to access the function with extensionObject[menuItemFunctionName], but when the extension is sandboxed, this does not exist. The function name is correct. Loading the extension in unsandboxed mode works.

Steps to Reproduce

Load the following extension :

class Extension {
    getInfo() {
        return {
            id: "extension",
            name: "Extension",
            blocks: [
                {
                    opcode: "block",
                    blocktype: "command",
                    text: "A block with an argument : [ARG]",
                    arguments: {
                        ARG: {
                            type: "string",
                            menu: "extensionMenu"
                        }
                    }
                }
            ],
            menus: {
                extensionMenu: {
                    items: "extensionMenuFunction"
                }
            }
        }
    }

    block() {
        console.log("Hello world!")
    }

    extensionMenuFunction() {
        return ["Hello", "world", "!"]
    }
}

Scratch.extensions.register(new Extension())

Operating System and Browser

Firefox 131.0.3 (64-bit) - Windows 11 24H2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant