code-dot-org/blockly — pull request #590 by Bjvanminnen (2014-05-19 23:02:39+00:00)
Title: WIP: better user code execution tracking

Another attempt at cleaning up how we track user code execution. Feel free to tell me I've made things more rather than less confusing, and I can dialog back how much I'm changing.

The way things currently work is when executing user code, we throw an exception any time we want to be finished. We throw true on success, false on failure, and Infinity if we've detected an infinite loop.

With this change, everything goes into an executionInfo object. Instead of throwing, we call terminateWithValue. Before making API calls, we first check to see whether we've terminated. One gotcha is that we depended on the exception to escape some loops. To change this, I had to extend our INFINITE_LOOP_TRAP.

I also moved BlocklyApps.log into executionInfo. I didn't need to do this, but it feels like it belongs there. I think BlocklyApps.ticks does as well.

You'll notice I still have a few todos. I will address these before checking in, but wanted to collect some feedback first. @cpirich @bcjordan Please let me know what you think.