This way the function runs after all of the tabs from the previous
function have been closed, and since this test is independent, it would
be better for it to be isolated.
We send a pagehide event during swapping docshell frame loaders, and
before this patch we would not be able to differentiate this event with
the one that we send when navigating away from a page, so we would
incorrectly dispatch an audio-playback notification indicating that
audio playback has stopped. This patch adds a flag to the root docshell
when the frame loader swapping is in progress and disables the above
behavior when that flag is set.
This bug happens becuase when toggleMuteAudio() is called from the click
handler for the tab, we remove the muted attribute during unmuting,
which makes the element display:none. Therefore, when the mouse pointer
leaves that region, there is no element to receive the mouseout event
and as a result, the _overPlayingIcon variable stays true, which means
we stop tab switching in the mousedown handler.