Bug 1323713 - fix prettify CSS error when encountering extra closing brace;r=tromey

MozReview-Commit-ID: 5TAxEP5561K
This commit is contained in:
Julian Descottes
2017-01-10 22:19:47 +01:00
parent 310235f997
commit 5323d54c49
2 changed files with 18 additions and 1 deletions

View File

@@ -284,7 +284,11 @@ function prettifyCSS(text, ruleCount) {
}
if (isCloseBrace) {
indent = TAB_CHARS.repeat(--indentLevel);
// Even if the stylesheet contains extra closing braces, the indent level should
// remain > 0.
indentLevel = Math.max(0, indentLevel - 1);
indent = TAB_CHARS.repeat(indentLevel);
result = result + indent + "}";
}