mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 17:19:48 +01:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user