Skip to content

Commit f83bca2

Browse files
committed
Improvements to micro-crawler, added new test site
1 parent cd4cb69 commit f83bca2

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/Wsm.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ function WsmNode(id) // {{{
230230
this.toDot = function() // {{{
231231
{
232232
var out = "";
233-
out += this.m_id + " [shape=circ,label=\"" + this.m_id + "\"]; ## ";
233+
out += this.m_id + " [shape=circle,label=\"" + this.m_id + "\"]; ## ";
234234
for (var i = 0; i < this.m_animationSteps.length; i++)
235235
{
236236
if (i > 0)
@@ -366,7 +366,7 @@ function WsmEdge(id) // {{{
366366
this.toDot = function(source_id) // {{{
367367
{
368368
var out = "";
369-
out += source_id + " -> " + this.m_destination + " [label=\"" + this.m_contents + "\"]; ##";
369+
out += source_id + " -> " + this.m_destination + " [label=\"" + this.m_contents + "\"]; ## ";
370370
for (var i = 0; i < this.m_animationSteps.length; i++)
371371
{
372372
if (i > 0)
@@ -752,13 +752,20 @@ function WebStateMachine() // {{{
752752
if (this.m_expectedNextNodeId !== null)
753753
{
754754
var nfd = this.getNodeFromDom(dom);
755+
if (nfd === null)
756+
{
757+
// Not much to do apart from warning of the discrepancy
758+
console.error("Sanity check fail: according to computed path, expected node ID was " + this.m_expectedNextNodeId + "; we are rather in a NEW node");
759+
return;
760+
}
755761
var obtained_id = nfd.getId();
756762
// Sanity check: make sure that the node we are supposed to land
757763
// is indeed the one we are in
758764
if (this.m_expectedNextNodeId != obtained_id)
759765
{
760766
// Not much to do apart from warning of the discrepancy
761767
console.error("Sanity check fail: according to computed path, expected node ID was " + this.m_expectedNextNodeId + "; we are rather in node " + obtained_id);
768+
return;
762769
}
763770
}
764771
if (this.nodesEqual(this.m_domTree, dom))
@@ -927,8 +934,8 @@ function WebStateMachine() // {{{
927934
}
928935
}
929936
// By convention, node 0 never exists and node 1 is the initial state
930-
out += " 0 [shape=none]; ## -1\n";
931-
out += " 0 -> 1; ## -1\n";
937+
out += " 0 [shape=none,label=\"\"]; ## 0\n";
938+
out += " 0 -> 1; ## 0\n";
932939
out += "}";
933940
return out;
934941
}; // }}}

0 commit comments

Comments
 (0)