b4rtaz / simple-site-blocker

Block websites easily in Firefox or Chrome. Stay focused.
MIT License
7 stars 2 forks source link

The "Current site Enabled/Disabled" switch doesn't do anything. #2

Open VovaOneReal opened 1 year ago

VovaOneReal commented 1 year ago

What's wrong?

With the extension enabled on Firefox, none of the sites are blocked, even if the "Simple Site Blocker Enabled/Disabled" and "Current site Enabled/Disabled" toggle switches for that site are enabled.

How to reproduce?

  1. Install the extension.
  2. Restart your browser.
  3. Open the site you want to block.
  4. Enable the "Simple Site Blocker Enabled/Disabled" switch and wait for a reboot.
  5. Enable the "Current site Enabled/Disabled" switch for the site. Nothing will happen.
  6. Close the panel with the extension toggle switches.
  7. Open the panel with extension toggle switches - the "Current site Enabled/Disabled" toggle switch position will be in the disabled state.

Conditions for reproducing the bug.

VovaOneReal commented 1 year ago

Trying to figure out the bug on my own. Debugger reports that the blockedHosts field in the config object is undefined. Same problem in background.js. firefox_Azxv3c8sdG

I noticed that the condition here does not work correctly: an empty object is returned, which is taken as true and, therefore, further work with the object leads to errors.

sublime_text_rSOF1U4Q4c

firefox_b0K3cDRg4f

I won't argue if it turns out that I'm displaying the Promise result incorrectly in the console.