#210 [threadreaderapp.com] HTML filter toggle doesn't apply until you do a force refresh

Closed
opened 4 months ago by emlimap · 4 comments
emlimap commented 4 months ago

URL: https://threadreaderapp.com/thread/1329697513830420482.html

On Thread reader website, enabling HTML doesn't make a difference until you do a force refresh. When it is broken the whole page aligns to the left as opposed to being centred.

It seems this website requires a force refresh as clicking on refresh button in the browser after enabling filter toggle doesn't fix it either.

Steps to reproduce

  1. Visting the above URL with LocalCDN enabled but HTML filter toggle disabled. Inverted HTML filter shouldn't be enabled
  2. Enable HTML filter
  3. The page should refresh but remain broken due to CSS stylesheets not being injected.
  4. If you force refresh (ctrl/cmd + f5), it works fine.

Errors from browser console.

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at moz-extension://866e6a0f-5d34-304e-b582-f09a3325cc50/resources/fontawesome/5.15.1/css/all.min.css. (Reason: CORS request not http).
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at moz-extension://866e6a0f-5d34-304e-b582-f09a3325cc50/resources/bootstrap/4.5.3/bootstrap.min.css. (Reason: CORS request not http).
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css. (Reason: CORS request did not succeed).
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.2.1/css/bootstrap.min.css. (Reason: CORS request did not succeed).

Browser: Firefox 85.0b4
LocalCDN version: 2.5.11

Edit: Just came across this after raising this issue https://codeberg.org/nobody/LocalCDN/wiki/Home#use-cases-for-localcdn

Looks like LocalCDN can't do much with strict CORS policies.

URL: https://threadreaderapp.com/thread/1329697513830420482.html On Thread reader website, enabling HTML doesn't make a difference until you do a force refresh. When it is broken the whole page aligns to the left as opposed to being centred. It seems this website requires a force refresh as clicking on refresh button in the browser after enabling filter toggle doesn't fix it either. ### Steps to reproduce 1. Visting the above URL with LocalCDN enabled but HTML filter toggle disabled. Inverted HTML filter shouldn't be enabled 2. Enable HTML filter 3. The page should refresh but remain broken due to CSS stylesheets not being injected. 4. If you force refresh (ctrl/cmd + f5), it works fine. Errors from browser console. ``` Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at moz-extension://866e6a0f-5d34-304e-b582-f09a3325cc50/resources/fontawesome/5.15.1/css/all.min.css. (Reason: CORS request not http). Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at moz-extension://866e6a0f-5d34-304e-b582-f09a3325cc50/resources/bootstrap/4.5.3/bootstrap.min.css. (Reason: CORS request not http). Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css. (Reason: CORS request did not succeed). Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.2.1/css/bootstrap.min.css. (Reason: CORS request did not succeed). ``` Browser: Firefox 85.0b4 LocalCDN version: 2.5.11 Edit: Just came across this after raising this issue https://codeberg.org/nobody/LocalCDN/wiki/Home#use-cases-for-localcdn Looks like LocalCDN can't do much with strict CORS policies.
nobody commented 4 months ago
Owner

Thank you for your detailed report.

The website uses a ServiceWorker. This is partially similar to a proxy that is between your browser and the web server. If you disable the ServiceWorker in the whole browser, the replacement works without any problems. This ServiceWorker also handles caching and blocks loading from other (even LocalCDN) sources.

If you don't need the features of a ServiceWorker (e.g. offline availability, caching or push notifications), you can simply disable it with about:config:

dom.serviceWorkers.enabled = false

I'm currently undecided whether LocalCDN should block ServiceWorker. I don't think so, because that's not really part of LocalCDN's job. But I'll add a note to the wiki soon.

https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API
https://web.dev/service-worker-mindset/

Thank you for your detailed report. The website uses a ServiceWorker. This is partially similar to a proxy that is between your browser and the web server. If you disable the ServiceWorker in the whole browser, the replacement works without any problems. This ServiceWorker also handles caching and blocks loading from other (even LocalCDN) sources. If you don't need the features of a ServiceWorker (e.g. offline availability, caching or push notifications), you can simply disable it with `about:config`: > ``` > dom.serviceWorkers.enabled = false > ``` I'm currently undecided whether LocalCDN should block ServiceWorker. I don't think so, because that's not really part of LocalCDN's job. But I'll add a note to the wiki soon. https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API https://web.dev/service-worker-mindset/
nobody added the
sop/cors
label 4 months ago

Could a solution like https://stackoverflow.com/questions/5721704/window-location-reload-with-clear-cache be used with the auto-refresh feature in LocalCDN? Perhaps an opt-in in the settings? (It might slightly break cross-browser compatibility, and need some testing.)

Could a solution like https://stackoverflow.com/questions/5721704/window-location-reload-with-clear-cache be used with the auto-refresh feature in LocalCDN? Perhaps an opt-in in the settings? (It might slightly break cross-browser compatibility, and need some testing.)
nobody commented 4 months ago
Owner

It depends on what the service worker is doing. It doesn't always work as a cache. Mostly it's used for tracking or offline functionality, so it's recommended to disable this feature completely in the (Firefox) browser.

I have added the section "Service Worker" in the Wiki: https://codeberg.org/nobody/LocalCDN/wiki/Home#7-3-service-worker

It depends on what the service worker is doing. It doesn't always work as a cache. Mostly it's used for tracking or offline functionality, so it's recommended to disable this feature completely in the (Firefox) browser. I have added the section "Service Worker" in the Wiki: https://codeberg.org/nobody/LocalCDN/wiki/Home#7-3-service-worker
nobody added the
documentation
label 4 months ago
nobody closed this issue 4 months ago
nobody commented 2 weeks ago
Owner
see [#369 Information about SOP/CORS related issues](https://codeberg.org/nobody/LocalCDN/issues/369)
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.