infinite loop in javascript mode
Posted: Tue Jul 10, 2012 4:19 am
Hello,
I try to see the problem 3696 in javascript mode.
I test this problem on IE 8, Chrome 12 and firefox 13. For all browsers, the js code start an infinite loop.
Analyse done with firebug: the loop is in sgf.js line 80. Seems the problem occurs when parsing the sfg.
Stack:
parseProperties(node=Object { _children=[0], FF="1", GM="1", more...})sgf.js (ligne 81)
parseNode(parent=Object { _children=[1]})sgf.js (ligne 62)
parseTree(curnode=Object { _children=[1]})sgf.js (ligne 45)
parseTree(curnode=Object { _children=[1]})sgf.js (ligne 48)
init(sgf="(\n;\nFF[1]\nGM[1]\nSZ[19]\n...W[kg]\n;\nB[kh]\nC[RIGHT])", completeFn=null)sgf.js (ligne 36)
SgfParser()sgf.js (ligne 15)
loadSgf(cfg=Object { progressiveLoad=false, markCurrent=true, markVariations=false, more...}, completeFn=function())player.js (ligne 365)
init(containerId="player-container", configuration=Object { dbId=3696, userId=5702, commentsURL="/util/jsoncomments.php?", more...}, callback=undefined)goproblems.js (ligne 158)
Player(containerId="player-container", configuration=Object { dbId=3696, userId=5702, commentsURL="/util/jsoncomments.php?", more...}, callback=undefined)goproblems.js (ligne 33)
(?)()3696?p...8235664 (ligne 311)
f(b=Document 3696?psetid=8235664, f=[function()])jquery.min.js (ligne 2)
f(b=Document 3696?psetid=8235664, c=[function()])jquery.min.js (ligne 2)
f(a=undefined)jquery.min.js (ligne 2)
f()jquery.min.js (ligne 2)[/list]
Sfg:
"(
;
FF[1]
GM[1]
SZ[19]
AP[Jago:Version 4.53]
AB[ij][ki][lj][lk][kk][jh][jj][ii]
AW[jk][ik][hk][jl][kl][ll][ml][mk][hj][hi][hh][ih][ig][nj][nh][ng][mf][lf][jf][nk][mg][if][ni][kf]
GN[david02]
;
B[lh]
;
W[mi]
;
B[li]
;
W[kg]
;
B[kh]
C[RIGHT])"
Actually, the script loop with the char from 192 to 194 = "\nB["
The code involve in the loop is the if at line 92 : if (this.firstNode && (key === "B" || key == "W")) {
this.firstNode=true, key="B" and this.index=194.
The line 105, this.index-=2;, restart the loop with index at 192.
There is a recent comment/modification at line 108 (maybe the key of the problem is there ):
// Maybe I should break? to force a new node?
// Matias Niklison, 12/6/2012.
continue;
Is sgf.js an original code from EidoGo or was it modified for goproblems ? In first case, I suppose the problem should reported to eidogo.
I try to see the problem 3696 in javascript mode.
I test this problem on IE 8, Chrome 12 and firefox 13. For all browsers, the js code start an infinite loop.
Analyse done with firebug: the loop is in sgf.js line 80. Seems the problem occurs when parsing the sfg.
Stack:
parseProperties(node=Object { _children=[0], FF="1", GM="1", more...})sgf.js (ligne 81)
parseNode(parent=Object { _children=[1]})sgf.js (ligne 62)
parseTree(curnode=Object { _children=[1]})sgf.js (ligne 45)
parseTree(curnode=Object { _children=[1]})sgf.js (ligne 48)
init(sgf="(\n;\nFF[1]\nGM[1]\nSZ[19]\n...W[kg]\n;\nB[kh]\nC[RIGHT])", completeFn=null)sgf.js (ligne 36)
SgfParser()sgf.js (ligne 15)
loadSgf(cfg=Object { progressiveLoad=false, markCurrent=true, markVariations=false, more...}, completeFn=function())player.js (ligne 365)
init(containerId="player-container", configuration=Object { dbId=3696, userId=5702, commentsURL="/util/jsoncomments.php?", more...}, callback=undefined)goproblems.js (ligne 158)
Player(containerId="player-container", configuration=Object { dbId=3696, userId=5702, commentsURL="/util/jsoncomments.php?", more...}, callback=undefined)goproblems.js (ligne 33)
(?)()3696?p...8235664 (ligne 311)
f(b=Document 3696?psetid=8235664, f=[function()])jquery.min.js (ligne 2)
f(b=Document 3696?psetid=8235664, c=[function()])jquery.min.js (ligne 2)
f(a=undefined)jquery.min.js (ligne 2)
f()jquery.min.js (ligne 2)[/list]
Sfg:
"(
;
FF[1]
GM[1]
SZ[19]
AP[Jago:Version 4.53]
AB[ij][ki][lj][lk][kk][jh][jj][ii]
AW[jk][ik][hk][jl][kl][ll][ml][mk][hj][hi][hh][ih][ig][nj][nh][ng][mf][lf][jf][nk][mg][if][ni][kf]
GN[david02]
;
B[lh]
;
W[mi]
;
B[li]
;
W[kg]
;
B[kh]
C[RIGHT])"
Actually, the script loop with the char from 192 to 194 = "\nB["
The code involve in the loop is the if at line 92 : if (this.firstNode && (key === "B" || key == "W")) {
this.firstNode=true, key="B" and this.index=194.
The line 105, this.index-=2;, restart the loop with index at 192.
There is a recent comment/modification at line 108 (maybe the key of the problem is there ):
// Maybe I should break? to force a new node?
// Matias Niklison, 12/6/2012.
continue;
Is sgf.js an original code from EidoGo or was it modified for goproblems ? In first case, I suppose the problem should reported to eidogo.