Add vscode-webview-resource protocol (#97777)

* Add vscode-webview-resource protocol

Adds a new protocol (`vscode-webview-resource`) for loading resources insides of webviews. This replaces the existing `vscode-resource` protocol and is registered on the main thread instead of in each renderer

This change also adds some rewriting logic to update any `vscode-resource:` references found in the main html to use `vscode-webview-resource` instead.

* Move webview protcol provider to own file

* Remove registration of vscode-resource scheme

* Remove use or parition for each webview

Now that we have a single shared protocol handler, we do not need to run each webview in its own partition

* Fix rewriting csp to use new protocol

* Update src/vs/code/electron-main/app.ts

Co-authored-by: Benjamin Pasero <benjpas@microsoft.com>

Co-authored-by: Benjamin Pasero <benjpas@microsoft.com>
This commit is contained in:
Matt Bierner
2020-05-15 11:34:08 -07:00
committed by GitHub
parent 946d994d1b
commit 307cb32f30
26 changed files with 220 additions and 130 deletions

View File

@@ -94,8 +94,7 @@ export class MainThreadEditorInsets implements MainThreadEditorInsetsShape {
}, {
allowScripts: options.enableScripts,
localResourceRoots: options.localResourceRoots ? options.localResourceRoots.map(uri => URI.revive(uri)) : undefined
});
webview.extension = { id: extensionId, location: URI.revive(extensionLocation) };
}, { id: extensionId, location: URI.revive(extensionLocation) });
const webviewZone = new EditorWebviewZone(editor, line, height, webview);