Skip to content

Commit a99228e

Browse files
chore: Align code/src/vs/platform/protocol/electron-main/protocolMainService.ts with upstream
Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
1 parent 28b00ab commit a99228e

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

code/src/vs/platform/protocol/electron-main/protocolMainService.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import { session } from 'electron';
77
import { Disposable, IDisposable, toDisposable } from '../../../base/common/lifecycle.js';
8-
import { COI, FileAccess, Schemas, CacheControlheaders } from '../../../base/common/network.js';
8+
import { COI, FileAccess, Schemas, CacheControlheaders, DocumentPolicyheaders } from '../../../base/common/network.js';
99
import { basename, extname, normalize } from '../../../base/common/path.js';
1010
import { isLinux } from '../../../base/common/platform.js';
1111
import { TernarySearchTree } from '../../../base/common/ternarySearchTree.js';
@@ -93,10 +93,10 @@ export class ProtocolMainService extends Disposable implements IProtocolMainServ
9393

9494
private handleResourceRequest(request: Electron.ProtocolRequest, callback: ProtocolCallback): void {
9595
const path = this.requestToNormalizedFilePath(request);
96+
const pathBasename = basename(path);
9697

9798
let headers: Record<string, string> | undefined;
9899
if (this.environmentService.crossOriginIsolated) {
99-
const pathBasename = basename(path);
100100
if (pathBasename === 'workbench.html' || pathBasename === 'workbench-dev.html') {
101101
headers = COI.CoopAndCoep;
102102
} else {
@@ -113,6 +113,16 @@ export class ProtocolMainService extends Disposable implements IProtocolMainServ
113113
};
114114
}
115115

116+
// Document-policy header is needed for collecting
117+
// JavaScript callstacks via https://www.electronjs.org/docs/latest/api/web-frame-main#framecollectjavascriptcallstack-experimental
118+
// until https://github.com/electron/electron/issues/45356 is resolved.
119+
if (pathBasename === 'workbench.html' || pathBasename === 'workbench-dev.html') {
120+
headers = {
121+
...headers,
122+
...DocumentPolicyheaders
123+
};
124+
}
125+
116126
// first check by validRoots
117127
if (this.validRoots.findSubstr(path)) {
118128
return callback({ path, headers });

0 commit comments

Comments
 (0)