-
Notifications
You must be signed in to change notification settings - Fork 4
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
Account for Windows and MSFT Edge limitations when loading WebViews #42
Conversation
if (platform == PluginPlatform.WINDOWS) { | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try checking for a POSIX compatible file system for a more robust check:
public static boolean hasPosixFilePermissions(Path path) {
return path.getFileSystem().supportedFileAttributeViews().contains("posix");
}
if (platform == PluginPlatform.WINDOWS) { | ||
return SWT.EDGE; | ||
} | ||
return SWT.NATIVE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make the default explicitly SWT.WEBKIT
. The other types seem to be deprecated but we don't want to leave the mapping up to chance.
* @param jsPath | ||
* @return server launched | ||
*/ | ||
protected Server setupVirtualServer(final String jsPath) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My preference would be for this piece to live in a separate class that abstracts away the internal Server
- could be WebviewAssetServer
with a resolve(path)
method (and stop
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea. Updated
protected Server setupVirtualServer(final String jsPath) { | ||
Server server = null; | ||
try { | ||
server = new Server(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Glad this worked.
Description of changes:
This change introduces some updates to account for development limitations when using WebViews in Eclipse with Windows and MSFT Edge as the backing browser technology.
Changes:
In addition some security recommendations has been added for chat webview CSP meta
default-src 'none';
- By default, do not allow any resources to loadscript-src {javascriptFilePath} 'unsafe-inline'
- Allow inline JS to load in http://{virtualhost}/amazonq-ui.js, which is required for mynah-ui to runstyle-src {javascriptFilePath} 'unsafe-inline';
- Allow inline css to load in http://{virtualhost}/amazonq-ui.js, which is required for mynah-ui to runimg-src 'self' data:
- Allow inline images (svg in particular) that start with data: to load in the same originobject-src 'none'; base-uri 'none';
recommended by security internallyBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.