Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #12137: Webview that not implements a WebviewPanelSerializer should not restore automatically after reconnecting. #12138

Merged
merged 1 commit into from
Feb 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 9 additions & 16 deletions packages/plugin-ext/src/hosted/browser/hosted-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -778,22 +778,15 @@ export class HostedPluginSupport {
protected async restoreWebview(webview: WebviewWidget): Promise<void> {
await this.activateByEvent(`onWebviewPanel:${webview.viewType}`);
const restore = this.webviewRevivers.get(webview.viewType);
if (!restore) {
/* eslint-disable max-len */
webview.setHTML(this.getDeserializationFailedContents(`
<p>The extension providing '${webview.viewType}' view is not capable of restoring it.</p>
<p>Want to help fix this? Please inform the extension developer to register a <a href="https://code.visualstudio.com/api/extension-guides/webview#serialization">reviver</a>.</p>
`));
/* 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);
}
}
}

Expand Down