mirror of
https://github.com/Microsoft/vscode
synced 2024-10-30 06:38:23 +00:00
Always require an extension id if you want consistent webview origins (#163711)
This commit is contained in:
parent
cbee57d415
commit
81d2ccccc9
2 changed files with 4 additions and 4 deletions
|
@ -291,7 +291,7 @@ export class WebviewOriginStore {
|
|||
this.state = this.memento.getMemento(StorageScope.APPLICATION, StorageTarget.MACHINE);
|
||||
}
|
||||
|
||||
public getOrigin(viewType: string, extId: ExtensionIdentifier | undefined): string {
|
||||
public getOrigin(viewType: string, extId: ExtensionIdentifier): string {
|
||||
const key = this.getKey(viewType, extId);
|
||||
|
||||
const existing = this.state[key];
|
||||
|
@ -305,7 +305,7 @@ export class WebviewOriginStore {
|
|||
return newOrigin;
|
||||
}
|
||||
|
||||
private getKey(viewType: string, extId: ExtensionIdentifier | undefined): string {
|
||||
return JSON.stringify({ viewType, extension: extId?.value });
|
||||
private getKey(viewType: string, extId: ExtensionIdentifier): string {
|
||||
return JSON.stringify({ viewType, extension: extId.value });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ export class WebviewViewPane extends ViewPane {
|
|||
this._activated = true;
|
||||
|
||||
const webviewId = generateUuid();
|
||||
const origin = WebviewViewPane.getOriginStore(this.storageService).getOrigin(this.id, this.extensionId);
|
||||
const origin = this.extensionId ? WebviewViewPane.getOriginStore(this.storageService).getOrigin(this.id, this.extensionId) : undefined;
|
||||
const webview = this.webviewService.createWebviewOverlay({
|
||||
id: webviewId,
|
||||
origin,
|
||||
|
|
Loading…
Reference in a new issue