ray-lothian / UserAgent-Switcher

A User-Agent spoofer browser extension that is highly configurable
https://webextension.org/listing/useragent-switcher.html
Mozilla Public License 2.0
884 stars 142 forks source link

Changing UA somehow makes request from Service Workers fail with NS_ERROR_INTERCEPTION_FAILED #170

Open billy4479 opened 1 year ago

billy4479 commented 1 year ago

I have no idea why this could happen. I noticed the problem on web.whatsapp.com where it won't load stickers with the extension enabled. I also had some font loading issues on other websites (for example the Italian news website corriere.it) which fail with the same error.

On the network tab I get this error:

image

I'm not even sure on how to reproduce this issue, the behavior I get is the following:

  1. I load a page using a different UA
  2. Resource X fails to load
  3. I reset my UA and reload the page
  4. X loads just fine
  5. I change my UA again
  6. I reload the page using the Disable cache option in the devtools
  7. X still loads fine (somehow?)
  8. If I try to load another resource Y that wasn't being loaded before it still fails with the same error

I think that this behavior is due to some kind of cache still being present that my browser is still accessing and it shouldn't be related to the extension itself but this behavior keeps me from submitting a fully reproducible example, so sorry about that.

I'll do some further investigation in the next days but I'm opening this issue anyways because maybe it's a known issue or it has a easy workaround available that I'm not aware of.

Setup information - Browser: Librewolf 107.0.1 (basically Firefox) - Extension version: 0.4.8 from the Firefox Store

As always, thank you for your time and for this extension :)

Killercat103 commented 1 year ago

So that's why I couldn't get some websites to work. Thank you for bringing this up because I was pulling my hair out figuring out why so many essential CORS requests had been blocked on LibreWolf when i tried to explicitly allow it.

billy4479 commented 1 year ago

I did some research and some googling: turns out that the error I'm getting, NS_ERROR_INTERCEPTION_FAILED, according to this reddit post, means

Generic error for non-specific failures during service worker interception

So the problems seems to be with the service worker, not every request, which could explain the behavior I was getting in the websites mentioned in the first commend.

This also means that my initial hypothesis on CORS was at least partially wrong, I'll update the title to make it more accurate.

NS_ERROR_INTERCEPTION_FAILED is a very generic error, it's not very easy to find out what's going on..