mirror of
https://github.com/less/less.js.git
synced 2026-04-09 03:00:20 -04:00
Found race condition that caused file not to be skipped in importOnce, leading to random exceptions. Fixes #1931
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
var importVisitor = this,
|
||||
evaldImportNode,
|
||||
inlineCSS = importNode.options.inline;
|
||||
|
||||
|
||||
if (!importNode.css || inlineCSS) {
|
||||
|
||||
try {
|
||||
@@ -61,10 +61,13 @@
|
||||
}
|
||||
|
||||
this._importer.push(importNode.getPath(), importNode.currentFileInfo, importNode.options, function (e, root, importedAtRoot, fullPath) {
|
||||
if (e && !e.filename) { e.index = importNode.index; e.filename = importNode.currentFileInfo.filename; }
|
||||
if (e && !e.filename) {
|
||||
e.index = importNode.index; e.filename = importNode.currentFileInfo.filename;
|
||||
}
|
||||
|
||||
if (!env.importMultiple) {
|
||||
if (importedAtRoot) {
|
||||
var duplicateImport = importedAtRoot || fullPath in importVisitor.recursionDetector;
|
||||
if (!env.importMultiple) {
|
||||
if (duplicateImport) {
|
||||
importNode.skip = true;
|
||||
} else {
|
||||
importNode.skip = function() {
|
||||
@@ -73,7 +76,7 @@
|
||||
}
|
||||
importVisitor.onceFileDetectionMap[fullPath] = true;
|
||||
return false;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +91,6 @@
|
||||
if (root) {
|
||||
importNode.root = root;
|
||||
importNode.importedFilename = fullPath;
|
||||
var duplicateImport = importedAtRoot || fullPath in importVisitor.recursionDetector;
|
||||
|
||||
if (!inlineCSS && (env.importMultiple || !duplicateImport)) {
|
||||
importVisitor.recursionDetector[fullPath] = true;
|
||||
@@ -139,4 +141,4 @@
|
||||
}
|
||||
};
|
||||
|
||||
})(require('./tree'));
|
||||
})(require('./tree'));
|
||||
|
||||
Reference in New Issue
Block a user