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

BlockFactory: Replace eval() with JS-Interpreter #1269

Open
AnmAtAnm opened this issue Aug 8, 2017 · 5 comments
Open

BlockFactory: Replace eval() with JS-Interpreter #1269

AnmAtAnm opened this issue Aug 8, 2017 · 5 comments
Labels
component: devtools issue: feature request Describes a new feature and why it should be added

Comments

@AnmAtAnm
Copy link
Contributor

AnmAtAnm commented Aug 8, 2017

BlockFactory supports inputting JavaScript block definitions into the UI via the "Manual JavaScript" setting, but currently the code is eval()ed to realize the preview block. Replace the raw eval() usage with JS-Interpreter to avoid running arbitrary code in the context of the rest of BlockFactory.

PR #1235 only enables the "Manual JavaScript" option when running in a file:// URL context.

@starfishmod
Copy link

Would this mean for example you could eventually run the blocks "live" and therefore highlight the current block as you step through the code?

@RoboErikG
Copy link
Contributor

In context of BlockFactory this just means providing a bit of protection if you load someone else's blocks. The JS-Interpreter can be used to do block highlighting in apps that use Blockly, and this is how it's used in Blockly Games.

@starfishmod
Copy link

Ah ok missed the block factory part. Got excited with ideas - thanks for clearing that up.

@AnmAtAnm
Copy link
Contributor Author

AnmAtAnm commented Aug 14, 2017

@starfishmod Stay excited! Check out this demo of the stepping behavior you suggested: https://blockly-demo.appspot.com/static/demos/interpreter/step-execution.html

@rachel-fenichel rachel-fenichel added issue: feature request Describes a new feature and why it should be added and removed type: enhancement labels Aug 14, 2017
@starfishmod
Copy link

starfishmod commented Aug 14, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: devtools issue: feature request Describes a new feature and why it should be added
Projects
None yet
Development

No branches or pull requests

4 participants