Bug 1287588 - Fix parameter ordering in embed tags; r=bsmedberg
authorKyle Machulis <kyle@nonpolynomial.com>
Thu, 18 Aug 2016 10:19:33 -0700
changeset 310145 1361e4b73c4b3d01e421669c0a8cad6e25c45bf4
parent 310144 b6174c5855f49d9ea91c588165f4728363ff5866
child 310146 4bd0ad73562bbeb34ba496b2a581827e8bc5c9c4
push id31532
push userryanvm@gmail.com
push dateFri, 19 Aug 2016 13:59:01 +0000
treeherderautoland@4f1e241f75a2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1287588 - Fix parameter ordering in embed tags; r=bsmedberg MozReview-Commit-ID: 75ferxsBTgs
--- a/dom/plugins/ipc/PluginModuleParent.cpp
+++ b/dom/plugins/ipc/PluginModuleParent.cpp
@@ -2682,16 +2682,17 @@ PluginModuleParent::AccumulateModuleInit
 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());
     if (mPluginName.IsEmpty()) {
         /** mTimeBlocked measures the time that the main thread has been blocked
          *  on plugin module initialization. As implemented, this is the sum of
          *  plugin-container launch + toolhelp32 snapshot + NP_Initialize.
          *  We don't accumulate its value until here because the plugin info
          *  for its histogram key is not available until *after* NP_Initialize.
@@ -2707,16 +2708,28 @@ PluginModuleParent::NPP_NewInternal(NPMI
         srcAttribute = values[srcAttributeIndex];
     nsDependentCString strPluginType(pluginType);
     PluginInstanceParent* parentInstance =
         new PluginInstanceParent(this, instance, strPluginType, mNPNIface);
     if (mIsFlashPlugin) {
+        // In Bug 1287588, we found out that if the salign attribute is before
+        // the scale attribute in embed parameters, flash objects render
+        // incorrectly. This is most likely due to an order of operations
+        // problem in the plugin itself. Bug 1264270 changes the order in which
+        // parameters were passed, causing this bug to trigger on pages that
+        // formerly worked. In order to keep things working the way they were in
+        // Firefox <= 48, we reverse the order of parameters, making sure it
+        // happens before we possibly appends more parameters. This should keep
+        // parameters in the same order as prior versions.
+        std::reverse(names.begin(), names.end());
+        std::reverse(values.begin(), values.end());
         parentInstance->InitMetadata(strPluginType, srcAttribute);
 #ifdef XP_WIN
         bool supportsAsyncRender = false;
 #ifdef _WIN64
         // For 64-bit builds force windowless if the flash library doesn't support
         // async rendering regardless of sandbox level.
         if (!supportsAsyncRender) {