The issue is that NewTabMessage knows that it has sent a particular newtab an instruction to show a message in the past, but doesn’t actually know if it’s visible or not. It may have already been dismissed by the user.
What I think we should do is have the MessageWrapper send an action to the parent if a message is shown, and if a message is dimissed. The parent will maintain a WeakSet of elements that are showing messages. On a message shown, it’ll add to the set. On message dimissed or newtab unload, it’ll remove from the set.
When it comes time to check if a message is visible on the current selected browser, merely check if it’s in the set O(1).
New Tab image performance optimization, if we have time