Bug 535126 - Fix text flushing and EOF bugs in script data states in the HTML5 tokenizer. rs=sicking.

--HG--
extra : rebase_source : 4f62b7ce50fcd4e6224b628f159075a01adf28d3
This commit is contained in:
Henri Sivonen 2009-12-16 15:35:34 +02:00
Родитель e4f44ea018
Коммит 55e6c4be33
2 изменённых файлов: 21 добавлений и 23 удалений

Просмотреть файл

@ -441,10 +441,9 @@ nsHtml5Tokenizer::tokenizeBuffer(nsHtml5UTF16Buffer* buffer)
case NS_HTML5TOKENIZER_SCRIPT_DATA_ESCAPE_START_DASH:
case NS_HTML5TOKENIZER_SCRIPT_DATA_ESCAPED_DASH:
case NS_HTML5TOKENIZER_SCRIPT_DATA_ESCAPED_DASH_DASH:
case NS_HTML5TOKENIZER_SCRIPT_DATA_ESCAPED_LESS_THAN:
case NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPE_START:
case NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPED:
case NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN:
case NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:
case NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPED_DASH:
case NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:
case NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPE_END: {
@ -2658,7 +2657,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
case '<': {
flushChars(buf, pos);
returnState = state;
state = NS_HTML5TOKENIZER_SCRIPT_DATA_LESS_THAN_SIGN_STATE;
state = NS_HTML5TOKENIZER_SCRIPT_DATA_LESS_THAN_SIGN;
goto scriptdataloop_end;
}
case '\0': {
@ -2679,7 +2678,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
}
scriptdataloop_end: ;
}
case NS_HTML5TOKENIZER_SCRIPT_DATA_LESS_THAN_SIGN_STATE: {
case NS_HTML5TOKENIZER_SCRIPT_DATA_LESS_THAN_SIGN: {
for (; ; ) {
if (++pos == endPos) {
goto stateloop_end;
@ -2761,7 +2760,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
}
case '<': {
flushChars(buf, pos);
state = NS_HTML5TOKENIZER_SCRIPT_DATA_ESCAPED_LESS_THAN;
state = NS_HTML5TOKENIZER_SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;
goto stateloop;
}
case '>': {
@ -2806,7 +2805,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
}
case '<': {
flushChars(buf, pos);
state = NS_HTML5TOKENIZER_SCRIPT_DATA_ESCAPED_LESS_THAN;
state = NS_HTML5TOKENIZER_SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;
goto stateloop;
}
case '\0': {
@ -2840,7 +2839,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
}
case '<': {
flushChars(buf, pos);
state = NS_HTML5TOKENIZER_SCRIPT_DATA_ESCAPED_LESS_THAN;
state = NS_HTML5TOKENIZER_SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;
goto scriptdataescapeddashloop_end;
}
case '\0': {
@ -2864,7 +2863,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
}
scriptdataescapeddashloop_end: ;
}
case NS_HTML5TOKENIZER_SCRIPT_DATA_ESCAPED_LESS_THAN: {
case NS_HTML5TOKENIZER_SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN: {
for (; ; ) {
if (++pos == endPos) {
goto stateloop_end;
@ -2959,8 +2958,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
goto scriptdatadoubleescapedloop_end;
}
case '<': {
flushChars(buf, pos);
state = NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN;
state = NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN;
goto stateloop;
}
case '\0': {
@ -2993,8 +2991,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
goto scriptdatadoubleescapeddashloop_end;
}
case '<': {
flushChars(buf, pos);
state = NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN;
state = NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN;
goto stateloop;
}
case '\0': {
@ -3029,7 +3026,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
continue;
}
case '<': {
state = NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN;
state = NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN;
goto scriptdatadoubleescapeddashdashloop_end;
}
case '>': {
@ -3057,7 +3054,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
}
scriptdatadoubleescapeddashdashloop_end: ;
}
case NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN: {
case NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN: {
for (; ; ) {
if (++pos == endPos) {
goto stateloop_end;
@ -3192,7 +3189,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
case '<': {
flushChars(buf, pos);
returnState = state;
state = NS_HTML5TOKENIZER_RAWTEXT_RCDATA_LESS_THAN_SIGN_STATE;
state = NS_HTML5TOKENIZER_RAWTEXT_RCDATA_LESS_THAN_SIGN;
goto stateloop;
}
case '\0': {
@ -3227,7 +3224,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
case '<': {
flushChars(buf, pos);
returnState = state;
state = NS_HTML5TOKENIZER_RAWTEXT_RCDATA_LESS_THAN_SIGN_STATE;
state = NS_HTML5TOKENIZER_RAWTEXT_RCDATA_LESS_THAN_SIGN;
goto rawtextloop_end;
}
case '\0': {
@ -3248,7 +3245,7 @@ nsHtml5Tokenizer::stateLoop(PRInt32 state, PRUnichar c, PRInt32 pos, PRUnichar*
}
rawtextloop_end: ;
}
case NS_HTML5TOKENIZER_RAWTEXT_RCDATA_LESS_THAN_SIGN_STATE: {
case NS_HTML5TOKENIZER_RAWTEXT_RCDATA_LESS_THAN_SIGN: {
for (; ; ) {
if (++pos == endPos) {
goto stateloop_end;
@ -3451,7 +3448,8 @@ nsHtml5Tokenizer::eof()
PRInt32 returnState = returnStateSave;
eofloop: for (; ; ) {
switch(state) {
case NS_HTML5TOKENIZER_SCRIPT_DATA_LESS_THAN_SIGN_STATE: {
case NS_HTML5TOKENIZER_SCRIPT_DATA_LESS_THAN_SIGN:
case NS_HTML5TOKENIZER_SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN: {
tokenHandler->characters(nsHtml5Tokenizer::LT_GT, 0, 1);
goto eofloop_end;
}
@ -3460,7 +3458,7 @@ nsHtml5Tokenizer::eof()
tokenHandler->characters(nsHtml5Tokenizer::LT_GT, 0, 1);
goto eofloop_end;
}
case NS_HTML5TOKENIZER_RAWTEXT_RCDATA_LESS_THAN_SIGN_STATE: {
case NS_HTML5TOKENIZER_RAWTEXT_RCDATA_LESS_THAN_SIGN: {
tokenHandler->characters(nsHtml5Tokenizer::LT_GT, 0, 1);
goto eofloop_end;
}

Просмотреть файл

@ -345,7 +345,7 @@ jArray<PRUnichar,PRInt32> nsHtml5Tokenizer::NOFRAMES_ARR = 0;
#define NS_HTML5TOKENIZER_CDATA_SECTION 50
#define NS_HTML5TOKENIZER_CDATA_RSQB 51
#define NS_HTML5TOKENIZER_CDATA_RSQB_RSQB 52
#define NS_HTML5TOKENIZER_SCRIPT_DATA_LESS_THAN_SIGN_STATE 53
#define NS_HTML5TOKENIZER_SCRIPT_DATA_LESS_THAN_SIGN 53
#define NS_HTML5TOKENIZER_SCRIPT_DATA_ESCAPE_START 54
#define NS_HTML5TOKENIZER_SCRIPT_DATA_ESCAPE_START_DASH 55
#define NS_HTML5TOKENIZER_SCRIPT_DATA_ESCAPED 56
@ -353,14 +353,14 @@ jArray<PRUnichar,PRInt32> nsHtml5Tokenizer::NOFRAMES_ARR = 0;
#define NS_HTML5TOKENIZER_SCRIPT_DATA_ESCAPED_DASH_DASH 58
#define NS_HTML5TOKENIZER_BOGUS_COMMENT_HYPHEN 59
#define NS_HTML5TOKENIZER_RAWTEXT 60
#define NS_HTML5TOKENIZER_RAWTEXT_RCDATA_LESS_THAN_SIGN_STATE 61
#define NS_HTML5TOKENIZER_RAWTEXT_RCDATA_LESS_THAN_SIGN 61
#define NS_HTML5TOKENIZER_AFTER_DOCTYPE_PUBLIC_KEYWORD 62
#define NS_HTML5TOKENIZER_BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS 63
#define NS_HTML5TOKENIZER_AFTER_DOCTYPE_SYSTEM_KEYWORD 64
#define NS_HTML5TOKENIZER_SCRIPT_DATA_ESCAPED_LESS_THAN 65
#define NS_HTML5TOKENIZER_SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN 65
#define NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPE_START 66
#define NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPED 67
#define NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN 68
#define NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN 68
#define NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPED_DASH 69
#define NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH 70
#define NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPE_END 71