Confirmed users
497
edits
(Actor names are now strings, not numbers.) |
(Let frame actors live as long as the frames to which they refer. Notify the client of each frame actor's demise.) |
||
| Line 455: | Line 455: | ||
If the thread pauses to report an interesting event to the client, it sends a packet of the form: | If the thread pauses to report an interesting event to the client, it sends a packet of the form: | ||
{ "from":<i>thread</i>, "type":"paused", "actor":<i>actor</i>, "frame":<i>frame</i>, " | { "from":<i>thread</i>, "type":"paused", "actor":<i>actor</i>, "why":<i>reason</i>, | ||
"current-frame":<i>frame</i>, "popped-frames":[<i>popped-frame</i>...] } | |||
This indicates that the thread has entered the <b>Paused</b> state, and explains where and why. | This indicates that the thread has entered the <b>Paused</b> state, and explains where and why. | ||
<i>Actor</i> is a "pause actor", representing this specific pause of the thread; it lives until the thread next leaves the <b>Paused</b> state. The pause actor parents actors actors referring to | <i>Actor</i> is a "pause actor", representing this specific pause of the thread; it lives until the thread next leaves the <b>Paused</b> state. The pause actor parents actors actors referring to values and other entities uncovered during this pause; when the thread resumes, those actors are automatically closed. This relieves the client from the responsibility to explicitly close every actor mentioned during the pause. | ||
Since actors in value grips are parented by the pause actor | Since actors in value grips are parented by the pause actor, this means that those grips become invalid when the thread resumes; it is not possible to take a grip from one pause and use it in the next. To create a grip that remains valid between pauses, see [[#Holding_Values_Between_Pauses|Holding Values Between Pauses]]. | ||
<i> | <i>Current-frame</i> describes the top frame on the JavaScript stack; see [[#Listing_Stack_Frames|Listing Stack Frames]], below. | ||
The <code>"popped-frames"</code> property is an array of frame actor names, listing the actors for all frames that were live as of the last pause, but have since been popped. | |||
The <i>reason</i> value describes why the thread paused. It has one of the following forms: | The <i>reason</i> value describes why the thread paused. It has one of the following forms: | ||
| Line 616: | Line 619: | ||
The frame may have other properties, depending on <i>type</i>. | The frame may have other properties, depending on <i>type</i>. | ||
All actors mentioned in the frame or grips appearing in the frame (<i>actor</i>, <i>callee</i>, <i>environment</i>, and so on) are parented by the | All actors mentioned in the frame or grips appearing in the frame (<i>actor</i>, <i>callee</i>, <i>environment</i>, and so on) are parented by the thread actor. | ||
=== Global Code Frames === | === Global Code Frames === | ||