mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-01 05:51:32 +01:00
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:
@@ -81,6 +81,8 @@ import { IStorageKeysSyncRegistryService } from 'vs/platform/userDataSync/common
|
||||
import { StorageKeysSyncRegistryChannel } from 'vs/platform/userDataSync/common/userDataSyncIpc';
|
||||
import { INativeEnvironmentService } from 'vs/platform/environment/node/environmentService';
|
||||
import { mnemonicButtonLabel, getPathLabel } from 'vs/base/common/labels';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { WebviewProtocolProvider } from 'vs/platform/webview/electron-main/webviewProtocolProvider';
|
||||
|
||||
export class CodeApplication extends Disposable {
|
||||
private windowsMainService: IWindowsMainService | undefined;
|
||||
@@ -89,6 +91,7 @@ export class CodeApplication extends Disposable {
|
||||
constructor(
|
||||
private readonly mainIpcServer: Server,
|
||||
private readonly userEnv: IProcessEnvironment,
|
||||
@IFileService fileService: IFileService,
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||
@ILogService private readonly logService: ILogService,
|
||||
@IEnvironmentService private readonly environmentService: INativeEnvironmentService,
|
||||
@@ -99,6 +102,8 @@ export class CodeApplication extends Disposable {
|
||||
super();
|
||||
|
||||
this.registerListeners();
|
||||
|
||||
this._register(new WebviewProtocolProvider(fileService));
|
||||
}
|
||||
|
||||
private registerListeners(): void {
|
||||
|
||||
Reference in New Issue
Block a user