-
Notifications
You must be signed in to change notification settings - Fork 6
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
Some websites use serviceWorker to cache, causing dark mode to not apply #82
Comments
Thanks for the suggestion about disabling service workers. I wasn’t aware of that technique, and it’s interesting. I’m considering whether we can pursue caching all functions related to content saving as I do now for darkening content. Your idea of giving users the option to disable service workers globaly or per site is feasible and will be a useful addition. |
Thanks for replying, I hope you'll continue to develop this addon, it's the current most promising Dark Mode we've had before, faster than native, as someone explained here.
I think this would be the best case scenario. Making dark cacheable would improve performance further I think.
It'll be pretty useful for debugging and fixing quick and dirty issues, because serviceWorkers can cause some really wierd issues to addons, uBlockOrgin had to deal with them some ways. |
I'm surprised and glad to see that it has garnered interest and is useful to reddit users, I've commented the post. It's important to note that it's an unfinishable project with numerous complexities, and you are right when you say it be pretty useful for debugging and fixing obvious issues, even by dirty methods like service workers disabling to improve quickly by a lot user experience. |
@Vintagemotors FYI |
Disabling service workers for UltimaDark users is the way to go for now. I created an option to allow users to keep service workers if they choose. Losing service workers is not a big deal since all service worker-based sites must work in private windows, which should never support service workers for privacy reasons. These websites have fallback mechanisms to handle these cases. I explored many ways to continue ctching all functions related to content saving inside service workers, as I currently do for darkening content, because I think it’s a valid approach. However, a strange behavior of the WebRequests API prevents me from intercepting and editing service worker scripts. To be sure, I asked the Mozilla Firefox team in this bug report. See edits in version 1.5.48. |
I agree, disabling serviceWorker is pretty safe, not totally safe unless the website is badly coded.
Worst case scenario I think we could still possible to inject and override serviceWorker object to tamper and modify serviceWorker file before sending to Firefox. I remember I've done something like this before, read and convert serviceWorker file to blob, and feed to register. Line 61 of this script demonstrate how to fetch serviceWorker file content -> modify -> convert to blob -> feed to serviceWorker.register. Hope this is helpful. Thanks a lot of improving this addon. |
Sorry I didn't notice when this project became active again - I'm checking regularly again now. |
@Vintagemotors 😉 I’m happy to see you again 😄 I’m implementing your WhatsApp advice: releasing versions less frequently and focusing on the most critical user experience issues. Meanwhile, I’m struggling to find a good algorithm for image editing. I’ve already found new techniques. to improve compatibily to diverse websites and released version 1.5.0 . I’ve already found and fixed some code mistakes that negatively impacted performance, which is great news since image editing was one of the main bottlenecks. |
Can I see the code of Image Editing ? I might be able to figure out something |
Hi @gunir, Regarding image editing, I'm currently dealing with some complex issues and some non-interesting non-working code. For now, you can look into imageWorker.js to get an idea of how it was done for quite some time. I'm trying to rewrite it all to make it less dumb. Once I have a better understanding, I'll share new details and ideas with you. I'm looking forward to discussing the potential possibilities once things are clearer. |
Are there any sites that still have this issue or is it resolved? |
Example: https://voz.vn/
Try to navigate to some random pages, and back/forward...
And you will see something like this:
By disabling serviceWork, adding those rules to uBlock you fixed this issue:
*$csp=worker-src 'none',domain=~example1.com|~example2.com
Go to
about:serviceworkers
and Unregistervoz.vn
Or you can use this script:
https://greasyfork.org/en/scripts/482724-reject-serviceworker-auto
So what can we do ?
Implement our method to disable serviceWorker, or finding a way to bypass it (unlikely).
The text was updated successfully, but these errors were encountered: