Bug 1118615 - Flash hangs displaying a camera/microphone access dialog in HiDPI mode, workaround. r=mstange
authorSteven Michaud <smichaud@pobox.com>
Fri, 16 Jan 2015 12:16:44 -0600
changeset 224302 dc36cbaa1cc395cfa1a8818c65ab847206474521
parent 224301 e12319cbdcd386b3d2177745e0be9d29aabf5ebf
child 224303 6f0f1a79b3790a240ba66736ebbca682f24700f7
push id28122
push userkwierso@gmail.com
push dateSat, 17 Jan 2015 01:33:15 +0000
treeherdermozilla-central@369a8f14ccf8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1118615
milestone38.0a1
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 1118615 - Flash hangs displaying a camera/microphone access dialog in HiDPI mode, workaround. r=mstange
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,30 @@ 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 bug that causes long hangs when Flash tries to
+    // display its camera and microphone access dialog while it thinks HiDPI
+    // support is available. This is Adobe bug ADBE 3921114, which should get
+    // fixed in a future release. When this happens we'll no longer need this
+    // workaround. 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,22 @@ 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 bug that causes long hangs when Flash
+        // tries to display its camera and microphone access dialog while
+        // it thinks HiDPI support is available. This is Adobe bug
+        // ADBE 3921114, which should get fixed in a future release. When
+        // this happens 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);