Bug 1191959 - Make sure that pinned tabs are still clickable after unuting a tab that is not playing; r=jaws

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.
This commit is contained in:
Ehsan Akhgari 2015-08-06 22:29:06 -04:00
parent c1624b854e
commit 93dbfbbfed
2 changed files with 55 additions and 0 deletions

View File

@ -5976,6 +5976,7 @@
if ((anonid == "soundplaying-icon") ||
((anonid == "overlay-icon") && iconVisible)) {
this.toggleMuteAudio();
this._overPlayingIcon = false;
}
]]>
</handler>

View File

@ -159,6 +159,58 @@ function* test_browser_swapping(tab, browser) {
});
}
function* test_click_on_pinned_tab_after_mute() {
function* test_on_browser(browser) {
let tab = gBrowser.getTabForBrowser(browser);
gBrowser.selectedTab = originallySelectedTab;
isnot(tab, gBrowser.selectedTab, "Sanity check, the tab should not be selected!");
// Steps to reproduce the bug:
// Pin the tab.
gBrowser.pinTab(tab);
// Start playbak.
yield ContentTask.spawn(browser, {}, function* () {
let audio = content.document.querySelector("audio");
audio.play();
});
// Wait for playback to start.
yield wait_for_tab_playing_event(tab, true);
// Mute the tab.
let icon = document.getAnonymousElementByAttribute(tab, "anonid", "overlay-icon");
yield test_mute_tab(tab, icon, true);
// Stop playback
yield ContentTask.spawn(browser, {}, function* () {
let audio = content.document.querySelector("audio");
audio.pause();
});
// Unmute tab.
yield test_mute_tab(tab, icon, false);
// Now click on the tab.
let image = document.getAnonymousElementByAttribute(tab, "anonid", "tab-icon-image");
EventUtils.synthesizeMouseAtCenter(image, {button: 0});
is(tab, gBrowser.selectedTab, "Tab switch should be successful");
// Cleanup.
gBrowser.unpinTab(tab);
gBrowser.selectedTab = originallySelectedTab;
}
let originallySelectedTab = gBrowser.selectedTab;
yield BrowserTestUtils.withNewTab({
gBrowser,
url: PAGE
}, test_on_browser);
}
function* test_on_browser(browser) {
let tab = gBrowser.getTabForBrowser(browser);
@ -180,6 +232,8 @@ function* test_on_browser(browser) {
}, () => test_on_browser(browser));
} else {
yield test_browser_swapping(tab, browser);
yield test_click_on_pinned_tab_after_mute();
}
}