mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-21 09:08:53 +01:00
Make sure we dispose/track disposed webviews in webview views
Fixes #106826
This commit is contained in:
@@ -54,6 +54,8 @@ export class ExtHostWebview implements vscode.Webview {
|
||||
/* internal */ readonly _onDidDispose: Event<void> = this.#onDidDisposeEmitter.event;
|
||||
|
||||
public dispose() {
|
||||
this.#isDisposed = true;
|
||||
|
||||
this.#onDidDisposeEmitter.fire();
|
||||
|
||||
this.#onDidDisposeEmitter.dispose();
|
||||
@@ -99,8 +101,10 @@ export class ExtHostWebview implements vscode.Webview {
|
||||
this.#options = newOptions;
|
||||
}
|
||||
|
||||
public postMessage(message: any): Promise<boolean> {
|
||||
this.assertNotDisposed();
|
||||
public async postMessage(message: any): Promise<boolean> {
|
||||
if (this.#isDisposed) {
|
||||
return false;
|
||||
}
|
||||
return this.#proxy.$postMessage(this.#handle, message);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user