Skip to content

Commit 3888cc4

Browse files
tekiggopherbot
authored andcommitted
src/goTest: fix display pprof result page when using ssh
It is not possible to open a web view directly through a local server. Pprof is launched by default via localhost on the remote server. This means that for a remotely running workspace extension, the webviews it creates would not be able to access local servers spawned by the extension. After fix: ![image](https://github.com/golang/vscode-go/assets/19306721/2a193915-9145-4b0e-9f1f-531549e4bc31) Pprof uses absolute references. This means it won't work for codespace, but this completely works for vscode. To fix it, need to change the page rendering in pprof. Fixes #3090 Change-Id: I0af773a0a67588de4a550a4fbe6b29097d2f7edd GitHub-Last-Rev: 1187a46 GitHub-Pull-Request: #3089 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/549299 Commit-Queue: Hyang-Ah Hana Kim <[email protected]> Reviewed-by: Hyang-Ah Hana Kim <[email protected]> Reviewed-by: Alan Donovan <[email protected]> Run-TryBot: Hyang-Ah Hana Kim <[email protected]> Auto-Submit: Hyang-Ah Hana Kim <[email protected]> TryBot-Result: kokoro <[email protected]>
1 parent ec9e90d commit 3888cc4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/goTest/profile.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ async function show(profile: string) {
198198
proc.stderr.on('data', captureStdout);
199199
});
200200

201+
const externalUri = await vscode.env.asExternalUri(vscode.Uri.parse(`http://localhost:${port}`));
202+
201203
const panel = vscode.window.createWebviewPanel('go.profile', 'Profile', ViewColumn.Active);
202204
panel.webview.options = { enableScripts: true };
203205
panel.webview.html = `<html>
@@ -217,7 +219,7 @@ async function show(profile: string) {
217219
</style>
218220
</head>
219221
<body>
220-
<iframe src="http://localhost:${port}"></iframe>
222+
<iframe src="${externalUri}"></iframe>
221223
</body>
222224
</html>`;
223225

0 commit comments

Comments
 (0)