mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 19:44:25 +01:00
Add telemetry around localhost loading inside of webview
This is needed to understand which extension should enable the new port forwarding feature. Only logs that some extension is accessing localhost in a webview, not which port/resource is accessed
This commit is contained in:
@@ -506,7 +506,7 @@ export interface WebviewPanelShowOptions {
|
||||
|
||||
export interface MainThreadWebviewsShape extends IDisposable {
|
||||
$createWebviewPanel(handle: WebviewPanelHandle, viewType: string, title: string, showOptions: WebviewPanelShowOptions, options: modes.IWebviewPanelOptions & modes.IWebviewOptions, extensionId: ExtensionIdentifier, extensionLocation: UriComponents): void;
|
||||
$createWebviewCodeInset(handle: WebviewInsetHandle, symbolId: string, options: modes.IWebviewOptions, extensionLocation: UriComponents | undefined): void;
|
||||
$createWebviewCodeInset(handle: WebviewInsetHandle, symbolId: string, options: modes.IWebviewOptions, extensionId: ExtensionIdentifier | undefined, extensionLocation: UriComponents | undefined): void;
|
||||
$disposeWebview(handle: WebviewPanelHandle): void;
|
||||
$reveal(handle: WebviewPanelHandle, showOptions: WebviewPanelShowOptions): void;
|
||||
$setTitle(handle: WebviewPanelHandle, value: string): void;
|
||||
|
||||
@@ -94,7 +94,10 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews
|
||||
mainThreadShowOptions.group = viewColumnToEditorGroup(this._editorGroupService, showOptions.viewColumn);
|
||||
}
|
||||
|
||||
const webview = this._webviewService.createWebview(this.getInternalWebviewId(viewType), title, mainThreadShowOptions, reviveWebviewOptions(options), URI.revive(extensionLocation), this.createWebviewEventDelegate(handle));
|
||||
const webview = this._webviewService.createWebview(this.getInternalWebviewId(viewType), title, mainThreadShowOptions, reviveWebviewOptions(options), {
|
||||
location: URI.revive(extensionLocation),
|
||||
id: extensionId
|
||||
}, this.createWebviewEventDelegate(handle));
|
||||
webview.state = {
|
||||
viewType: viewType,
|
||||
state: undefined
|
||||
@@ -111,7 +114,13 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews
|
||||
this._telemetryService.publicLog('webviews:createWebviewPanel', { extensionId: extensionId.value });
|
||||
}
|
||||
|
||||
$createWebviewCodeInset(handle: WebviewInsetHandle, symbolId: string, options: IWebviewOptions, extensionLocation: UriComponents): void {
|
||||
$createWebviewCodeInset(
|
||||
handle: WebviewInsetHandle,
|
||||
symbolId: string,
|
||||
options: IWebviewOptions,
|
||||
extensionId: ExtensionIdentifier,
|
||||
extensionLocation: UriComponents
|
||||
): void {
|
||||
// todo@joh main is for the lack of a code-inset service
|
||||
// which we maybe wanna have... this is how it now works
|
||||
// 1) create webview element
|
||||
@@ -122,7 +131,10 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews
|
||||
WebviewElement,
|
||||
this._layoutService.getContainer(Parts.EDITOR_PART),
|
||||
{
|
||||
extensionLocation: URI.revive(extensionLocation),
|
||||
extension: {
|
||||
location: URI.revive(extensionLocation),
|
||||
id: extensionId
|
||||
},
|
||||
enableFindWidget: false,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1211,7 +1211,7 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
|
||||
const webviewHandle = Math.random();
|
||||
const webview = new ExtHostWebview(webviewHandle, this._webviewProxy, { enableScripts: true });
|
||||
return this._withAdapter(handle, CodeInsetAdapter, async (adapter, extension) => {
|
||||
await this._webviewProxy.$createWebviewCodeInset(webviewHandle, symbol.id, { enableCommandUris: true, enableScripts: true }, extension ? extension.extensionLocation : undefined);
|
||||
await this._webviewProxy.$createWebviewCodeInset(webviewHandle, symbol.id, { enableCommandUris: true, enableScripts: true }, extension ? extension.identifier : undefined, extension ? extension.extensionLocation : undefined);
|
||||
return adapter.resolveCodeInset(symbol, webview, token);
|
||||
}, symbol);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user