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

Log when encountering invalid json in vscode-context #156485

Merged
merged 1 commit into from Jul 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -1070,8 +1070,10 @@
}

try {
context = { ...JSON.parse(el.getAttribute('data-vscode-context')), ...context };
} catch {}
context = { ...JSON.parse(el.dataset.vscodeContext), ...context };
} catch (e) {
console.error(`Error parsing 'data-vscode-context' as json`, el, e)
}

el = el.parentElement;
}
Expand Down
8 changes: 5 additions & 3 deletions src/vs/workbench/contrib/webview/browser/pre/index.html
Expand Up @@ -5,7 +5,7 @@
<meta charset="UTF-8">

<meta http-equiv="Content-Security-Policy"
content="default-src 'none'; script-src 'sha256-31a+qtoOhPC136ibtip6gpqSiW72yo48kmtxyi0Qptc=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
content="default-src 'none'; script-src 'sha256-JpX/ganPoxpavjxWCz9DUZgwVZ59o2lwSYTQrziPsdU=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">

<!-- Disable pinch zooming -->
<meta name="viewport"
Expand Down Expand Up @@ -1071,8 +1071,10 @@
}

try {
context = { ...JSON.parse(el.getAttribute('data-vscode-context')), ...context };
} catch {}
context = { ...JSON.parse(el.dataset.vscodeContext), ...context };
} catch (e) {
console.error(`Error parsing 'data-vscode-context' as json`, el, e)
}

el = el.parentElement;
}
Expand Down