extensionDownloader.ts ×10

Frontier kind: Joint frontier

unlabeled · c_905ee207c534

4 tests · 19262 LOC · 89 files · introduces 4 tests · 52 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
12 ranges52 lines · 2 files
Tests
4 tests

Contains — complete concept membership

All code (extent)
2709 ranges19262 lines · 89 files · Browse complete extent
All tests (intent)
4 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

4 tests introduced at this concept.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 52 introduced LOC across 12 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/extensionManagement/node/extensionDownloader.ts 35 introduced LOC · 10 ranges

Open complete file

74 return { location, verificationStatus: ExtensionSignatureVerificationCode.NotSigned };
75 }
77 > let signatureArchiveLocation;
78 > try {
79 > signatureArchiveLocation = await this.downloadSignatureArchive(extension);
80 > const verificationStatus = (await this.extensionSignatureVerificationService.verify(extension.identifier.id, extension.version, location.fsPath, signatureArchiveLocation.fsPath, clientTargetPlatform))?.code;
81 if (verificationStatus === ExtensionSignatureVerificationCode.PackageIsInvalidZip || verificationStatus === ExtensionSignatureVerificationCode.SignatureArchiveIsInvalidZip) {
82 try {
88 throw new ExtensionManagementError(CorruptZipMessage, ExtensionManagementErrorCode.CorruptZip);
89 }
90 > return { location, verificationStatus }; extensionDownloader.ts
91 > } catch (error) {
92 try {
93 // Delete the downloaded VSIX if signature archive download fails
97 }
98 throw error;
99 > } finally { extensionDownloader.ts
100 > if (signatureArchiveLocation) {
101 > try {
102 > // Delete signature archive always
103 > await this.delete(signatureArchiveLocation);
104 > } catch (error) {
105 this.logService.error(error);
106 }
108 > }
109 }
110
140
141 private async downloadSignatureArchive(extension: IGalleryExtension): Promise<URI> {
143 > const location = joinPath(this.extensionsDownloadDir, `${this.getName(extension)}${ExtensionsDownloader.SignatureArchiveExtension}`);
144 > const attempts = await this.doDownload(extension, 'sigzip', async () => {
145 > await this.extensionGalleryService.downloadSignatureArchive(extension, location);
146 > try {
147 > await this.validate(location.fsPath, '.signature.p7s');
148 > } catch (error) {
149 try {
150 await this.fileService.del(location);
154 throw error;
155 }
156 > }, 2); extensionDownloader.ts
157 >
158 > if (attempts > 1) {
159 this.telemetryService.publicLog2<RetryDownloadEvent, RetryDownloadClassification>('extensiongallery:downloadsigzip:retry', {
160 extensionId: extension.identifier.id,
162 });
163 }
165 > return location;
166 > } catch (e) {
167 throw toExtensionManagementError(e, ExtensionManagementErrorCode.DownloadSignature);
168 }
170
171 private async downloadFile(extension: IGalleryExtension, location: URI, downloadFn: (location: URI) => Promise<void>): Promise<void> {
232
233 async delete(location: URI): Promise<void> {
234 > await this.cleanUpPromise; extensionDownloader.ts
235 > const trashRelativePath = this.uriIdentityService.extUri.relativePath(this.extensionsDownloadDir, location);
236 > if (trashRelativePath) {
237 > await this.fileService.move(location, this.uriIdentityService.extUri.joinPath(this.extensionsTrashDir, trashRelativePath), true);
238 > } else {
239 await this.fileService.del(location);
240 }
242
243 private async cleanUp(): Promise<void> {
src/vs/platform/files/common/inMemoryFilesystemProvider.ts 17 introduced LOC · 2 ranges

Open complete file

230
231 async rename(from: URI, to: URI, opts: IFileOverwriteOptions): Promise<void> {
232 > if (!opts.overwrite && this._lookup(to, true)) { inMemoryFilesystemProvider.ts
233 throw createFileSystemProviderError('file exists already', FileSystemProviderErrorCode.FileExists);
234 }
236 > const entry = this._lookup(from, false);
237 > const oldParent = this._lookupParentDirectory(from);
238 >
239 > const newParent = this._lookupParentDirectory(to);
240 > const newName = resources.basename(to);
241 >
242 > oldParent.entries.delete(entry.name);
243 > entry.name = newName;
244 > newParent.entries.set(newName, entry);
245 >
246 > this._fireSoon(
247 > { type: FileChangeType.DELETED, resource: from },
248 > { type: FileChangeType.ADDED, resource: to }
249 > );
250 > }
251
252 async delete(resource: URI, opts: IFileDeleteOptions): Promise<void> {