From 573556a8343d9062a980c68cb4526145521dc2b3 Mon Sep 17 00:00:00 2001 From: YUKI Hiroshi Date: Thu, 19 Nov 2015 18:10:17 +0900 Subject: [PATCH] Store state of actual sound-playing for each tab --- modules/browser.js | 19 +++++++++++++++++++ modules/constants.js | 1 + 2 files changed, 20 insertions(+) diff --git a/modules/browser.js b/modules/browser.js index 3e5a018b..f84251d0 100644 --- a/modules/browser.js +++ b/modules/browser.js @@ -842,6 +842,11 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, { w.addEventListener('SSWindowStateBusy', this, false); ReferenceCounter.add('w,SSWindowStateBusy,TSTBrowser,false'); + b.addEventListener('DOMAudioPlaybackStarted', this, false); + ReferenceCounter.add('b,DOMAudioPlaybackStarted,TSTBrowser,false'); + b.addEventListener('DOMAudioPlaybackStopped', this, false); + ReferenceCounter.add('b,DOMAudioPlaybackStopped,TSTBrowser,false'); + b.addEventListener('nsDOMMultipleTabHandlerTabsClosing', this, false); ReferenceCounter.add('b,nsDOMMultipleTabHandlerTabsClosing,TSTBrowser,false'); @@ -2326,6 +2331,11 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, { w.removeEventListener('SSWindowStateBusy', this, false); ReferenceCounter.remove('w,SSWindowStateBusy,TSTBrowser,false'); + b.removeEventListener('DOMAudioPlaybackStarted', this, false); + ReferenceCounter.remove('b,DOMAudioPlaybackStarted,TSTBrowser,false'); + b.removeEventListener('DOMAudioPlaybackStopped', this, false); + ReferenceCounter.remove('b,DOMAudioPlaybackStopped,TSTBrowser,false'); + b.removeEventListener('nsDOMMultipleTabHandlerTabsClosing', this, false); ReferenceCounter.remove('b,nsDOMMultipleTabHandlerTabsClosing,TSTBrowser,false'); @@ -2995,6 +3005,15 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, { return this.needRestoreTree = true; + case 'DOMAudioPlaybackStarted': + this.setTabValue(this.getTabFromBrowser(aEvent.target), this.kREALLY_SOUND_PLAYING, true); + return; + + case 'DOMAudioPlaybackStopped': + this.deleteTabValue(this.getTabFromBrowser(aEvent.target), this.kREALLY_SOUND_PLAYING); + return; + + case 'nsDOMMultipleTabHandlerTabsClosing': if (!this.onTabsClosing(aEvent)) aEvent.preventDefault(); diff --git a/modules/constants.js b/modules/constants.js index a3578ce7..a4e98af3 100644 --- a/modules/constants.js +++ b/modules/constants.js @@ -61,6 +61,7 @@ var TreeStyleTabConstants = Object.freeze({ kALLOW_COLLAPSE : 'treestyletab-allow-subtree-collapse', kALLOW_STACK : 'treestyletab-stack-collapsed-tabs', kREMOVED : 'treestyletab-removed', + kREALLY_SOUND_PLAYING : 'treestyletab-really-sound-playing', kX_OFFSET : 'treestyletab-x-offset', kY_OFFSET : 'treestyletab-y-offset',