Bug 1200673 - Try to create the audio channel agent in the constructor for AutoNotifyAudioChannelAgent too; r=baku a=sylvestre
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 01 Sep 2015 12:01:49 -0400
changeset 289106 de1f4476b12cac70c2b08d711c4d35dc4d438d17
parent 289105 530b62fff9e79e4744f6e77937c29c9550f08eb9
child 289107 1cb1b8329d35a3896ffcbdc00d9ff889ad91eb52
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku, sylvestre
bugs1200673
milestone42.0a2
Bug 1200673 - Try to create the audio channel agent in the constructor for AutoNotifyAudioChannelAgent too; r=baku a=sylvestre Landed on a CLOSED TREE
dom/html/HTMLMediaElement.cpp
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -125,17 +125,20 @@ public:
   AutoNotifyAudioChannelAgent(mozilla::dom::HTMLMediaElement* aElement,
                               bool aNotify
                               MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
     : mElement(aElement)
     , mShouldNotify(aNotify)
   {
     MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     if (mShouldNotify) {
-      mElement->NotifyAudioChannelAgent(false);
+      // The audio channel agent may not exist now.
+      if (mElement->MaybeCreateAudioChannelAgent()) {
+        mElement->NotifyAudioChannelAgent(false);
+      }
     }
   }
   ~AutoNotifyAudioChannelAgent()
   {
     if (mShouldNotify) {
       // The audio channel agent is destroyed at this point.
       if (mElement->MaybeCreateAudioChannelAgent()) {
         mElement->NotifyAudioChannelAgent(true);