Skip to content

Commit 29d0c90

Browse files
committed
Include extension cdn in webview.cspSource
1 parent b7c340f commit 29d0c90

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/vs/workbench/api/common/extHostWebview.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import { VSBuffer } from 'vs/base/common/buffer';
77
import { Emitter, Event } from 'vs/base/common/event';
8+
import { Schemas } from 'vs/base/common/network';
89
import { URI } from 'vs/base/common/uri';
910
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
1011
import { normalizeVersion, parseVersion } from 'vs/platform/extensions/common/extensionValidator';
@@ -73,6 +74,12 @@ export class ExtHostWebview implements vscode.Webview {
7374
}
7475

7576
public get cspSource(): string {
77+
const extensionLocation = this.#extension.extensionLocation;
78+
if (extensionLocation.scheme === Schemas.https || extensionLocation.scheme === Schemas.http) {
79+
// The extension is being served up from a CDN.
80+
// Also include the CDN in the default csp.
81+
return extensionLocation + ' ' + webviewGenericCspSource;
82+
}
7683
return webviewGenericCspSource;
7784
}
7885

0 commit comments

Comments
 (0)