-
Notifications
You must be signed in to change notification settings - Fork 138
Viewer fix: invalid html_widget resource paths #739
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
Conversation
Observe changes in the DOM, in order to ensure urls are appropriate for webview restrictions
|
Thanks for working on this! Works nicely already. When I test the mapview example, it actually works, but I found the following error in the log: Not sure if it has any impact on the functionality. Anything we should do about this or we could ignore it? |
Very weird, this doesn't occur on WSL, but does on Linux. Removing the CSP policies shows a fetch attempt to a non-existent filepath for some reason... I think it does effect the blue dots on the map, but is fixed if you type |
- Remove superfluous console.log - Simplify regex usage
- Change webview/observer.js to session/webview/observer.js
Do you think if there is anything we could do about it? |
- Fix slowdown for DOMs that have many updates a second - Fix more resource request paths
- No need to test tags that do not typically have src values. This can be expanded if a tag is missing from the list
renkun-ken
left a comment
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.
Works nicely now.
LGTM
* Implement mutation observer Observe changes in the DOM, in order to ensure urls are appropriate for webview restrictions * pre -> span, clean up observer method * Refactor webview * Refactor html into func, observe content only * Improve docs, change URL testing * Minor update * Simplify regex usage - Remove superfluous console.log - Simplify regex usage * (Misc) change directory - Change webview/observer.js to session/webview/observer.js * Fix merge conflict * Broaden regex, bug fix - Fix slowdown for DOMs that have many updates a second - Fix more resource request paths * Only test specific tags - No need to test tags that do not typically have src values. This can be expanded if a tag is missing from the list * Debounce mut. observer Co-authored-by: Kun Ren <[email protected]>

Resolves #665
Adds a mutation observer to the webview body, which watches for changes in the DOM. Specifically, the filescheme
vscode-webview://is tested for 'URLness' and (if true) is converted to anhttps://request.This PR also defines some (minimal) content security policies for the webview.
Screenshot
How can I check this pull request?
Prior to the PR, the following led to a blank viewer page, which should now be fixed:
Dynamic loading of resources is supported too: