@@ -92,8 +92,11 @@ export class GitGraphView implements vscode.Disposable {
92
92
retainContextWhenHidden : config . retainContextWhenHidden
93
93
} ) ;
94
94
this . panel . iconPath = config . tabIconColourTheme === TabIconColourTheme . Colour
95
- ? this . getUri ( 'resources' , 'webview-icon.svg' )
96
- : { light : this . getUri ( 'resources' , 'webview-icon-light.svg' ) , dark : this . getUri ( 'resources' , 'webview-icon-dark.svg' ) } ;
95
+ ? this . getResourcesUri ( 'webview-icon.svg' )
96
+ : {
97
+ light : this . getResourcesUri ( 'webview-icon-light.svg' ) ,
98
+ dark : this . getResourcesUri ( 'webview-icon-dark.svg' )
99
+ } ;
97
100
98
101
// Dispose this Git Graph View when the Webview is disposed
99
102
this . panel . onDidDispose ( ( ) => this . dispose ( ) , null , this . disposables ) ;
@@ -660,7 +663,7 @@ export class GitGraphView implements vscode.Disposable {
660
663
<html lang="en">
661
664
<head>
662
665
<meta charset="UTF-8">
663
- <meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src vscode-resource: 'unsafe-inline'; script-src vscode-resource: 'nonce-${ nonce } '; img-src data:;">
666
+ <meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src ${ this . panel . webview . cspSource } 'unsafe-inline'; script-src ${ this . panel . webview . cspSource } 'nonce-${ nonce } '; img-src data:;">
664
667
<meta name="viewport" content="width=device-width, initial-scale=1.0">
665
668
<link rel="stylesheet" type="text/css" href="${ this . getMediaUri ( 'out.min.css' ) } ">
666
669
<title>Git Graph</title>
@@ -674,18 +677,27 @@ export class GitGraphView implements vscode.Disposable {
674
677
/* URI Manipulation Methods */
675
678
676
679
/**
677
- * Get a URI for a media file included in the extension.
680
+ * Get a WebviewUri for a media file included in the extension.
678
681
* @param file The file name in the `media` directory.
679
- * @returns The URI .
682
+ * @returns The WebviewUri .
680
683
*/
681
684
private getMediaUri ( file : string ) {
682
- return this . getUri ( 'media' , file ) . with ( { scheme : 'vscode-resource' } ) ;
685
+ return this . panel . webview . asWebviewUri ( this . getUri ( 'media' , file ) ) ;
683
686
}
684
687
685
688
/**
686
- * Get a URI for a file included in the extension.
689
+ * Get a File Uri for a resource file included in the extension.
690
+ * @param file The file name in the `resource` directory.
691
+ * @returns The Uri.
692
+ */
693
+ private getResourcesUri ( file : string ) {
694
+ return this . getUri ( 'resources' , file ) ;
695
+ }
696
+
697
+ /**
698
+ * Get a File Uri for a file included in the extension.
687
699
* @param pathComps The path components relative to the root directory of the extension.
688
- * @returns The URI .
700
+ * @returns The File Uri .
689
701
*/
690
702
private getUri ( ...pathComps : string [ ] ) {
691
703
return vscode . Uri . file ( path . join ( this . extensionPath , ...pathComps ) ) ;
0 commit comments