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

WebEngine (Chromium) Images not Working #533

Closed
ossi-saukko opened this issue Oct 17, 2020 · 4 comments
Closed

WebEngine (Chromium) Images not Working #533

ossi-saukko opened this issue Oct 17, 2020 · 4 comments
Milestone

Comments

@ossi-saukko
Copy link

When using the Qt WebEngine for preview, local images are not loaded.

This can be fixed by commenting or removing the following lines from webenginepreview.py file:

        settings = self.settings()
        settings.setAttribute(QWebEngineSettings.LocalContentCanAccessFileUrls, False)

I guess there was a reason to add these lines, so this may cause bug or security issue elsewhere. If you have multiple settings there, only remove or enable the LocalContentCanAccessFileUrls setting.

@mitya57
Copy link
Member

mitya57 commented Oct 17, 2020

Thank you for the report!

Looks like it worked with Qt 5.14 but stopped working with Qt 5.15. I will investigate further.

@mitya57 mitya57 added this to the ReText 8.0 milestone Dec 18, 2020
@mitya57
Copy link
Member

mitya57 commented Jan 14, 2021

I am terribly sorry for the delay. This is now fixed in master branch, maybe you can check if the fix works for you?

@ossi-saukko
Copy link
Author

Thank you for the fix. I tested this fix from the master branch, and it is working on my system without problems. Good work :-)

mitya57 added a commit that referenced this issue Jan 16, 2021
Without this, Qt WebEngine 5.15 does not load local images even by
relative paths.

Originally this setting was added as a security measure, to prevent
malicious content from stealing user data and sending it to an
attacker's server. But Qt 5.15 started to treat images with relative
paths as file: URLs, so we can no longer forbid access to them.

So we introduce a new security measure: pages now cannot load local
content using XMLHttpRequests. This should be enough to prevent them
from reading files from JS code.

Fixes #533.

(cherry picked from commit 9391835)

Adapted for retext-7.1 branch: use old-style enum to make it work with
PyQt < 5.11.
@mitya57
Copy link
Member

mitya57 commented Jan 16, 2021

Thanks for testing! Pushed the fix also to retext-7.1 branch.

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

No branches or pull requests

2 participants