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

Empty VSCode plugin webview editor windows #13258

Closed
bvenreply opened this issue Jan 10, 2024 · 12 comments · Fixed by #13265
Closed

Empty VSCode plugin webview editor windows #13258

bvenreply opened this issue Jan 10, 2024 · 12 comments · Fixed by #13265
Assignees
Milestone

Comments

@bvenreply
Copy link
Contributor

Bug Description:

VSCode plugin webview editor windows are not displayed correctly. See this screenshot:

image

Left is a hello world vsce webview as loaded by current master. Right is the same webview after reverting this commit 72421be

Upon opening the webview this error is logged:

2024-01-10T17:16:06.195Z root ERROR [hosted-plugin: 586850] Promise rejection not handled in one second: Error: Unknown Webview: 0917c540-d516-4f59-ace9-bb9fff13c70c , reason: Error: Unknown Webview: 0917c540-d516-4f59-ace9-bb9fff13c70c
With stack trace: Error: Unknown Webview: 0917c540-d516-4f59-ace9-bb9fff13c70c
    at WebviewsMainImpl.getWebview (http://localhost:3000/packages_plugin-ext_lib_hosted_browser_hosted-plugin_js.js:13987:19)
    at async WebviewsMainImpl.$setHtml (http://localhost:3000/packages_plugin-ext_lib_hosted_browser_hosted-plugin_js.js:13917:25)
    at async RpcProtocol.handleRequest (http://localhost:3000/bundle.js:147209:28)

Steps to Reproduce:

This can be reproduced on the Theia browser example. You will also need a sample VSCode extension, I pushed the source code for the one used above here. You can build it with npm install && npx --yes --package @vscode/vsce vsce package --skip-license --allow-missing-repository.

  • Open Theia
  • Install the sample vsce
  • Open the command palette and select Open HelloWorld webview
  • Observe the empty window and error logged in the backend

Additional Information

  • Operating System: 6.1.0-17-amd64 GNU/Linux
  • Theia Version: master (6a7bd87)
  • Browser: Chromium version 119
@dhuebner
Copy link
Member

I'm facing the same issue and can confirm that reverting 72421be solves the problem.

@JonasHelming
Copy link
Contributor

@jfaltermeier Could you take a look, please?

@jfaltermeier
Copy link
Contributor

Sure, the widget seems to be in the pending map still and this.widgetManager.getWidgets does not include pending widgets. I'll look for a fix.

jfaltermeier added a commit that referenced this issue Jan 11, 2024
* introduce widget manager method to find a widget based on testing its
options
* use this in webviews-main to also check pending widgets
@jfaltermeier
Copy link
Contributor

@bvenreply @dhuebner If you have the time, could you please check whether #13265 fixes the issue for you?

@bvenreply
Copy link
Contributor Author

bvenreply commented Jan 12, 2024

I tested the new code, the issue is fixed on my end. Thank you @jfaltermeier.

@bvenreply
Copy link
Contributor Author

Actually @jfaltermeier, when I wrote the above I'd tested only the "hello world" extension I'd provided as a minimum example, testing the extension that initially prompted the bug report I still se some problems.

The webview editor window is still empty in that case, and in the console I see errors when trying to fetch subresources:
image

There is no more Unknown Webview error logged in the backend, in fact there is no error at all except for the 404s in the browser.

Let me know if I can provide any more details. BTW The extension I'm using is proprietary and that is why I have avoided sharing it. If needed I can ask permission to share it, but probably any extension that loads subresources in an editor webview will have the same issue.

I'm also interested in any similar feedback from @dhuebner.

@jfaltermeier
Copy link
Contributor

jfaltermeier commented Jan 12, 2024

Thanks, I'll have another look. I was able to create a reproducer.

@dhuebner
Copy link
Member

@bvenreply
Sure! I can test the new state with my extension when @jfaltermeier is finished his PR.

jfaltermeier added a commit that referenced this issue Jan 12, 2024
* fix {{uuid}} replacements
* use an origin that is computed based on the view type
@jfaltermeier
Copy link
Contributor

I've updated the PR. The initial reproducer and the vs code coding cat example (https://github.com/microsoft/vscode-extension-samples/blob/main/webview-sample/README.md) are both working + the initial reproducer of 72421be

If there are still issues, I will open a 2nd PR to revert 72421be for now, and work on the further issues in parallel.

@bvenreply
Copy link
Contributor Author

I checked again and I see no more issues on my end. Thank you @jfaltermeier.

@dhuebner
Copy link
Member

@jfaltermeier
Just a side note. I saw an other PR that deals with UUIDs #13255
Is it something your change needs to be conform to?

@dhuebner
Copy link
Member

@jfaltermeier
I tried the version from your branch issues/13258_empty-webview , everything works good!

jfaltermeier added a commit that referenced this issue Jan 15, 2024
* move uuid v5 hash method to core
jfaltermeier added a commit that referenced this issue Jan 18, 2024
jfaltermeier added a commit that referenced this issue Jan 18, 2024
* introduce widget manager method to find a widget based on testing its options
* use this in webviews-main to also check pending widgets
* use an origin that is computed based on the view type
* add uuid v5 hash method to core
@jfaltermeier jfaltermeier added this to the 1.46.0 milestone Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants