JS: Tolerate TypeScript files being requested out of order

This commit is contained in:
Asger F
2023-09-08 10:11:09 +02:00
parent a2659eecfb
commit e08a873829

View File

@@ -361,7 +361,10 @@ function handleParseCommand(command: ParseCommand, checkPending = true) {
let filename = command.filename;
let expectedFilename = state.pendingFiles[state.pendingFileIndex];
if (expectedFilename !== filename && checkPending) {
throw new Error("File requested out of order. Expected '" + expectedFilename + "' but got '" + filename + "'");
// File was requested out of order. This happens in rare cases because the Java process decided against extracting it,
// for example because it was too large. Just recover and accept that some work was wasted.
state.pendingResponse = null;
state.pendingFileIndex = state.pendingFiles.indexOf(filename);
}
++state.pendingFileIndex;
let response = state.pendingResponse || extractFile(command.filename);