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

Service workers cannot be disabled in Canary #1562

Closed
8 tasks done
superpoincare opened this issue Apr 21, 2021 · 8 comments
Closed
8 tasks done

Service workers cannot be disabled in Canary #1562

superpoincare opened this issue Apr 21, 2021 · 8 comments
Labels
Chromium specific to Chromium/Chrome external issue involving an external factor invalid not a uBlock issue

Comments

@superpoincare
Copy link

superpoincare commented Apr 21, 2021

Prerequisites

  • I verified that this is not a filter issue
  • This is not a support issue or a question
  • I performed a cursory search of the issue tracker to avoid opening a duplicate issue
    • Your issue may already be reported.
  • I tried to reproduce the issue when...
    • uBlock Origin is the only extension
    • uBlock Origin with default lists/settings
    • using a new, unmodified browser profile
  • I am running the latest version of uBlock Origin
  • I checked the documentation to understand that the issue I report is not a normal behavior

Description

On Chrome Canary, service workers can't be blocked by the filter $csp=worker-src 'none'

A specific URL where the issue occurs

https://www.youtube.com/

Steps to Reproduce

  1. On a fresh install of Chrome Canary with uBO installed, add this filter $csp=worker-src 'none'
  2. In advanced settings, change suspendTabsUntilReady to yes (as described here)
  3. Visit YouTube.

Expected behavior:

Service worker is not loaded. In Chrome stable this is working fine.

Actual behavior:

Service worker gets loaded as can be seen in developer tools.

Your environment

  • uBlock Origin version: v1.34.0
  • Browser Name and version: Version 92.0.4483.0 (Official Build) canary (64-bit)
  • Operating System and version: Windows 10 Home Single Language, 20H2, OS build: 19042.928
@uBlock-user uBlock-user changed the title Service workers can be disabled in Canary Service workers cannot be disabled in Canary Apr 21, 2021
@uBlock-user
Copy link
Contributor

Did you un-register all service-workers from chrome://serviceworker-internals page in Chrome ?

@superpoincare
Copy link
Author

Oh yeah did that. And various other ways like clearing all caches, site specific data etc. too.

@gwarser
Copy link

gwarser commented Apr 21, 2021

This was problematic even before 90. suspendTabsUntilReady is very basic on Chrome.

@gorhill
Copy link
Member

gorhill commented Apr 21, 2021

In advanced settings, change suspendTabsUntilReady to yes (as described here)

So this happens at browser launch?

Documentation for suspendTabsUntilReady:

Disclaimer: especially in Chromium based browsers, even with this setting enabled, it's impossible for uBO to guarantee with 100% certainty that everything will be properly blocked when the browser is launched. This is a by-design browser issue -- do not open an issue on uBO issue tracker about this.

@superpoincare
Copy link
Author

@gorhill

I didn't check that. I used it with caches fully cleared and loading sites. I just mentioned "suspendTabsUntilReady" for the sake of completeness. So likely the issue is not that.

On Chrome stable (90), I don't face this issue either with browser launch or anytime. The service worker is always blocked.

But in Canary even with all site data cleared (ie service workers cleared too), the service worker appears at the end of the page load.

I think it's probably because for some reason Canary prevents uBO from adding the worker-src csp header.

@gorhill
Copy link
Member

gorhill commented Apr 21, 2021

So likely the issue is not that

Easy to verify, open a new Chrome instance with no tab opened, ensure there are no workers in effect using chrome://serviceworker-internals/, open uBO's logger, then open Youtube and see what the logger says and what the dev console says.

Also, in general Canary is unsupported, too many instances of malfunctions attributed to uBO while the browser is the issue, so if you can't reproduce the issue with stable or beta Chrome, then its most likely a browser issue.

@superpoincare
Copy link
Author

Yeah, when I open a browser without clearing caches and see chrome://serviceworker-internals/ I see the youtube service worker registered. Both when I unregister and don't do anything, it appears again on visiting the site.

But it seems to me that since the service worker anyway installed on a fresh load, it will load again.

On Chrome stable I see this message in Devtools console:

Refused to create a worker from 'https://www.youtube.com/sw.js' because it violates the following Content Security Policy directive: "worker-src 'none'".

which is absent in Canary.

But I understand your point about Canary having its own issues which may not appear when it becomes stable. So I think you can close the issue and maybe if we see it in Beta just before Chrome release, I can open again?

@uBlock-user
Copy link
Contributor

But I understand your point about Canary having its own issues which may not appear when it becomes stable. So I think you can close the issue and maybe if we see it in Beta just before Chrome release, I can open again?

That would make it a Chromium issue, you would need to file a report on their bug tracker.

@uBlock-user uBlock-user added Chromium specific to Chromium/Chrome external issue involving an external factor invalid not a uBlock issue labels Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Chromium specific to Chromium/Chrome external issue involving an external factor invalid not a uBlock issue
Projects
None yet
Development

No branches or pull requests

4 participants