Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebView Extensions asset load 403 Forbidden #13373 #13382

Merged
merged 2 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/plugin-ext/src/plugin/custom-editors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export class CustomEditorsExtImpl implements CustomEditorsExt {
if (!entry) {
throw new Error(`No provider found for '${viewType}'`);
}
const panel = this.webviewExt.createWebviewPanel(viewType, title, {}, options, entry.plugin, handler);
const panel = this.webviewExt.createWebviewPanel(viewType, title, {}, options, entry.plugin, handler, false);
const webviewOptions = WebviewImpl.toWebviewOptions(options, this.workspace, entry.plugin);
await this.proxy.$createCustomEditorPanel(handler, title, widgetOpenerOptions, webviewOptions);

Expand Down
18 changes: 16 additions & 2 deletions packages/plugin-ext/src/plugin/webviews.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,33 @@ export class WebviewsExtImpl implements WebviewsExt {
return panel;
}

/**
* Creates a new webview panel.
*
* @param viewType Identifies the type of the webview panel.
* @param title Title of the panel.
* @param showOptions Where webview panel will be reside.
* @param options Settings for the new panel.
* @param plugin The plugin contributing the webview.
* @param viewId The identifier of the webview instance.
* @param originBasedOnType true if a stable origin based on the viewType shall be used, false if the viewId should be used.
* @returns The new webview panel.
*/
createWebviewPanel(
viewType: string,
title: string,
showOptions: theia.ViewColumn | theia.WebviewPanelShowOptions,
options: theia.WebviewPanelOptions & theia.WebviewOptions,
plugin: Plugin,
viewId: string
viewId: string,
originBasedOnType = true
): WebviewPanelImpl {
if (!this.initData) {
throw new Error('Webviews are not initialized');
}
const webviewShowOptions = toWebviewPanelShowOptions(showOptions);
const webview = new WebviewImpl(viewId, this.proxy, options, this.initData, this.workspace, plugin, hashValue(viewType));
const origin = originBasedOnType ? hashValue(viewType) : undefined;
const webview = new WebviewImpl(viewId, this.proxy, options, this.initData, this.workspace, plugin, origin);
const panel = new WebviewPanelImpl(viewId, this.proxy, viewType, title, webviewShowOptions, options, webview);
this.webviewPanels.set(viewId, panel);
return panel;
Expand Down
Loading