From a7df632ec020854cf4f6cdfb89a1919d63ba36f4 Mon Sep 17 00:00:00 2001 From: James Willcox Date: Wed, 5 Oct 2011 14:43:16 -0400 Subject: [PATCH] Bug 692200 - Make 'plugins.force.wmode' pref override any other wmode From 1c3c36534accbc956a5b88278ebc165626c8a8f0 Mon Sep 17 00:00:00 2001 This also enables the preference on Android. We need this because the fix for bug 692200 breaks 32bit support, which is used in 'transparent' (and probably other) wmodes. We force it to 'opaque' to avoid this. --HG-- extra : rebase_source : 9f9a555577090cafb7245c26d6eee09a37d5d964 --- dom/plugins/base/nsNPAPIPluginInstance.cpp | 5 ++++ dom/plugins/base/nsPluginInstanceOwner.cpp | 29 ++++++++++++++++------ mobile/app/mobile.js | 2 -- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/dom/plugins/base/nsNPAPIPluginInstance.cpp b/dom/plugins/base/nsNPAPIPluginInstance.cpp index ca6c5298ee3..30d91220328 100644 --- a/dom/plugins/base/nsNPAPIPluginInstance.cpp +++ b/dom/plugins/base/nsNPAPIPluginInstance.cpp @@ -338,7 +338,12 @@ nsNPAPIPluginInstance::InitializePlugin() const char* const* pnames = nsnull; const char* const* pvalues = nsnull; if (NS_SUCCEEDED(GetParameters(pcount, pnames, pvalues))) { + // Android expects an empty string as the separator instead of null +#ifdef ANDROID + NS_ASSERTION(PL_strcmp(values[count], "") == 0, "attribute/parameter array not setup correctly for Android NPAPI plugins"); +#else NS_ASSERTION(!values[count], "attribute/parameter array not setup correctly for NPAPI plugins"); +#endif if (pcount) count += ++pcount; // if it's all setup correctly, then all we need is to // change the count (attrs + PARAM/blank + params) diff --git a/dom/plugins/base/nsPluginInstanceOwner.cpp b/dom/plugins/base/nsPluginInstanceOwner.cpp index c9089a66d88..1e2ac78023d 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.cpp +++ b/dom/plugins/base/nsPluginInstanceOwner.cpp @@ -1233,12 +1233,9 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays() // Set to the next slot to fill in name and value cache arrays. PRUint32 nextAttrParamIndex = 0; - // Potentially add WMODE attribute. - if (!wmodeType.IsEmpty()) { - mCachedAttrParamNames [nextAttrParamIndex] = ToNewUTF8String(NS_LITERAL_STRING("wmode")); - mCachedAttrParamValues[nextAttrParamIndex] = ToNewUTF8String(NS_ConvertUTF8toUTF16(wmodeType)); - nextAttrParamIndex++; - } + // Whether or not we force the wmode below while traversing + // the name/value pairs. + bool wmodeSet = false; // Add attribute name/value pairs. for (PRInt32 index = start; index != end; index += increment) { @@ -1252,7 +1249,25 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays() FixUpURLS(name, value); mCachedAttrParamNames [nextAttrParamIndex] = ToNewUTF8String(name); - mCachedAttrParamValues[nextAttrParamIndex] = ToNewUTF8String(value); + if (!wmodeType.IsEmpty() && + 0 == PL_strcasecmp(mCachedAttrParamNames[nextAttrParamIndex], "wmode")) { + mCachedAttrParamValues[nextAttrParamIndex] = ToNewUTF8String(NS_ConvertUTF8toUTF16(wmodeType)); + + if (!wmodeSet) { + // We allocated space to add a wmode attr, but we don't need it now. + mNumCachedAttrs--; + wmodeSet = true; + } + } else { + mCachedAttrParamValues[nextAttrParamIndex] = ToNewUTF8String(value); + } + nextAttrParamIndex++; + } + + // Potentially add WMODE attribute. + if (!wmodeType.IsEmpty() && !wmodeSet) { + mCachedAttrParamNames [nextAttrParamIndex] = ToNewUTF8String(NS_LITERAL_STRING("wmode")); + mCachedAttrParamValues[nextAttrParamIndex] = ToNewUTF8String(NS_ConvertUTF8toUTF16(wmodeType)); nextAttrParamIndex++; } diff --git a/mobile/app/mobile.js b/mobile/app/mobile.js index 8f377b1c38f..b5a63a80922 100644 --- a/mobile/app/mobile.js +++ b/mobile/app/mobile.js @@ -376,9 +376,7 @@ pref("privacy.item.geolocation", true); pref("privacy.item.siteSettings", true); pref("privacy.item.syncAccount", true); -#ifdef MOZ_PLATFORM_MAEMO pref("plugins.force.wmode", "opaque"); -#endif // URL to the Learn More link XXX this is the firefox one. Bug 495578 fixes this. pref("browser.geolocation.warning.infoURL", "http://www.mozilla.com/%LOCALE%/firefox/geolocation/");