Bug 1263647 - When receiving a TabPreZombify event, send out a Tab:AudioPlayingChange message only if the tab is actually playing some audio. r=margaret draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Mon, 11 Apr 2016 18:06:20 +0200
changeset 350087 8ac5b517beb55e35008521383c8f6ebb0b85d1e9
parent 349384 e847cfcb315f511f4928b03fd47dcf57aad05e1e
child 518246 4cbfc0c67c701644997d91ec8e6788f79c59472b
push id15244
push usermozilla@buttercookie.de
push dateTue, 12 Apr 2016 20:50:44 +0000
reviewersmargaret
bugs1263647
milestone48.0a1
Bug 1263647 - When receiving a TabPreZombify event, send out a Tab:AudioPlayingChange message only if the tab is actually playing some audio. r=margaret MozReview-Commit-ID: 7eAc2mNgM42
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -4081,19 +4081,25 @@ Tab.prototype = {
         Messaging.sendRequest({
           type: "DOMTitleChanged",
           tabID: this.id,
           title: truncate(aEvent.target.title, MAX_TITLE_LENGTH)
         });
         break;
       }
 
+      case "TabPreZombify": {
+        if (!this.playingAudio) {
+          return;
+        }
+        // Fall through to the DOMAudioPlayback events, so the
+        // audio playback indicator gets reset upon zombification.
+      }
       case "DOMAudioPlaybackStarted":
-      case "DOMAudioPlaybackStopped":
-      case "TabPreZombify": {
+      case "DOMAudioPlaybackStopped": {
         if (!Services.prefs.getBoolPref("browser.tabs.showAudioPlayingIcon") ||
             !aEvent.isTrusted) {
           return;
         }
 
         let browser = aEvent.originalTarget;
         if (browser != this.browser) {
           return;