Bug 1276119 - part1: don't call WindowSuspendChanged if the plugin is already muted.
MozReview-Commit-ID: IqdOot2k4G9
--- 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;
}