k08045kk / RejectServiceWorker

MIT License
17 stars 2 forks source link

[Feature Request] Support blacklist mode #25

Open fbewivpjsbsby opened 3 months ago

fbewivpjsbsby commented 3 months ago

Feature Request

Support blacklist mode.

Use Cases

Sometimes we want to block certain service workers.

k08045kk commented 3 months ago

First of all, it is possible to implement a blacklist method. However, I am not very keen on it.

If you are satisfied with the UserScript version, then I suggest you use the UserScript version. With the UserScript version, it is possible to operate with the blacklist method.

UserScript version (RejectServiceWorker.user.js) https://www.bugbugnow.net/2020/03/Reject-to-register-a-ServiceWorker.html


As for the extension internals, this extension overwrites the service worker registration function without reference to the user settings. It then references the user settings to determine if the service worker can be registered or not. This is necessary in order to get a handle on the service worker registration function faster than a page script.

The same process is required for the blacklist method. However, the overwriting process of service worker registration functions is detected by the page script. Therefore, there is a possibility that some service workers may detect the overwriting of registration functions and perform unintended actions.

This problem occurs even with the whitelist method, but the blacklist method may cause problems at more sites. Therefore, I do not feel comfortable introducing a blacklist scheme into this extension.

(The UserScript version does not have this problem.)