未验证 提交 e023b1be 编写于 作者: M Matt Bierner 提交者: GitHub

Merge pull request #74185 from SimonSiefke/portmapping2

fix #74085
......@@ -5763,8 +5763,11 @@ declare module 'vscode' {
* to allow using a static localhost port inside the webview that is resolved to random port that a service is
* running on.
*
* If a webview accesses localhost content, we recomend that you specify port mappings even if
* If a webview accesses localhost content, we recommend that you specify port mappings even if
* the `webviewPort` and `extensionHostPort` ports are the same.
*
* *Note* that port mappings only work for `http` or `https` urls. Websocket urls (e.g. `ws://localhost:3000`)
* cannot be mapped to another port.
*/
readonly portMapping?: ReadonlyArray<WebviewPortMapping>;
}
......
......@@ -165,8 +165,7 @@ class WebviewPortMappingProvider extends Disposable {
session.onBeforeRequest(async (details) => {
const uri = URI.parse(details.url);
const allowedSchemes = ['http', 'https', 'ws', 'wss'];
if (allowedSchemes.indexOf(uri.scheme) === -1) {
if (uri.scheme !== 'http' && uri.scheme !== 'https') {
return undefined;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册