|
@ -91,6 +91,11 @@ export abstract class WebviewViewBase implements |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private readonly _cspNonce = getNonce(); |
|
|
|
|
|
protected get cspNonce(): string { |
|
|
|
|
|
return this._cspNonce; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
protected onInitializing?(): Disposable[] | undefined; |
|
|
protected onInitializing?(): Disposable[] | undefined; |
|
|
protected onReady?(): void; |
|
|
protected onReady?(): void; |
|
|
protected onMessageReceived?(e: IpcMessage): void; |
|
|
protected onMessageReceived?(e: IpcMessage): void; |
|
@ -258,7 +263,6 @@ export abstract class WebviewViewBase implements |
|
|
]); |
|
|
]); |
|
|
|
|
|
|
|
|
const cspSource = webview.cspSource; |
|
|
const cspSource = webview.cspSource; |
|
|
const cspNonce = getNonce(); |
|
|
|
|
|
|
|
|
|
|
|
const root = webview.asWebviewUri(this.container.context.extensionUri).toString(); |
|
|
const root = webview.asWebviewUri(this.container.context.extensionUri).toString(); |
|
|
const webRoot = webview.asWebviewUri(webRootUri).toString(); |
|
|
const webRoot = webview.asWebviewUri(webRootUri).toString(); |
|
@ -274,9 +278,9 @@ export abstract class WebviewViewBase implements |
|
|
case 'endOfBody': |
|
|
case 'endOfBody': |
|
|
return `${ |
|
|
return `${ |
|
|
bootstrap != null |
|
|
bootstrap != null |
|
|
? `<script type="text/javascript" nonce="${cspNonce}">window.bootstrap=${JSON.stringify( |
|
|
|
|
|
bootstrap, |
|
|
|
|
|
)};</script>`
|
|
|
|
|
|
|
|
|
? `<script type="text/javascript" nonce="${ |
|
|
|
|
|
this.cspNonce |
|
|
|
|
|
}">window.bootstrap=${JSON.stringify(bootstrap)};</script>`
|
|
|
: '' |
|
|
: '' |
|
|
}${endOfBody ?? ''}`;
|
|
|
}${endOfBody ?? ''}`;
|
|
|
case 'placement': |
|
|
case 'placement': |
|
@ -284,7 +288,7 @@ export abstract class WebviewViewBase implements |
|
|
case 'cspSource': |
|
|
case 'cspSource': |
|
|
return cspSource; |
|
|
return cspSource; |
|
|
case 'cspNonce': |
|
|
case 'cspNonce': |
|
|
return cspNonce; |
|
|
|
|
|
|
|
|
return this.cspNonce; |
|
|
case 'root': |
|
|
case 'root': |
|
|
return root; |
|
|
return root; |
|
|
case 'webroot': |
|
|
case 'webroot': |
|
|