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

Jira & Bitbucket extension cannot display Settings page (webview based) #17081

Closed
1 task done
vitaliy-guliy opened this issue Jun 3, 2020 · 3 comments
Closed
1 task done
Assignees
Labels
area/editor/theia Issues related to the che-theia IDE of Che kind/bug Outline of a bug - must adhere to the bug report template. severity/P2 Has a minor but important impact to the usage or development of the system. status/in-progress This issue has been taken by an engineer and is under active development.

Comments

@vitaliy-guliy
Copy link
Contributor

Describe the bug

There is a PR eclipse-che/che-plugin-registry#475 to che-plugin-registry which adds Jira and Bitbucket extension to Che-Theia https://marketplace.visualstudio.com/items?itemName=Atlassian.atlascode.

It looks like we have unimplemented part of WebView plugin API, or just something wrong in implementation. The extension cannot display Settings and Getting Started pages, which are webviews.
It could be because the extension is originally written for VS Code, which is Electron-based, but we are trying to launch it in Che-Theia, which is browser-based.

The first issue is that Settings page tries to load a javascript, but fails with a message Refused to load the script ... because it violates the following Content Security Policy directive.

Screenshot from 2020-06-03 12-51-25

The original Content-Security-Policy meta tag in the webview looks like following:

<meta
    http-equiv="Content-Security-Policy"
    content="default-src https://api.atlassian.com ; img-src data: vscode-resource: http: https: blob:; object-src data:; script-src vscode-resource:;style-src vscode-resource: 'unsafe-inline' blob: http: https: data:;"
/>

After adding 'unsafe-inline' 'self' to the directives, the first script is loaded successfully but the webview still fails with a new set of errors. A couple of files cannot be loaded, but they are exist on the file system.

Screenshot from 2020-06-03 12-58-36

Screenshot from 2020-06-03 12-58-55

Also we have to pay attention, that the webview tries to open a resource with vscode-resource: scheme. We need to check whether support of such schemes it implemented or not in Theia plugin API.

Screenshot from 2020-06-03 13-01-25

Che version

  • latest

Steps to reproduce

Add the plugin from the PR to a workspace.

Runtime

It looks like it does not depend on the runtime and the installation method.

@vitaliy-guliy vitaliy-guliy added kind/bug Outline of a bug - must adhere to the bug report template. team/plugins area/editor/theia Issues related to the che-theia IDE of Che labels Jun 3, 2020
@vitaliy-guliy vitaliy-guliy self-assigned this Jun 3, 2020
@che-bot che-bot added the status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. label Jun 3, 2020
@ericwill ericwill changed the title Jira&Bitbucket extension cannot display Settings page ( webview based ) Jira & Bitbucket extension cannot display Settings page (webview based) Jun 3, 2020
@ericwill ericwill mentioned this issue Jun 3, 2020
40 tasks
@davidfestal davidfestal added severity/P2 Has a minor but important impact to the usage or development of the system. and removed status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. labels Jun 3, 2020
@vitaliy-guliy vitaliy-guliy added the status/in-progress This issue has been taken by an engineer and is under active development. label Jun 9, 2020
@vitaliy-guliy
Copy link
Contributor Author

vitaliy-guliy commented Jun 16, 2020

I changed two things in atlascode extension to make it working:

  1. Removed (commented) Content-Security-Policy meta tag from the reactWebview.html
  2. Removed slash at the end of the extensionPath, which is /tmp/vscode-unpacked/atlascode-0.0.0.vsix/extension/ in my Che-Theia

The extensionPath comes to the extension within the PluginContext. I have a opinion that the extension path should not end with a slash (but I'm not sure, need to change it in plugin-ext and then test).

To make the extension working in Che-Theia we need to:

  1. Remove slash at the end of the PluginContext.extensionPath
  2. I saw somewhere in the code, that we change the html of the webview before inserting it to the page. We could do the same with reactWebview.html
  3. Before getting the webview resource, replace double slashes with single slash in plugin-service

WDYT?
@azatsarynnyy @benoitf
@akosyakov (I mentioned you also, because changes in PluginContext.extensionPath are related to Theia upstream )

Screenshot with working Jira and Bitbucket extension

Screenshot from 2020-06-16 15-34-51

Screenshot from 2020-06-16 16-12-17

Screenshot from 2020-06-16 16-13-17

@vitaliy-guliy
Copy link
Contributor Author

vitaliy-guliy commented Jun 23, 2020

Depends on

It's also need to fix #17173

A proper plugin API should be adopted in the Jira and Bitbucket extension:

Corresponding issue was creates in Jira and Bitbucket extension repository https://bitbucket.org/atlassianlabs/atlascode/issues/443

@ericwill ericwill mentioned this issue Jun 24, 2020
31 tasks
@vitaliy-guliy
Copy link
Contributor Author

Jira and Bitbucket extension v2.6.4 mhould work in the nightly build of Che-Theia.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/editor/theia Issues related to the che-theia IDE of Che kind/bug Outline of a bug - must adhere to the bug report template. severity/P2 Has a minor but important impact to the usage or development of the system. status/in-progress This issue has been taken by an engineer and is under active development.
Projects
None yet
Development

No branches or pull requests

3 participants