jbeard4 / SCION-CORE

A minimal implementation of Statecharts in portable, embeddable JavaScript. Development moved to gitlab: https://gitlab.com/scion-scxml/core
Apache License 2.0
35 stars 9 forks source link

events stuck in internal queue when event at head is ignored #50

Open mattoshry opened 6 years ago

mattoshry commented 6 years ago

Per mainEventLoop described in [scxmlAlgo], macrostepDone remains false until both enabledTransitions.isEmpty and internalQueue.isEmpty.

The impl at performBigStep and performBigStepAsync only checks the former condition.

Repro:

<scxml version="1.0"
   xmlns="http://www.w3.org/2005/07/scxml">

<state id="uber">
  <state id="s1">
    <transition event="e2" target="pass"/>

    <onentry>
      <raise event="e1"/>
      <raise event="e2"/>
    </onentry>
  </state>
</state>

<final id="pass">
  <onentry>
    <log expr="'RESULT: pass'" label="TEST"/>
  </onentry>
</final>

</scxml>

[scxmlAlgo] https://www.w3.org/TR/scxml/#AlgorithmforSCXMLInterpretation

jbeard4 commented 6 years ago

@mattoshry Should be fixed in the latest release (4.3.1). Please try this again. Thanks!