Skip to content

Commit

Permalink
Try serializing webviews even if they have not called setState
Browse files Browse the repository at this point in the history
Fixes #50752
  • Loading branch information
mjbvz committed May 29, 2018
1 parent eab7f1e commit 6e81adc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/vs/workbench/api/electron-browser/mainThreadWebview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,13 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv
this._webviews.set(handle, webview);
webview._events = this.createWebviewEventDelegate(handle);

let state;
try {
state = JSON.parse(webview.state.state);
} catch {
state = {};
let state = undefined;
if (webview.state.state) {
try {
state = JSON.parse(webview.state.state);
} catch {
// noop
}
}

return this._proxy.$deserializeWebviewPanel(handle, webview.state.viewType, webview.getTitle(), state, webview.position, webview.options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class WebviewEditorInputFactory implements IEditorInputFactory {
input: WebviewEditorInput
): string {
// Has no state, don't revive
if (!input.state || !input.webviewState) {
if (!input.state) {
return null;
}

Expand Down

0 comments on commit 6e81adc

Please sign in to comment.