Allow cancelling webview's readFileStream (#149964)

This passes a cancellation token to `readFileStream`. This ensures we stop reading the file if the webview is disposed of
This commit is contained in:
Matt Bierner
2022-05-19 11:50:28 -07:00
committed by GitHub
parent 2c9c8e6770
commit 92b6c1be54
@@ -65,7 +65,7 @@ export async function loadLocalResource(
const mime = getWebviewContentMimeType(requestUri); // Use the original path for the mime
try {
const result = await fileService.readFileStream(resourceToLoad, { etag: options.ifNoneMatch });
const result = await fileService.readFileStream(resourceToLoad, { etag: options.ifNoneMatch }, token);
return new WebviewResourceResponse.StreamSuccess(result.value, result.etag, result.mtime, mime);
} catch (err) {
if (err instanceof FileOperationError) {