Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/vs/base/common/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,9 @@ class FileAccessImpl {

export const FileAccess = new FileAccessImpl();

export const CacheControlheaders: Record<string, string> = Object.freeze({
'Cache-Control': 'no-cache, no-store',
});

export namespace COI {

Expand Down
13 changes: 11 additions & 2 deletions src/vs/platform/protocol/electron-main/protocolMainService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { session } from 'electron';
import { Disposable, IDisposable, toDisposable } from '../../../base/common/lifecycle.js';
import { COI, FileAccess, Schemas } from '../../../base/common/network.js';
import { COI, FileAccess, Schemas, CacheControlheaders } from '../../../base/common/network.js';
import { basename, extname, normalize } from '../../../base/common/path.js';
import { isLinux } from '../../../base/common/platform.js';
import { TernarySearchTree } from '../../../base/common/ternarySearchTree.js';
Expand Down Expand Up @@ -104,14 +104,23 @@ export class ProtocolMainService extends Disposable implements IProtocolMainServ
}
}

// In OSS, evict resources from the memory cache in the renderer process
// Refs https://github.com/microsoft/vscode/issues/148541#issuecomment-2670891511
if (!this.environmentService.isBuilt) {
headers = {
...headers,
...CacheControlheaders
};
}

// first check by validRoots
if (this.validRoots.findSubstr(path)) {
return callback({ path, headers });
}

// then check by validExtensions
if (this.validExtensions.has(extname(path).toLowerCase())) {
return callback({ path });
return callback({ path, headers });
}

// finally block to load the resource
Expand Down
Loading