Cancel resource load when the webview is disposed of
This commit is contained in:
parent
d5b46d6e56
commit
923fbc8c2a
1 changed files with 6 additions and 2 deletions
|
@ -5,7 +5,7 @@
|
|||
|
||||
import { IMouseWheelEvent } from 'vs/base/browser/mouseEvent';
|
||||
import { streamToBuffer } from 'vs/base/common/buffer';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
@ -88,6 +88,8 @@ export abstract class BaseWebview<T extends HTMLElement> extends Disposable {
|
|||
|
||||
private readonly _portMappingManager: WebviewPortMappingManager;
|
||||
|
||||
private readonly _resourceLoadingCts = this._register(new CancellationTokenSource());
|
||||
|
||||
private readonly _fileService: IFileService;
|
||||
private readonly _logService: ILogService;
|
||||
private readonly _remoteAuthorityResolverService: IRemoteAuthorityResolverService;
|
||||
|
@ -228,6 +230,8 @@ export abstract class BaseWebview<T extends HTMLElement> extends Disposable {
|
|||
|
||||
this._onDidDispose.fire();
|
||||
|
||||
this._resourceLoadingCts.dispose(true);
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
@ -470,7 +474,7 @@ export abstract class BaseWebview<T extends HTMLElement> extends Disposable {
|
|||
extensionLocation: this.extension?.location,
|
||||
roots: this.content.options.localResourceRoots || [],
|
||||
remoteConnectionData,
|
||||
}, this._fileService, this._requestService, this._logService, CancellationToken.None); // TODO: cancellation
|
||||
}, this._fileService, this._requestService, this._logService, this._resourceLoadingCts.token);
|
||||
|
||||
switch (result.type) {
|
||||
case WebviewResourceResponse.Type.Success:
|
||||
|
|
Loading…
Reference in a new issue