diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml index eb62e9b856f..673c5d8d456 100644 --- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -4256,7 +4256,7 @@ this.setIcon(tab, icon); ]]> - + - + NotifyObservers( ToSupports(mWindow), - "media-playback", + "audio-playback", mActive ? NS_LITERAL_STRING("active").get() : NS_LITERAL_STRING("inactive").get()); } diff --git a/dom/base/test/test_audioNotification.html b/dom/base/test/test_audioNotification.html index b035ecd9295..ce173d6fab2 100644 --- a/dom/base/test/test_audioNotification.html +++ b/dom/base/test/test_audioNotification.html @@ -17,7 +17,7 @@ var expectedNotification = null; var observer = { observe: function(subject, topic, data) { - is(topic, "media-playback", "media-playback received"); + is(topic, "audio-playback", "audio-playback received"); is(data, expectedNotification, "This is the right notification"); runTest(); } @@ -35,7 +35,7 @@ var tests = [ }, function() { - observerService.addObserver(observer, "media-playback", false); + observerService.addObserver(observer, "audio-playback", false); ok(true, "Observer set"); runTest(); }, @@ -51,7 +51,7 @@ var tests = [ }, function() { - observerService.removeObserver(observer, "media-playback"); + observerService.removeObserver(observer, "audio-playback"); ok(true, "Observer removed"); runTest(); } diff --git a/dom/base/test/test_audioNotificationStopOnNavigation.html b/dom/base/test/test_audioNotificationStopOnNavigation.html index 181f84c5c14..5d1db443776 100644 --- a/dom/base/test/test_audioNotificationStopOnNavigation.html +++ b/dom/base/test/test_audioNotificationStopOnNavigation.html @@ -19,7 +19,7 @@ var iframe = null; var observer = { observe: function(subject, topic, data) { - is(topic, "media-playback", "media-playback received"); + is(topic, "audio-playback", "audio-playback received"); is(data, expectedNotification, "This is the right notification"); runTest(); } @@ -35,7 +35,7 @@ var tests = [ }, function() { - observerService.addObserver(observer, "media-playback", false); + observerService.addObserver(observer, "audio-playback", false); ok(true, "Observer set"); runTest(); }, @@ -51,7 +51,7 @@ var tests = [ }, function() { - observerService.removeObserver(observer, "media-playback"); + observerService.removeObserver(observer, "audio-playback"); ok(true, "Observer removed"); runTest(); } diff --git a/dom/base/test/test_noAudioNotification.html b/dom/base/test/test_noAudioNotification.html index 6fa19ce7bfb..fdb8487e104 100644 --- a/dom/base/test/test_noAudioNotification.html +++ b/dom/base/test/test_noAudioNotification.html @@ -15,7 +15,7 @@ SimpleTest.waitForExplicitFinish(); var observer = { observe: function(subject, topic, data) { - ok(false, "should not receive media-playback notification!"); + ok(false, "should not receive audio-playback notification!"); } }; @@ -27,7 +27,7 @@ video.loop = true; video.src = "noaudio.webm"; video.onplay = video.onpause = function() { - // Yield to the event loop a few times to make sure that media-playback is not dispatched. + // Yield to the event loop a few times to make sure that audio-playback is not dispatched. SimpleTest.executeSoon(function() { SimpleTest.executeSoon(function() { SimpleTest.executeSoon(function() { @@ -43,7 +43,7 @@ var tests = [ }, function() { - observerService.addObserver(observer, "media-playback", false); + observerService.addObserver(observer, "audio-playback", false); ok(true, "Observer set"); runTest(); }, @@ -57,7 +57,7 @@ var tests = [ }, function() { - observerService.removeObserver(observer, "media-playback"); + observerService.removeObserver(observer, "audio-playback"); ok(true, "Observer removed"); runTest(); } diff --git a/dom/base/test/test_noAudioNotificationOnMutedElement.html b/dom/base/test/test_noAudioNotificationOnMutedElement.html index aa6778b60d6..3fc12ed42d8 100644 --- a/dom/base/test/test_noAudioNotificationOnMutedElement.html +++ b/dom/base/test/test_noAudioNotificationOnMutedElement.html @@ -18,11 +18,11 @@ var expectedNotification = null; var observer = { observe: function(subject, topic, data) { if (expectedNotification !== null) { - is(topic, "media-playback", "media-playback received"); + is(topic, "audio-playback", "audio-playback received"); is(data, expectedNotification, "This is the right notification"); runTest(); } else { - ok(false, "should not receive media-playback notification!"); + ok(false, "should not receive audio-playback notification!"); } } }; @@ -39,7 +39,7 @@ var tests = [ }, function() { - observerService.addObserver(observer, "media-playback", false); + observerService.addObserver(observer, "audio-playback", false); ok(true, "Observer set"); audio.src = "audio.ogg"; @@ -82,7 +82,7 @@ var tests = [ function() { expectedNotification = null; audio.onpause = function() { - // Yield to the event loop a few times to make sure that media-playback is not dispatched. + // Yield to the event loop a few times to make sure that audio-playback is not dispatched. SimpleTest.executeSoon(function() { SimpleTest.executeSoon(function() { SimpleTest.executeSoon(function() { @@ -98,7 +98,7 @@ var tests = [ function() { expectedNotification = null; audio.muted = false; - // Yield to the event loop a few times to make sure that media-playback is not dispatched. + // Yield to the event loop a few times to make sure that audio-playback is not dispatched. SimpleTest.executeSoon(function() { SimpleTest.executeSoon(function() { SimpleTest.executeSoon(function() { @@ -109,7 +109,7 @@ var tests = [ }, function() { - observerService.removeObserver(observer, "media-playback"); + observerService.removeObserver(observer, "audio-playback"); ok(true, "Observer removed"); runTest(); } diff --git a/dom/base/test/test_noAudioNotificationOnMutedOrVolume0Element.html b/dom/base/test/test_noAudioNotificationOnMutedOrVolume0Element.html index 69a17c063b0..ceda06e287d 100644 --- a/dom/base/test/test_noAudioNotificationOnMutedOrVolume0Element.html +++ b/dom/base/test/test_noAudioNotificationOnMutedOrVolume0Element.html @@ -18,11 +18,11 @@ var expectedNotification = null; var observer = { observe: function(subject, topic, data) { if (expectedNotification !== null) { - is(topic, "media-playback", "media-playback received"); + is(topic, "audio-playback", "audio-playback received"); is(data, expectedNotification, "This is the right notification"); runTest(); } else { - ok(false, "should not receive media-playback notification!"); + ok(false, "should not receive audio-playback notification!"); } } }; @@ -39,7 +39,7 @@ var tests = [ }, function() { - observerService.addObserver(observer, "media-playback", false); + observerService.addObserver(observer, "audio-playback", false); ok(true, "Observer set"); audio.src = "audio.ogg"; @@ -61,7 +61,7 @@ var tests = [ function() { expectedNotification = null; audio.volume = 0; - // Yield to the event loop a few times to make sure that media-playback is not dispatched. + // Yield to the event loop a few times to make sure that audio-playback is not dispatched. SimpleTest.executeSoon(function() { SimpleTest.executeSoon(function() { SimpleTest.executeSoon(function() { @@ -74,7 +74,7 @@ var tests = [ function() { expectedNotification = null; audio.muted = false; - // Yield to the event loop a few times to make sure that media-playback is not dispatched. + // Yield to the event loop a few times to make sure that audio-playback is not dispatched. SimpleTest.executeSoon(function() { SimpleTest.executeSoon(function() { SimpleTest.executeSoon(function() { @@ -108,7 +108,7 @@ var tests = [ function() { expectedNotification = null; audio.volume = 0; - // Yield to the event loop a few times to make sure that media-playback is not dispatched. + // Yield to the event loop a few times to make sure that audio-playback is not dispatched. SimpleTest.executeSoon(function() { SimpleTest.executeSoon(function() { SimpleTest.executeSoon(function() { @@ -121,7 +121,7 @@ var tests = [ function() { expectedNotification = null; audio.volume = 0.5; - // Yield to the event loop a few times to make sure that media-playback is not dispatched. + // Yield to the event loop a few times to make sure that audio-playback is not dispatched. SimpleTest.executeSoon(function() { SimpleTest.executeSoon(function() { SimpleTest.executeSoon(function() { @@ -142,7 +142,7 @@ var tests = [ }, function() { - observerService.removeObserver(observer, "media-playback"); + observerService.removeObserver(observer, "audio-playback"); ok(true, "Observer removed"); runTest(); } diff --git a/dom/base/test/test_noAudioNotificationOnVolume0Element.html b/dom/base/test/test_noAudioNotificationOnVolume0Element.html index c346b985582..fcd798292b0 100644 --- a/dom/base/test/test_noAudioNotificationOnVolume0Element.html +++ b/dom/base/test/test_noAudioNotificationOnVolume0Element.html @@ -18,11 +18,11 @@ var expectedNotification = null; var observer = { observe: function(subject, topic, data) { if (expectedNotification !== null) { - is(topic, "media-playback", "media-playback received"); + is(topic, "audio-playback", "audio-playback received"); is(data, expectedNotification, "This is the right notification"); runTest(); } else { - ok(false, "should not receive media-playback notification!"); + ok(false, "should not receive audio-playback notification!"); } } }; @@ -39,7 +39,7 @@ var tests = [ }, function() { - observerService.addObserver(observer, "media-playback", false); + observerService.addObserver(observer, "audio-playback", false); ok(true, "Observer set"); audio.src = "audio.ogg"; @@ -82,7 +82,7 @@ var tests = [ function() { expectedNotification = null; audio.onpause = function() { - // Yield to the event loop a few times to make sure that media-playback is not dispatched. + // Yield to the event loop a few times to make sure that audio-playback is not dispatched. SimpleTest.executeSoon(function() { SimpleTest.executeSoon(function() { SimpleTest.executeSoon(function() { @@ -98,7 +98,7 @@ var tests = [ function() { expectedNotification = null; audio.volume = 1; - // Yield to the event loop a few times to make sure that media-playback is not dispatched. + // Yield to the event loop a few times to make sure that audio-playback is not dispatched. SimpleTest.executeSoon(function() { SimpleTest.executeSoon(function() { SimpleTest.executeSoon(function() { @@ -109,7 +109,7 @@ var tests = [ }, function() { - observerService.removeObserver(observer, "media-playback"); + observerService.removeObserver(observer, "audio-playback"); ok(true, "Observer removed"); runTest(); } diff --git a/dom/base/test/test_pluginAudioNotification.html b/dom/base/test/test_pluginAudioNotification.html index cbc68672b6a..8f26b5e4bb6 100644 --- a/dom/base/test/test_pluginAudioNotification.html +++ b/dom/base/test/test_pluginAudioNotification.html @@ -52,7 +52,7 @@ var iframe = null; var observer = { observe: function(subject, topic, data) { - is(topic, "media-playback", "media-playback received"); + is(topic, "audio-playback", "audio-playback received"); is(data, expectedNotification, "This is the right notification"); SimpleTest.executeSoon(runTest); } @@ -68,7 +68,7 @@ var tests = [ }, function() { - observerService.addObserver(observer, "media-playback", false); + observerService.addObserver(observer, "audio-playback", false); ok(true, "Observer set"); runTest(); }, @@ -93,7 +93,7 @@ var tests = [ }, function() { - observerService.removeObserver(observer, "media-playback"); + observerService.removeObserver(observer, "audio-playback"); ok(true, "Observer removed"); runTest(); } diff --git a/dom/base/test/test_webaudioNotification.html b/dom/base/test/test_webaudioNotification.html index 5197ac8d054..7b767e1c575 100644 --- a/dom/base/test/test_webaudioNotification.html +++ b/dom/base/test/test_webaudioNotification.html @@ -19,7 +19,7 @@ var iframe = null; var observer = { observe: function(subject, topic, data) { - is(topic, "media-playback", "media-playback received"); + is(topic, "audio-playback", "audio-playback received"); is(data, expectedNotification, "This is the right notification"); SimpleTest.executeSoon(runTest); } @@ -39,7 +39,7 @@ var tests = [ }, function() { - observerService.addObserver(observer, "media-playback", false); + observerService.addObserver(observer, "audio-playback", false); ok(true, "Observer set"); runTest(); }, @@ -60,7 +60,7 @@ var tests = [ }, function() { - observerService.removeObserver(observer, "media-playback"); + observerService.removeObserver(observer, "audio-playback"); ok(true, "Observer removed"); runTest(); } diff --git a/dom/base/test/test_webaudioNotificationStopOnNavigation.html b/dom/base/test/test_webaudioNotificationStopOnNavigation.html index 17941cc85e6..9a552a40fc3 100644 --- a/dom/base/test/test_webaudioNotificationStopOnNavigation.html +++ b/dom/base/test/test_webaudioNotificationStopOnNavigation.html @@ -19,7 +19,7 @@ var iframe = null; var observer = { observe: function(subject, topic, data) { - is(topic, "media-playback", "media-playback received"); + is(topic, "audio-playback", "audio-playback received"); is(data, expectedNotification, "This is the right notification"); runTest(); } @@ -35,7 +35,7 @@ var tests = [ }, function() { - observerService.addObserver(observer, "media-playback", false); + observerService.addObserver(observer, "audio-playback", false); ok(true, "Observer set"); runTest(); }, @@ -51,7 +51,7 @@ var tests = [ }, function() { - observerService.removeObserver(observer, "media-playback"); + observerService.removeObserver(observer, "audio-playback"); ok(true, "Observer removed"); runTest(); } diff --git a/dom/browser-element/BrowserElementChildPreload.js b/dom/browser-element/BrowserElementChildPreload.js index a40536c9447..4f69f740add 100644 --- a/dom/browser-element/BrowserElementChildPreload.js +++ b/dom/browser-element/BrowserElementChildPreload.js @@ -55,7 +55,7 @@ let CERTIFICATE_ERROR_PAGE_PREF = 'security.alternate_certificate_error_page'; const OBSERVED_EVENTS = [ 'xpcom-shutdown', - 'media-playback', + 'audio-playback', 'activity-done', 'invalid-widget' ]; @@ -288,7 +288,7 @@ BrowserElementChild.prototype = { // Ignore notifications not about our document. (Note that |content| /can/ // be null; see bug 874900.) - if (topic !== 'activity-done' && topic !== 'media-playback' && + if (topic !== 'activity-done' && topic !== 'audio-playback' && (!content || subject !== content.document)) { return; } @@ -298,7 +298,7 @@ BrowserElementChild.prototype = { case 'activity-done': sendAsyncMsg('activitydone', { success: (data == 'activity-success') }); break; - case 'media-playback': + case 'audio-playback': if (subject === content) { sendAsyncMsg('audioplaybackchange', { _payload_: data }); } diff --git a/toolkit/content/browser-content.js b/toolkit/content/browser-content.js index 03406fc39c3..90420a25df9 100644 --- a/toolkit/content/browser-content.js +++ b/toolkit/content/browser-content.js @@ -689,26 +689,26 @@ addMessageListener("WebChannelMessageToContent", function (e) { } }); -let MediaPlaybackListener = { +let AudioPlaybackListener = { QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]), init() { - Services.obs.addObserver(this, "media-playback", false); - addMessageListener("MediaPlaybackMute", this); + Services.obs.addObserver(this, "audio-playback", false); + addMessageListener("AudioPlaybackMute", this); addEventListener("unload", () => { - MediaPlaybackListener.uninit(); + AudioPlaybackListener.uninit(); }); }, uninit() { - Services.obs.removeObserver(this, "media-playback"); - removeMessageListener("MediaPlaybackMute", this); + Services.obs.removeObserver(this, "audio-playback"); + removeMessageListener("AudioPlaybackMute", this); }, observe(subject, topic, data) { - if (topic === "media-playback") { + if (topic === "audio-playback") { if (subject && subject.top == global.content) { - let name = "MediaPlayback:"; + let name = "AudioPlayback:"; name += (data === "active") ? "Start" : "Stop"; sendAsyncMessage(name); } @@ -716,11 +716,11 @@ let MediaPlaybackListener = { }, receiveMessage(msg) { - if (msg.name == "MediaPlaybackMute") { + if (msg.name == "AudioPlaybackMute") { let utils = global.content.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIDOMWindowUtils); utils.audioMuted = msg.data.type === "mute"; } }, }; -MediaPlaybackListener.init(); +AudioPlaybackListener.init(); diff --git a/toolkit/content/tests/browser/browser_mediaPlayback.js b/toolkit/content/tests/browser/browser_mediaPlayback.js index 9b723aafcaf..6e8ed68dcc5 100644 --- a/toolkit/content/tests/browser/browser_mediaPlayback.js +++ b/toolkit/content/tests/browser/browser_mediaPlayback.js @@ -10,8 +10,8 @@ function wait_for_event(browser, event) { function* test_on_browser(url, browser) { browser.loadURI(url); - yield wait_for_event(browser, "DOMMediaPlaybackStarted"); - yield wait_for_event(browser, "DOMMediaPlaybackStopped"); + yield wait_for_event(browser, "DOMAudioPlaybackStarted"); + yield wait_for_event(browser, "DOMAudioPlaybackStopped"); } add_task(function*() { diff --git a/toolkit/content/tests/browser/browser_mediaPlayback_mute.js b/toolkit/content/tests/browser/browser_mediaPlayback_mute.js index e0f1b9f660c..311a23b0a63 100644 --- a/toolkit/content/tests/browser/browser_mediaPlayback_mute.js +++ b/toolkit/content/tests/browser/browser_mediaPlayback_mute.js @@ -33,7 +33,7 @@ function* test_audio_in_browser() { function* test_on_browser(url, browser) { browser.loadURI(url); - yield wait_for_event(browser, "DOMMediaPlaybackStarted"); + yield wait_for_event(browser, "DOMAudioPlaybackStarted"); var result = yield ContentTask.spawn(browser, null, test_audio_in_browser); is(result.computedVolume, 1, "Audio volume is 1"); @@ -43,7 +43,7 @@ function* test_on_browser(url, browser) { browser.mute(); ok(browser.audioMuted, "Audio should be muted now"); - yield wait_for_event(browser, "DOMMediaPlaybackStopped"); + yield wait_for_event(browser, "DOMAudioPlaybackStopped"); result = yield ContentTask.spawn(browser, null, test_audio_in_browser); is(result.computedVolume, 0, "Audio volume is 0 when muted"); @@ -52,7 +52,7 @@ function* test_on_browser(url, browser) { function* test_visibility(url, browser) { browser.loadURI(url); - yield wait_for_event(browser, "DOMMediaPlaybackStarted"); + yield wait_for_event(browser, "DOMAudioPlaybackStarted"); var result = yield ContentTask.spawn(browser, null, test_audio_in_browser); is(result.computedVolume, 1, "Audio volume is 1"); @@ -67,7 +67,7 @@ function* test_visibility(url, browser) { url: "about:blank", }, function() {}); - yield wait_for_event(browser, "DOMMediaPlaybackStopped"); + yield wait_for_event(browser, "DOMAudioPlaybackStopped"); result = yield ContentTask.spawn(browser, null, test_audio_in_browser); is(result.computedVolume, 0, "Audio volume is 0 when muted"); diff --git a/toolkit/content/widgets/browser.xml b/toolkit/content/widgets/browser.xml index 34c2472140b..6ad1ce56f67 100644 --- a/toolkit/content/widgets/browser.xml +++ b/toolkit/content/widgets/browser.xml @@ -663,21 +663,21 @@ onget="return this.blockedPopups;" readonly="true"/> - + - + @@ -692,7 +692,7 @@ @@ -702,7 +702,7 @@ @@ -858,8 +858,8 @@ this.messageManager.addMessageListener("PopupBlocking:UpdateBlockedPopups", this); this.messageManager.addMessageListener("Autoscroll:Start", this); this.messageManager.addMessageListener("Autoscroll:Cancel", this); - this.messageManager.addMessageListener("MediaPlayback:Start", this); - this.messageManager.addMessageListener("MediaPlayback:Stop", this); + this.messageManager.addMessageListener("AudioPlayback:Start", this); + this.messageManager.addMessageListener("AudioPlayback:Stop", this); } ]]> @@ -946,11 +946,11 @@ case "Autoscroll:Cancel": this._autoScrollPopup.hidePopup(); break; - case "MediaPlayback:Start": - this.mediaPlaybackStarted(); + case "AudioPlayback:Start": + this.audioPlaybackStarted(); break; - case "MediaPlayback:Stop": - this.mediaPlaybackStopped(); + case "AudioPlayback:Stop": + this.audioPlaybackStopped(); break; } ]]>