* Fixed issue [#693](https://github.com/jakubpawlowicz/clean-css/issues/693) - restructuring edge case.
* Fixed issue [#711](https://github.com/jakubpawlowicz/clean-css/issues/711) - border fuzzy matching.
* Fixed issue [#714](https://github.com/jakubpawlowicz/clean-css/issues/714) - stringifying property level at rules.
+* Fixed issue [#715](https://github.com/jakubpawlowicz/clean-css/issues/715) - stack too deep in comment scan.
[3.4.8 / 2015-11-13](https://github.com/jakubpawlowicz/clean-css/compare/v3.4.7...v3.4.8)
==================
if (noComments)
return false;
- // idx can be still within last matched comment (many @import statements inside one comment)
- if (idx > lastStartIndex && idx < lastEndIndex)
- return true;
-
- comment = data.match(commentRegex);
-
- if (!comment) {
- noComments = true;
- return false;
- }
-
- // get the indexes relative to the current data chunk
- lastStartIndex = localStartIndex = comment.index;
- localEndIndex = localStartIndex + comment[0].length;
-
- // calculate the indexes relative to the full original data
- globalEndIndex = localEndIndex + lastEndIndex;
- globalStartIndex = globalEndIndex - comment[0].length;
-
- // chop off data up to and including current comment block
- data = data.substring(localEndIndex);
- lastEndIndex = globalEndIndex;
-
- // re-run scan if comment ended before the idx
- if (globalEndIndex < idx)
- return scanner(idx);
+ do {
+ // idx can be still within last matched comment (many @import statements inside one comment)
+ if (idx > lastStartIndex && idx < lastEndIndex)
+ return true;
+
+ comment = data.match(commentRegex);
+
+ if (!comment) {
+ noComments = true;
+ return false;
+ }
+
+ // get the indexes relative to the current data chunk
+ lastStartIndex = localStartIndex = comment.index;
+ localEndIndex = localStartIndex + comment[0].length;
+
+ // calculate the indexes relative to the full original data
+ globalEndIndex = localEndIndex + lastEndIndex;
+ globalStartIndex = globalEndIndex - comment[0].length;
+
+ // chop off data up to and including current comment block
+ data = data.substring(localEndIndex);
+ lastEndIndex = globalEndIndex;
+ } while (globalEndIndex < idx);
return globalEndIndex > idx && idx > globalStartIndex;
};
var optimizerContext = require('./test-helper').optimizerContext;
var lineBreak = require('os').EOL;
+function generateComments(count) {
+ var output = [];
+ var i;
+
+ for (i = 0; i < count; i++) {
+ output.push('/* */');
+ }
+
+ return output.join('');
+}
+
vows.describe('integration tests')
.addBatch(
optimizerContext('identity', {
'remote inside local after imported content': [
'@import url(test/fixtures/partials/one.css);@import url(test/fixtures/partials/remote.css);',
'.one{color:red}'
+ ],
+ 'scanning comments and stack too deep exception': [
+ generateComments(30000) + '@import url(fonts.google.com/some.css);',
+ ''
]
}, { root: process.cwd() })
)