зеркало из https://github.com/mozilla/pjs.git
Avoid recursion after parsing CSS comments. (Bug 473914) r+sr=bzbarsky
This commit is contained in:
Родитель
4dc922bd27
Коммит
4687ab4bb6
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style id="s"></style>
|
||||
<script type="text/javascript">
|
||||
|
||||
// Duplicates the string 2^n times
|
||||
function exp(s, n)
|
||||
{
|
||||
for (var i = 0; i < n; ++i)
|
||||
s += s;
|
||||
return s;
|
||||
}
|
||||
|
||||
var stylesheet = exp("/**/", 20);
|
||||
document.getElementById("s").textContent = stylesheet;
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div></div>
|
||||
</body>
|
||||
</html>
|
|
@ -27,4 +27,5 @@ load 460217-1.html
|
|||
load 466845-1.html
|
||||
HTTP(..) load 472237-1.html
|
||||
load 473720-1.html
|
||||
load 473914-1.html
|
||||
load long-url-list-stack-overflow.html
|
||||
|
|
|
@ -707,6 +707,7 @@ nsCSSScanner::EatNewline()
|
|||
PRBool
|
||||
nsCSSScanner::Next(nsCSSToken& aToken)
|
||||
{
|
||||
for (;;) { // Infinite loop so we can restart after comments.
|
||||
PRInt32 ch = Read();
|
||||
if (ch < 0) {
|
||||
return PR_FALSE;
|
||||
|
@ -776,7 +777,10 @@ nsCSSScanner::Next(nsCSSToken& aToken)
|
|||
aToken.mIdent.Append(PRUnichar(nextChar));
|
||||
return ParseCComment(aToken);
|
||||
#endif
|
||||
return SkipCComment() && Next(aToken);
|
||||
if (!SkipCComment()) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
continue; // start again at the beginning
|
||||
}
|
||||
}
|
||||
if (ch == '<') { // consume HTML comment tags
|
||||
|
@ -831,6 +835,7 @@ nsCSSScanner::Next(nsCSSToken& aToken)
|
|||
aToken.mType = eCSSToken_Symbol;
|
||||
aToken.mSymbol = ch;
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
|
|
Загрузка…
Ссылка в новой задаче