Bug 1260113 - Part 1 - Inform the Java UI to stop displaying the audio playback icon for zombified tabs. r=margaret
authorJan Henning <jh+bugzilla@buttercookie.de>
Mon, 28 Mar 2016 15:50:28 +0100
changeset 290859 e47ddbd75bb0cd2b1afe4c720ed38c87e94d87a2
parent 290858 f3160a1e4fb6e866cad99f8b183a456f258c7f17
child 290860 d6acac6649a37bfda6c6c8cb6cde9972bb56ffbb
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs1260113
milestone48.0a1
Bug 1260113 - Part 1 - Inform the Java UI to stop displaying the audio playback icon for zombified tabs. r=margaret When a tab is zombified, its original tab object is destroyed and replaced by a new copy set for delay loading. This stops audio playback, but doesn't invoke the normal DOMAudioPlaybackStopped event. Because of this, we continue displaying the audio playback indicator in the tabs tray after a zombification, even though the audio itself has stopped. With this patch, the zombification routine now notifies the UI to stop showing the audio playback indicator if neccessary. MozReview-Commit-ID: 7oh4d6XP61K
mobile/android/chrome/content/MemoryObserver.js
--- a/mobile/android/chrome/content/MemoryObserver.js
+++ b/mobile/android/chrome/content/MemoryObserver.js
@@ -38,16 +38,27 @@ var MemoryObserver = {
     defaults.setIntPref("browser.sessionhistory.max_total_viewers", 0);
   },
 
   zombify: function(tab) {
     let browser = tab.browser;
     let data = browser.__SS_data;
     let extra = browser.__SS_extdata;
 
+    // Destroying the tab will stop audio playback without invoking the
+    // normal events, therefore we need to explicitly tell the Java UI
+    // to stop displaying the audio playing indicator.
+    if (tab.playingAudio) {
+      Messaging.sendRequest({
+        type: "Tab:AudioPlayingChange",
+        tabID: tab.id,
+        isAudioPlaying: false
+      });
+    }
+
     // We need this data to correctly create and position the new browser
     // If this browser is already a zombie, fallback to the session data
     let currentURL = browser.__SS_restore ? data.entries[0].url : browser.currentURI.spec;
     let sibling = browser.nextSibling;
     let isPrivate = PrivateBrowsingUtils.isBrowserPrivate(browser);
 
     tab.destroy();
     tab.create(currentURL, { sibling: sibling, zombifying: true, delayLoad: true, isPrivate: isPrivate });