Uh oh!
There was an error while loading. Please reload this page.
Viewer fix: invalid html_widget resource paths - #739
Conversation
Observe changes in the DOM, in order to ensure urls are appropriate for webview restrictions
renkun-ken
commented
Aug 1, 2021
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? |
Uh oh!
There was an error while loading. Please reload this page.
ElianHugh
commented
Aug 1, 2021
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
renkun-ken
commented
Aug 2, 2021
Do you think if there is anything we could do about it? |
ElianHugh
commented
Aug 2, 2021
- 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
* 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 <renkun@outlook.com>

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: