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

Fix tab-mouseover events not being sent to other add-ons #2633

Merged
merged 1 commit into from
Jul 8, 2020

Conversation

klemens
Copy link
Contributor

@klemens klemens commented Jul 7, 2020

Previously the array returned by TSTAPI.getListenersForMessageType was directly compared to 0 (instead of its length property), which always resulted in false. However due to the structure of the code (and the following expression being true for any object: undefined != [{}] > 0), the listeners were enabled anyway, even if there wasn't any add-on listening. Recently, d2f5a42 changed the structure slightly to implement tab warming, and now the check failing actually results in tab-mouseover events no longer being sent to other add-ons.

This commit switches to the TSTAPI.hasListenerForMessageType function, which correctly checks the length property internally.

Speaking about tab warming: Could we add an option to disable it globally or alternatively add an API endpoint for other add-ons to disable it? Because quickly moving my mouse over my hundreds of tabs make my browser crawl to a halt, trying to load every hovered tab. I can also create a new issue to discuss this.

Previously the array returned by TSTAPI.getListenersForMessageType was
directly compared to 0 (instead of its length property), which always
resulted in false. However due to the structure of the code (and the
following expression being true for any object: undefined != [{}] > 0),
the listeners were enabled anyway, even if there wasn't any addon
listening. Recently, d2f5a42 changed
the structure slightly to implement tab warming, and now the check
failing actually results in tab-mouseover events no longer being sent to
other add-ons.

This commit switches to the TSTAPI.hasListenerForMessageType function,
which corectly checks the length property internally.
@piroor piroor merged commit 3660964 into piroor:trunk Jul 8, 2020
@piroor
Copy link
Owner

piroor commented Jul 8, 2020

Thanks a lot! I can't imagine why I did such a mistake...

@klemens klemens deleted the mouse-events-fix3 branch July 8, 2020 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants