Skip to content

Commit

Permalink
chore: fixed webview errors in tests (#724)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnstonCode authored Nov 9, 2019
1 parent 1bc1d9e commit 0bac1a3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@
"@semantic-release/git": "^7.0.16",
"@types/glob": "^7.1.1",
"@types/mocha": "^5.2.7",
"@types/node": "8.9.5",
"@types/node": "^12.11.7",
"@types/semver": "^6.0.0",
"@types/tmp": "0.1.0",
"@types/vscode": "1.26.0",
"@types/vscode": "1.40.0",
"@types/xml2js": "^0.4.4",
"@typescript-eslint/eslint-plugin": "^2.5.0",
"@typescript-eslint/parser": "^2.5.0",
Expand All @@ -85,8 +85,7 @@
},
"greenkeeper": {
"ignore": [
"@types/node",
"@types/vscode"
"@types/node"
]
},
"contributes": {
Expand Down
12 changes: 10 additions & 2 deletions src/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ async function showCommitInput(message?: string, filePaths?: string[]) {
}
);

const styleUri = Uri.file(
const stylePathOnDisk = Uri.file(
path.join(__dirname, "..", "css", "commit-message.css")
).with({ scheme: "vscode-resource" });
);
const styleUri = panel.webview.asWebviewUri(stylePathOnDisk);

let beforeForm = "";
if (filePaths && filePaths.length) {
Expand All @@ -72,6 +73,13 @@ async function showCommitInput(message?: string, filePaths?: string[]) {
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--
Use a content security policy to only allow loading images from https or from our extension directory,
and only allow scripts that have a specific nonce.
-->
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src ${panel.webview.cspSource} https:; script-src ${panel.webview.cspSource}; style-src ${panel.webview.cspSource};">
<title>Commit Message</title>
<link rel="stylesheet" href="${styleUri}">
</head>
Expand Down

0 comments on commit 0bac1a3

Please sign in to comment.