mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 18:19:12 +01:00
Delegate to embedder when resolving if one exists
This commit is contained in:
@@ -54,10 +54,19 @@ export class MainThreadWindow implements MainThreadWindowShape {
|
||||
|
||||
async $resolveExternalUri(uriComponents: UriComponents, options: IOpenUriOptions): Promise<UriComponents> {
|
||||
const uri = URI.revive(uriComponents);
|
||||
const embedderResolver = this.getEmbedderResolver();
|
||||
if (embedderResolver) {
|
||||
return embedderResolver(uri);
|
||||
}
|
||||
return this.resolveExternalUri(uri, options);
|
||||
}
|
||||
|
||||
async $releaseResolvedExternalUri(uriComponents: UriComponents): Promise<boolean> {
|
||||
if (this.getEmbedderResolver()) {
|
||||
// Embedder handled forwarding so there's nothing for us to clean up
|
||||
return true;
|
||||
}
|
||||
|
||||
const portMappingRequest = extractLocalHostUriMetaDataForPortMapping(URI.from(uriComponents));
|
||||
if (portMappingRequest) {
|
||||
const existing = this._tunnels.get(portMappingRequest.port);
|
||||
@@ -71,6 +80,10 @@ export class MainThreadWindow implements MainThreadWindowShape {
|
||||
return true;
|
||||
}
|
||||
|
||||
private getEmbedderResolver(): undefined | ((uri: URI) => Promise<URI>) {
|
||||
return this.environmentService.options && this.environmentService.options.resolveExternalUri;
|
||||
}
|
||||
|
||||
private async resolveExternalUri(uri: URI, options: IOpenUriOptions): Promise<URI> {
|
||||
if (options.allowTunneling && !!this.environmentService.configuration.remoteAuthority) {
|
||||
const portMappingRequest = extractLocalHostUriMetaDataForPortMapping(uri);
|
||||
|
||||
Reference in New Issue
Block a user