Bug 1118615 - Flash hangs in HiDPI mode on OS X running peopleroulette app. r=mstange a=sledru
authorSteven Michaud <smichaud@pobox.com>
Wed, 21 Jan 2015 11:38:46 -0600
changeset 249331 e40719240ccefd7c5bc8046f0a3eb8f9791d7d04
parent 249330 939fc9a9173acbe3f8f559e7754bb7f136b876c2
child 249332 d52b454d4cca0fb8cc430f9cd7f2c73d22f5c3e8
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange, sledru
bugs1118615
milestone37.0a2
Bug 1118615 - Flash hangs in HiDPI mode on OS X running peopleroulette app. r=mstange a=sledru
dom/plugins/base/nsNPAPIPlugin.cpp
dom/plugins/ipc/PluginInstanceChild.cpp
dom/plugins/ipc/PluginModuleChild.cpp
dom/plugins/ipc/PluginModuleChild.h
--- a/dom/plugins/base/nsNPAPIPlugin.cpp
+++ b/dom/plugins/base/nsNPAPIPlugin.cpp
@@ -2166,16 +2166,29 @@ NPError
     *(NPBool*)result = true;
     return NPERR_NO_ERROR;
   }
 
   case NPNVcontentsScaleFactor: {
     nsNPAPIPluginInstance *inst =
       (nsNPAPIPluginInstance *) (npp ? npp->ndata : nullptr);
     double scaleFactor = inst ? inst->GetContentsScaleFactor() : 1.0;
+    // Work around a Flash ActionScript bug that causes long hangs if
+    // Flash thinks HiDPI support is available. Adobe is tracking this as
+    // ADBE 3921114. If this turns out to be Adobe's fault and they fix it,
+    // we'll no longer need this quirk. See QUIRK_FLASH_HIDE_HIDPI_SUPPORT
+    // in PluginModuleChild.h, and also bug 1118615.
+    if (inst) {
+      const char *mimeType;
+      inst->GetMIMEType(&mimeType);
+      NS_NAMED_LITERAL_CSTRING(flash, "application/x-shockwave-flash");
+      if (!PL_strncasecmp(mimeType, flash.get(), flash.Length())) {
+        scaleFactor = 1.0;
+      }
+    }
     *(double*)result = scaleFactor;
     return NPERR_NO_ERROR;
   }
 #endif
 
 #ifdef MOZ_WIDGET_ANDROID
     case kLogInterfaceV0_ANPGetValue: {
       LOG("get log interface");
--- a/dom/plugins/ipc/PluginInstanceChild.cpp
+++ b/dom/plugins/ipc/PluginInstanceChild.cpp
@@ -478,17 +478,21 @@ PluginInstanceChild::NPN_GetValue(NPNVar
 #ifndef NP_NO_QUICKDRAW
     case NPNVsupportsQuickDrawBool: {
         *((NPBool*)aValue) = false;
         return NPERR_NO_ERROR;
     }
 #endif /* NP_NO_QUICKDRAW */
 
     case NPNVcontentsScaleFactor: {
-        *static_cast<double*>(aValue) = mContentsScaleFactor;
+        double scaleFactor = mContentsScaleFactor;
+        if (GetQuirks() & PluginModuleChild::QUIRK_FLASH_HIDE_HIDPI_SUPPORT) {
+          scaleFactor = 1.0;
+        }
+        *static_cast<double*>(aValue) = scaleFactor;
         return NPERR_NO_ERROR;
     }
 #endif /* XP_MACOSX */
 
 #ifdef DEBUG
     case NPNVjavascriptEnabledBool:
     case NPNVasdEnabledBool:
     case NPNVisOfflineBool:
--- a/dom/plugins/ipc/PluginModuleChild.cpp
+++ b/dom/plugins/ipc/PluginModuleChild.cpp
@@ -2113,16 +2113,17 @@ PluginModuleChild::InitQuirksModes(const
 #endif
 
 #ifdef XP_MACOSX
     // Whitelist Flash and Quicktime to support offline renderer
     NS_NAMED_LITERAL_CSTRING(flash, "application/x-shockwave-flash");
     NS_NAMED_LITERAL_CSTRING(quicktime, "QuickTime Plugin.plugin");
     if (FindInReadable(flash, aMimeType)) {
       mQuirks |= QUIRK_FLASH_AVOID_CGMODE_CRASHES;
+      mQuirks |= QUIRK_FLASH_HIDE_HIDPI_SUPPORT;
     }
     if (FindInReadable(flash, aMimeType) ||
         FindInReadable(quicktime, mPluginFilename)) {
         mQuirks |= QUIRK_ALLOW_OFFLINE_RENDERER;
     }
 #endif
 }
 
--- a/dom/plugins/ipc/PluginModuleChild.h
+++ b/dom/plugins/ipc/PluginModuleChild.h
@@ -278,16 +278,21 @@ public:
         // Mac: Allow the plugin to use offline renderer mode.
         // Use this only if the plugin is certified the support the offline renderer.
         QUIRK_ALLOW_OFFLINE_RENDERER                    = 1 << 9,
         // Mac: Work around a Flash bug that can cause plugin process crashes
         // in CoreGraphics mode:  The Flash plugin sometimes accesses the
         // CGContextRef we pass to it in NPP_HandleEvent(NPCocoaEventDrawRect)
         // outside of that call.  See bug 804606.
         QUIRK_FLASH_AVOID_CGMODE_CRASHES                = 1 << 10,
+        // Mac: Work around a Flash ActionScript bug that causes long hangs if
+        // Flash thinks HiDPI support is available. Adobe is tracking this as
+        // ADBE 3921114. If this turns out to be Adobe's fault and they fix it,
+        // we'll no longer need this quirk. See bug 1118615.
+        QUIRK_FLASH_HIDE_HIDPI_SUPPORT                  = 1 << 11,
     };
 
     int GetQuirks() { return mQuirks; }
 
     const PluginSettings& Settings() const { return mCachedSettings; }
 
 private:
     NPError DoNP_Initialize(const PluginSettings& aSettings);