Make resolveExternalUri return just a plain uri instead of a disposable result

For #81131

We had trouble coming up with cases where extensions could actually reliably dispose of the resolved uri
This commit is contained in:
Matt Bierner
2019-09-23 10:40:58 -07:00
parent 00983bcdf0
commit a62b7dabe7
5 changed files with 15 additions and 39 deletions

View File

@@ -14,8 +14,6 @@ import { ExtHostContext, ExtHostWindowShape, IExtHostContext, IOpenUriOptions, M
@extHostNamedCustomer(MainContext.MainThreadWindow)
export class MainThreadWindow implements MainThreadWindowShape {
private handlePool = 1;
private readonly proxy: ExtHostWindowShape;
private readonly disposables = new DisposableStore();
private readonly resolved = new Map<number, IDisposable>();
@@ -49,23 +47,9 @@ export class MainThreadWindow implements MainThreadWindowShape {
return this.openerService.open(uri, { openExternal: true, allowTunneling: options.allowTunneling });
}
async $resolveExternalUri(uriComponents: UriComponents, options: IOpenUriOptions): Promise<{ handle: number, result: UriComponents }> {
async $resolveExternalUri(uriComponents: UriComponents, options: IOpenUriOptions): Promise<UriComponents> {
const uri = URI.revive(uriComponents);
const handle = ++this.handlePool;
const result = await this.openerService.resolveExternalUri(uri, options);
this.resolved.set(handle, result);
return { handle, result: result.resolved };
}
async $releaseResolvedExternalUri(handle: number): Promise<boolean> {
const entry = this.resolved.get(handle);
if (entry) {
entry.dispose();
this.resolved.delete(handle);
return true;
}
return false;
return result.resolved;
}
}