mozillabrasil / sumo_live_helper

Helper Add-on for SUMO forum contributors
https://addons.mozilla.org/firefox/addon/sumo-live-helper-/
Mozilla Public License 2.0
7 stars 8 forks source link

Notification displays when browserAction is open #32

Closed WesleyBranton closed 5 years ago

WesleyBranton commented 5 years ago

This bug is linked to pull request #31 that added the notifications API. Currently, there is no way to distinguish whether or not the browserAction popup is currently open. This presents an issue with the Notifications API.

Because the same code is used for the background script and the popup window, the Notification API will be triggered both during the periodic checks for new questions (the intended use) and when the new questions are refreshed due to the popup loading (not intended). It could be easy to fix this if Firefox provided an API for checking whether or not the popup is open. However, I couldn't find any API for doing so.

Therefore, the possible solution could be to segregate the popup code from the background code. This would be a large (although not difficult) change to the code. It may also provide some functionality and performance improvements. However, such changes could take some time and require a decent amount of work.

There appears to be no way to fix this bug without those changes being made. This bug is only a minor issue and can be delayed until a time when it would be useful to edit the code. For now this bug remains "blocked".

If you can think of any better solutions, feel free to share.

WesleyBranton commented 5 years ago

It might be possible to solve this issue without dramatically changing the code. I can probably fix it using a variable that is stored using the Storage API. I will look into it.