Bug 1287588 - Fix parameter ordering in embed tags. r=bsmedberg, a=ritu
authorKyle Machulis <kyle@nonpolynomial.com>
Thu, 18 Aug 2016 10:19:33 -0700
changeset 347837 ab917c9f7f7e9c8c9897e04ce5b1add02be6d722
parent 347836 b41ad28f49b25f11c30b917dbeacfe8afae0b7a4
child 347838 9429146dc481233ffa4c62cc41a8ff382fd2d690
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg, ritu
bugs1287588
milestone50.0a2
Bug 1287588 - Fix parameter ordering in embed tags. r=bsmedberg, a=ritu MozReview-Commit-ID: 75ferxsBTgs
dom/plugins/ipc/PluginModuleParent.cpp
--- a/dom/plugins/ipc/PluginModuleParent.cpp
+++ b/dom/plugins/ipc/PluginModuleParent.cpp
@@ -2682,16 +2682,17 @@ PluginModuleParent::AccumulateModuleInit
 
 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());
     if (mPluginName.IsEmpty()) {
         GetPluginDetails();
         InitQuirksModes(nsDependentCString(pluginType));
         /** 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;
         CallModuleSupportsAsyncRender(&supportsAsyncRender);
 #ifdef _WIN64
         // For 64-bit builds force windowless if the flash library doesn't support
         // async rendering regardless of sandbox level.
         if (!supportsAsyncRender) {