<tab> element for selected tab rebuilt once per second
Selecting a tab does need to change some attributes of the tab (visuallyselected=true, for one), so that's expected. However, I did not expect that ever attribute would be reset to the same value once per second. You can see it happening in the dom inspector.
The reason this is happening once per second is to update the thumbnail of the active tab. It is preferable that all of the attributes do not need to be redrawn but I believe that was something that had to happen because of XUL.
Ah, I see. Perhaps another optimization would be to skip it entirely if the thumbnails are hidden. :)
Perhaps another optimization would be to skip it entirely if the thumbnails are hidden.
Looking at the current code, the thumbnail is not rebuilt when tabs are not in "large" mode. Maybe Erica or Blake fixed that already.
Another optimization would be to skip rebuilding the thumbnail (or even updating the label) for the New Tab. Proof of concept for the refreshThumbAndLabel method:
// don't rebuild the image or label for the New Tab
if (['about:newtab', 'about:blank'].includes(url) && url === this._prevUrl) return;
this._prevUrl = url;