Bug 1348803 - part2 : modify event name to lower case letter. r=sebastian
authorAlastor Wu <alwu@mozilla.com>
Tue, 18 Apr 2017 11:04:17 +0800
changeset 353567 af746f31572fe889ea1f0725657cc837ed9d5221
parent 353566 e8be047fc5c9b8b0711563f3495620467a896ceb
child 353568 0a15bd769093aea709311db221e11a62fb2983c0
push id31673
push userkwierso@gmail.com
push dateTue, 18 Apr 2017 21:23:54 +0000
treeherdermozilla-central@1a81aadc2510 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs1348803
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1348803 - part2 : modify event name to lower case letter. r=sebastian Other events in browser.js are all lower case letter, also change these two to make them consistent. MozReview-Commit-ID: LkzYUo6OrEA
mobile/android/base/java/org/mozilla/gecko/media/AudioFocusAgent.java
mobile/android/base/java/org/mozilla/gecko/media/MediaControlService.java
mobile/android/chrome/content/browser.js
--- a/mobile/android/base/java/org/mozilla/gecko/media/AudioFocusAgent.java
+++ b/mobile/android/base/java/org/mozilla/gecko/media/AudioFocusAgent.java
@@ -51,38 +51,38 @@ public class AudioFocusAgent {
         mContext = context;
         mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
 
         mAfChangeListener = new OnAudioFocusChangeListener() {
             public void onAudioFocusChange(int focusChange) {
                 switch (focusChange) {
                     case AudioManager.AUDIOFOCUS_LOSS:
                         Log.d(LOGTAG, "onAudioFocusChange, AUDIOFOCUS_LOSS");
-                        notifyObservers("AudioFocusChanged", "lostAudioFocus");
+                        notifyObservers("audioFocusChanged", "lostAudioFocus");
                         notifyMediaControlService(MediaControlService.ACTION_PAUSE_BY_AUDIO_FOCUS);
                         mAudioFocusState = LOST_FOCUS;
                         break;
                     case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
                         Log.d(LOGTAG, "onAudioFocusChange, AUDIOFOCUS_LOSS_TRANSIENT");
-                        notifyObservers("AudioFocusChanged", "lostAudioFocusTransiently");
+                        notifyObservers("audioFocusChanged", "lostAudioFocusTransiently");
                         notifyMediaControlService(MediaControlService.ACTION_PAUSE_BY_AUDIO_FOCUS);
                         mAudioFocusState = LOST_FOCUS_TRANSIENT;
                         break;
                     case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
                         Log.d(LOGTAG, "onAudioFocusChange, AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK");
                         notifyMediaControlService(MediaControlService.ACTION_START_AUDIO_DUCK);
                         mAudioFocusState = LOST_FOCUS_TRANSIENT_CAN_DUCK;
                         break;
                     case AudioManager.AUDIOFOCUS_GAIN:
                         if (mAudioFocusState.equals(LOST_FOCUS_TRANSIENT_CAN_DUCK)) {
                             Log.d(LOGTAG, "onAudioFocusChange, AUDIOFOCUS_GAIN (from DUCKING)");
                             notifyMediaControlService(MediaControlService.ACTION_STOP_AUDIO_DUCK);
                         } else if (mAudioFocusState.equals(LOST_FOCUS_TRANSIENT)) {
                             Log.d(LOGTAG, "onAudioFocusChange, AUDIOFOCUS_GAIN");
-                            notifyObservers("AudioFocusChanged", "gainAudioFocus");
+                            notifyObservers("audioFocusChanged", "gainAudioFocus");
                             notifyMediaControlService(MediaControlService.ACTION_RESUME_BY_AUDIO_FOCUS);
                         }
                         mAudioFocusState = OWN_FOCUS;
                         break;
                     default:
                 }
             }
         };
--- a/mobile/android/base/java/org/mozilla/gecko/media/MediaControlService.java
+++ b/mobile/android/base/java/org/mozilla/gecko/media/MediaControlService.java
@@ -307,33 +307,33 @@ public class MediaControlService extends
                 }
             }
 
             @Override
             public void onPlay() {
                 Log.d(LOGTAG, "Controller, onPlay");
                 super.onPlay();
                 setState(State.PLAYING);
-                notifyObservers("MediaControl", "resumeMedia");
+                notifyObservers("mediaControl", "resumeMedia");
             }
 
             @Override
             public void onPause() {
                 Log.d(LOGTAG, "Controller, onPause");
                 super.onPause();
                 setState(State.PAUSED);
-                notifyObservers("MediaControl", "mediaControlPaused");
+                notifyObservers("mediaControl", "mediaControlPaused");
             }
 
             @Override
             public void onStop() {
                 Log.d(LOGTAG, "Controller, onStop");
                 super.onStop();
                 setState(State.STOPPED);
-                notifyObservers("MediaControl", "mediaControlStopped");
+                notifyObservers("mediaControl", "mediaControlStopped");
                 mTabReference = new WeakReference<>(null);
             }
         });
 
     }
 
     private void notifyObservers(String topic, String data) {
         GeckoAppShell.notifyObservers(topic, data);
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -3638,17 +3638,17 @@ Tab.prototype = {
     this.browser.addEventListener("TabPreZombify", this, true);
     this.browser.addEventListener("DOMWindowFocus", this, true);
 
     // Note that the XBL binding is untrusted
     this.browser.addEventListener("PluginBindingAttached", this, true, true);
     this.browser.addEventListener("VideoBindingAttached", this, true, true);
     this.browser.addEventListener("VideoBindingCast", this, true, true);
 
-    Services.obs.addObserver(this, "AudioFocusChanged", false);
+    Services.obs.addObserver(this, "audioFocusChanged", false);
     Services.obs.addObserver(this, "before-first-paint");
     Services.obs.addObserver(this, "media-playback");
 
     // Always initialise new tabs with basic session store data to avoid
     // problems with functions that always expect it to be present
     this.browser.__SS_data = {
       entries: [{
         url: aURL,
@@ -3753,17 +3753,17 @@ Tab.prototype = {
     this.browser.removeEventListener("MozApplicationManifest", this, true);
     this.browser.removeEventListener("TabPreZombify", this, true);
     this.browser.removeEventListener("DOMWindowFocus", this, true);
 
     this.browser.removeEventListener("PluginBindingAttached", this, true, true);
     this.browser.removeEventListener("VideoBindingAttached", this, true, true);
     this.browser.removeEventListener("VideoBindingCast", this, true, true);
 
-    Services.obs.removeObserver(this, "AudioFocusChanged");
+    Services.obs.removeObserver(this, "audioFocusChanged");
     Services.obs.removeObserver(this, "before-first-paint");
     Services.obs.removeObserver(this, "media-playback");
 
     // Make sure the previously selected panel remains selected. The selected panel of a deck is
     // not stable when panels are removed.
     let selectedPanel = BrowserApp.deck.selectedPanel;
     BrowserApp.deck.removeChild(this.browser);
     BrowserApp.deck.selectedPanel = selectedPanel;
@@ -4593,20 +4593,20 @@ Tab.prototype = {
 
   UpdateMediaPlaybackRelatedObserver: function(active) {
     // Media control is only used for the tab which has playing media, so we
     // only need to register observer after having the active media. And the
     // "media-playback-resumed" is sent when user resume paused media from
     // page, it notifies us that we should change the icon and content in media
     // control interface.
     if (active) {
-      Services.obs.addObserver(this, "MediaControl", false);
+      Services.obs.addObserver(this, "mediaControl", false);
       Services.obs.addObserver(this, "media-playback-resumed", false);
     } else {
-      Services.obs.removeObserver(this, "MediaControl");
+      Services.obs.removeObserver(this, "mediaControl");
       Services.obs.removeObserver(this, "media-playback-resumed");
     }
   },
 
   ShouldNotifyMediaPlaybackChange: function(activeState) {
     // If the media is active, we would check it's duration, because we don't
     // want to show the media control interface for the short sound which
     // duration is smaller than the threshold. The basic unit is second.
@@ -4677,18 +4677,18 @@ Tab.prototype = {
 
         GlobalEventDispatcher.sendRequest({
           type: "Tab:MediaPlaybackChange",
           tabID: this.id,
           status: status
         });
         break;
 
-      case "AudioFocusChanged":
-      case "MediaControl":
+      case "audioFocusChanged":
+      case "mediaControl":
         let win = this.browser.contentWindow;
         let utils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
         let suspendTypes = Ci.nsISuspendedTypes;
         switch (aData) {
           case "lostAudioFocus":
             utils.mediaSuspend = suspendTypes.SUSPENDED_PAUSE_DISPOSABLE;
             break;
           case "lostAudioFocusTransiently":