diff --git a/packages/plugin-ext/src/hosted/browser/hosted-plugin.ts b/packages/plugin-ext/src/hosted/browser/hosted-plugin.ts index 4433013af9f36..7ad4d14d07dde 100644 --- a/packages/plugin-ext/src/hosted/browser/hosted-plugin.ts +++ b/packages/plugin-ext/src/hosted/browser/hosted-plugin.ts @@ -778,22 +778,15 @@ export class HostedPluginSupport { protected async restoreWebview(webview: WebviewWidget): Promise { await this.activateByEvent(`onWebviewPanel:${webview.viewType}`); const restore = this.webviewRevivers.get(webview.viewType); - if (!restore) { - /* eslint-disable max-len */ - webview.setHTML(this.getDeserializationFailedContents(` -

The extension providing '${webview.viewType}' view is not capable of restoring it.

-

Want to help fix this? Please inform the extension developer to register a reviver.

- `)); - /* eslint-enable max-len */ - return; - } - try { - await restore(webview); - } catch (e) { - webview.setHTML(this.getDeserializationFailedContents(` - An error occurred while restoring '${webview.viewType}' view. Please check logs. - `)); - console.error('Failed to restore the webview', e); + if (restore) { + try { + await restore(webview); + } catch (e) { + webview.setHTML(this.getDeserializationFailedContents(` + An error occurred while restoring '${webview.viewType}' view. Please check logs. + `)); + console.error('Failed to restore the webview', e); + } } }