Bug 1276119 - part1: don't call WindowSuspendChanged if the plugin is already muted. draft
authorAlastor Wu <alwu@mozilla.com>
Mon, 30 May 2016 19:49:29 +0800
changeset 372851 d4ad9834b4b07f76dfec6bb33b9dc86fe4ad6d69
parent 371902 4d63dde701b47b8661ab7990f197b6b60e543839
child 372852 48f9aa4f338aecab8e68e958abdeeb5fb523dba8
push id19608
push useralwu@mozilla.com
push dateMon, 30 May 2016 11:50:21 +0000
bugs1276119
milestone49.0a1
Bug 1276119 - part1: don't call WindowSuspendChanged if the plugin is already muted. MozReview-Commit-ID: IqdOot2k4G9
dom/plugins/base/nsNPAPIPlugin.cpp
--- a/dom/plugins/base/nsNPAPIPlugin.cpp
+++ b/dom/plugins/base/nsNPAPIPlugin.cpp
@@ -2298,16 +2298,23 @@ NPError
           return NPERR_NO_ERROR;
         }
 
         rv = inst->WindowVolumeChanged(config.mVolume, config.mMuted);
         if (NS_WARN_IF(NS_FAILED(rv))) {
           return NPERR_NO_ERROR;
         }
 
+        // Since we only support for muting now, the implementation of suspend
+        // is equal to muting. Therefore, if we have already muted the plugin,
+        // then we don't need to call WindowSuspendChanged() again.
+        if (config.mMuted) {
+          return NPERR_NO_ERROR;
+        }
+
         rv = inst->WindowSuspendChanged(config.mSuspend);
         if (NS_WARN_IF(NS_FAILED(rv))) {
           return NPERR_NO_ERROR;
         }
       }
 
       return NPERR_NO_ERROR;
     }