jbeard4 / SCION

SCXML/Statecharts in JavaScript, moved to gitlab: https://gitlab.com/scion-scxml/scion
https://scion.scxml.io
Apache License 2.0
149 stars 29 forks source link

The target id parser is a URL parser, not a URI parser #377

Closed jchimene closed 7 years ago

jchimene commented 7 years ago

This causes issues with the following

<state id="example">
    <onentry>
    <script>
<![CDATA[
        var interpreter = this;
        window.onbeforeunload = function(e){
            interpreter.send({"target" : "sfm.sales.popup", "name" : "sfm.event.sales.popup","type" : "","data" : "","origin" : ""},{"delay" : 0, "sendId" : ""});                  
            e.returnValue = "Really?";
            return e.returnValue;
        }
        $("#salesPage").show();
]]>
    </script>
    </onentry>

the associated state is defined as follows

<state id="sfm.sales.popup">

The issue is that the target URI sfm.sales.popup doesn't pass the Daring Fireball URL parser. The intersection of valid DF URL and valid URI is www.* No valid URI (id attribute) can contain a colon or a forward slash. A URL that passes the DF match either contains a colon, ends in a forward slash, or starts with www.

jbeard4 commented 7 years ago

<send> is used for sending events. Why specify a state id as a target of send?

jbeard4 commented 7 years ago

It's also not clear to me that the value of a state id attribute must be a URI.

jchimene commented 7 years ago

Thanks for your time. I'll close the ticket.