Bug 1337781 - Force Flash to be windowless on Linux, r?jimm
MozReview-Commit-ID: KuSqj0FwAXg
--- a/dom/plugins/ipc/PluginModuleParent.cpp
+++ b/dom/plugins/ipc/PluginModuleParent.cpp
@@ -2685,16 +2685,37 @@ PluginModuleParent::AccumulateModuleInit
GetPluginDetails();
}
Telemetry::Accumulate(Telemetry::BLOCKED_ON_PLUGIN_MODULE_INIT_MS,
GetHistogramKey(),
static_cast<uint32_t>(mTimeBlocked.ToMilliseconds()));
mTimeBlocked = TimeDuration();
}
+#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
+static void
+ForceWindowless(InfallibleTArray<nsCString>& names,
+ InfallibleTArray<nsCString>& values)
+{
+ nsCaseInsensitiveUTF8StringArrayComparator comparator;
+ NS_NAMED_LITERAL_CSTRING(wmodeAttributeName, "wmode");
+ NS_NAMED_LITERAL_CSTRING(opaqueAttributeValue, "opaque");
+ auto wmodeAttributeIndex =
+ names.IndexOf(wmodeAttributeName, 0, comparator);
+ if (wmodeAttributeIndex != names.NoIndex) {
+ if (!values[wmodeAttributeIndex].EqualsLiteral("transparent")) {
+ values[wmodeAttributeIndex].Assign(opaqueAttributeValue);
+ }
+ } else {
+ names.AppendElement(wmodeAttributeName);
+ values.AppendElement(opaqueAttributeValue);
+ }
+}
+#endif // windows or linux
+
nsresult
PluginModuleParent::NPP_NewInternal(NPMIMEType pluginType, NPP instance,
uint16_t mode,
InfallibleTArray<nsCString>& names,
InfallibleTArray<nsCString>& values,
NPSavedData* saved, NPError* error)
{
MOZ_ASSERT(names.Length() == values.Length());
@@ -2736,29 +2757,21 @@ PluginModuleParent::NPP_NewInternal(NPMI
// For 64-bit builds force windowless if the flash library doesn't support
// async rendering regardless of sandbox level.
if (!supportsAsyncRender) {
#else
// For 32-bit builds force windowless if the flash library doesn't support
// async rendering and the sandbox level is 2 or greater.
if (!supportsAsyncRender && mSandboxLevel >= 2) {
#endif
- NS_NAMED_LITERAL_CSTRING(wmodeAttributeName, "wmode");
- NS_NAMED_LITERAL_CSTRING(opaqueAttributeValue, "opaque");
- auto wmodeAttributeIndex =
- names.IndexOf(wmodeAttributeName, 0, comparator);
- if (wmodeAttributeIndex != names.NoIndex) {
- if (!values[wmodeAttributeIndex].EqualsLiteral("transparent")) {
- values[wmodeAttributeIndex].Assign(opaqueAttributeValue);
- }
- } else {
- names.AppendElement(wmodeAttributeName);
- values.AppendElement(opaqueAttributeValue);
- }
+ ForceWindowless(names, values);
}
+#elif defined(MOZ_WIDGET_GTK)
+ // We no longer support windowed mode on Linux.
+ ForceWindowless(names, values);
#endif
}
// Release the surrogate reference that was in pdata
RefPtr<PluginAsyncSurrogate> surrogate(
dont_AddRef(PluginAsyncSurrogate::Cast(instance)));
// Now replace it with the instance
instance->pdata = static_cast<PluginDataResolver*>(parentInstance);