Skip to content

Commit c01a3a7

Browse files
committed
Use clearer name for csp webview element
microsoft#76489
1 parent f963c9a commit c01a3a7

14 files changed

Lines changed: 18 additions & 18 deletions

File tree

extensions/markdown-language-features/src/features/preview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ export class MarkdownPreview extends Disposable {
424424
const self = this;
425425
const resourceProvider: WebviewResourceProvider = {
426426
toWebviewResource: (resource) => this.editor.webview.toWebviewResource(resource),
427-
get cspRule() { return self.editor.webview.cspRule; }
427+
get cspSource() { return self.editor.webview.cspSource; }
428428
};
429429
const content = await this._contentProvider.provideTextDocumentContent(document, resourceProvider, this._previewConfigurations, this.line, this.state);
430430
// Another call to `doUpdate` may have happened.

extensions/markdown-language-features/src/features/previewContentProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ export class MarkdownContentProvider {
200200
resource: vscode.Uri,
201201
nonce: string
202202
): string {
203-
const rule = provider.cspRule;
203+
const rule = provider.cspSource;
204204
switch (this.cspArbiter.getSecurityLevelForResource(resource)) {
205205
case MarkdownPreviewSecurityLevel.AllowInsecureContent:
206206
return `<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src 'self' ${rule} http: https: data:; media-src 'self' ${rule} http: https: data:; script-src 'nonce-${nonce}'; style-src 'self' ${rule} 'unsafe-inline' http: https: data:; font-src 'self' ${rule} http: https: data:;">`;

extensions/markdown-language-features/src/util/resources.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ import * as vscode from 'vscode';
88
export interface WebviewResourceProvider {
99
toWebviewResource(resource: vscode.Uri): vscode.Uri;
1010

11-
readonly cspRule: string;
11+
readonly cspSource: string;
1212
}

src/vs/platform/environment/common/environment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,5 +172,5 @@ export interface IEnvironmentService {
172172

173173
webviewEndpoint?: string;
174174
readonly webviewResourceRoot: string;
175-
readonly webviewCspRule: string;
175+
readonly webviewCspSource: string;
176176
}

src/vs/platform/environment/node/environmentService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ export class EnvironmentService implements IEnvironmentService {
279279
get driverVerbose(): boolean { return !!this._args['driver-verbose']; }
280280

281281
readonly webviewResourceRoot = 'vscode-resource:{{resource}}';
282-
readonly webviewCspRule = 'vscode-resource:';
282+
readonly webviewCspSource = 'vscode-resource:';
283283

284284
constructor(private _args: ParsedArgs, private _execPath: string) {
285285
if (!process.env['VSCODE_LOGS']) {

src/vs/vscode.proposed.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1586,7 +1586,7 @@ declare module 'vscode' {
15861586
/**
15871587
* Content security policy rule for webview resources.
15881588
*/
1589-
readonly cspRule: string;
1589+
readonly cspSource: string;
15901590
}
15911591

15921592
//#endregion

src/vs/workbench/api/common/extHost.protocol.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export interface IEnvironment {
6060
globalStorageHome: URI;
6161
userHome: URI;
6262
webviewResourceRoot: string;
63-
webviewCspRule: string;
63+
webviewCspSource: string;
6464
}
6565

6666
export interface IStaticWorkspaceData {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ export class ExtHostEditorInsets implements ExtHostEditorInsetsShape {
6969
return toWebviewResource(that._initData, this._uuid, resource);
7070
}
7171

72-
get cspRule(): string {
73-
return that._initData.webviewCspRule;
72+
get cspSource(): string {
73+
return that._initData.webviewCspSource;
7474
}
7575

7676
set options(value: vscode.WebviewOptions) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ export class ExtHostWebview implements vscode.Webview {
4141
return toWebviewResource(this._initData, this._uuid, resource);
4242
}
4343

44-
public get cspRule(): string {
45-
return this._initData.webviewCspRule;
44+
public get cspSource(): string {
45+
return this._initData.webviewCspSource;
4646
}
4747

4848
public get html(): string {

src/vs/workbench/api/common/shared/webview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as vscode from 'vscode';
88

99
export interface WebviewInitData {
1010
readonly webviewResourceRoot: string;
11-
readonly webviewCspRule: string;
11+
readonly webviewCspSource: string;
1212
}
1313

1414
export function toWebviewResource(

0 commit comments

Comments
 (0)