Log missing csp on extension host instead of main window

This commit is contained in:
Matt Bierner
2019-08-26 15:42:04 -07:00
parent f3e9e7c3e4
commit 78879b6a81
6 changed files with 22 additions and 3 deletions

View File

@@ -271,6 +271,7 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews
}
webview.webview.state = newState;
});
input.webview.onMissingCsp((extension: ExtensionIdentifier) => this._proxy.$onMissingCsp(handle, extension.value));
}
private updateWebviewViewStates() {

View File

@@ -559,6 +559,7 @@ export interface WebviewPanelViewStateData {
export interface ExtHostWebviewsShape {
$onMessage(handle: WebviewPanelHandle, message: any): void;
$onMissingCsp(handle: WebviewPanelHandle, extensionId: string): void;
$onDidChangeWebviewPanelViewStates(newState: WebviewPanelViewStateData): void;
$onDidDisposeWebviewPanel(handle: WebviewPanelHandle): Promise<void>;
$deserializeWebviewPanel(newWebviewHandle: WebviewPanelHandle, viewType: string, title: string, state: any, position: EditorViewColumn, options: modes.IWebviewOptions & modes.IWebviewPanelOptions): Promise<void>;

View File

@@ -298,6 +298,13 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
}
}
public $onMissingCsp(
_handle: WebviewPanelHandle,
extensionId: string
): void {
console.warn(`${extensionId} created a webview without a content security policy: https://aka.ms/vscode-webview-missing-csp`);
}
public $onDidChangeWebviewPanelViewStates(newStates: WebviewPanelViewStateData): void {
const handles = Object.keys(newStates);
// Notify webviews of state changes in the following order: