Merge from vscode a4177f50c475fc0fa278a78235e3bee9ffdec781 (#8649)

* Merge from vscode a4177f50c475fc0fa278a78235e3bee9ffdec781

* distro

* fix tests
This commit is contained in:
Anthony Dresser
2019-12-11 22:42:23 -08:00
committed by GitHub
parent 82974a2135
commit 4ba6a979ba
280 changed files with 10898 additions and 14231 deletions

View File

@@ -728,7 +728,7 @@ var AMDLoader;
var result = compileWrapper.apply(this.exports, args);
// cached data aftermath
that._handleCachedData(script, scriptSource, cachedDataPath, !options.cachedData, moduleManager);
that._verifyCachedData(script, scriptSource, cachedDataPath, hashData);
that._verifyCachedData(script, scriptSource, cachedDataPath, hashData, moduleManager);
return result;
};
};
@@ -775,7 +775,7 @@ var AMDLoader;
var scriptOpts = { filename: vmScriptPathOrUri_1, cachedData: cachedData };
var script = _this._createAndEvalScript(moduleManager, scriptSource, scriptOpts, callback, errorback);
_this._handleCachedData(script, scriptSource, cachedDataPath_1, wantsCachedData_1 && !cachedData, moduleManager);
_this._verifyCachedData(script, scriptSource, cachedDataPath_1, hashData);
_this._verifyCachedData(script, scriptSource, cachedDataPath_1, hashData, moduleManager);
});
}
};
@@ -906,7 +906,7 @@ var AMDLoader;
});
}
};
NodeScriptLoader.prototype._verifyCachedData = function (script, scriptSource, cachedDataPath, hashData) {
NodeScriptLoader.prototype._verifyCachedData = function (script, scriptSource, cachedDataPath, hashData, moduleManager) {
var _this = this;
if (!hashData) {
// nothing to do
@@ -922,8 +922,8 @@ var AMDLoader;
// for violations of this contract.
var hashDataNow = _this._crypto.createHash('md5').update(scriptSource, 'utf8').digest();
if (!hashData.equals(hashDataNow)) {
console.warn("FAILED TO VERIFY CACHED DATA. Deleting '" + cachedDataPath + "' now, but a RESTART IS REQUIRED");
_this._fs.unlink(cachedDataPath, function (err) { return console.error("FAILED to unlink: '" + cachedDataPath + "'", err); });
moduleManager.getConfig().onError(new Error("FAILED TO VERIFY CACHED DATA, deleting stale '" + cachedDataPath + "' now, but a RESTART IS REQUIRED"));
_this._fs.unlink(cachedDataPath, function (err) { return moduleManager.getConfig().onError(err); });
}
}, Math.ceil(5000 * (1 + Math.random())));
};