Bug 1318833 - Part 2: Remove Silverlight plugin quirk compatibility. r=jimm
authorChris Peterson <cpeterson@mozilla.com>
Mon, 28 Nov 2016 22:51:45 -0800
changeset 324640 f1362a9e0f4e699fb28d719908bcc46ffb2ae063
parent 324639 d40f29aab1e9b06dd81b80afcfc988f70209e636
child 324641 563c1205e1472702c2a9e121cb378beddbcb87e6
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersjimm
bugs1318833
milestone53.0a1
Bug 1318833 - Part 2: Remove Silverlight plugin quirk compatibility. r=jimm
dom/plugins/base/nsNPAPIPluginInstance.cpp
dom/plugins/base/nsPluginHost.cpp
dom/plugins/base/nsPluginHost.h
dom/plugins/base/nsPluginInstanceOwner.cpp
dom/plugins/base/nsPluginTags.cpp
dom/plugins/ipc/PluginInstanceChild.cpp
dom/plugins/ipc/PluginProcessChild.h
dom/plugins/ipc/PluginQuirks.cpp
dom/plugins/ipc/PluginQuirks.h
ipc/glue/WindowsMessageLoop.cpp
--- a/dom/plugins/base/nsNPAPIPluginInstance.cpp
+++ b/dom/plugins/base/nsNPAPIPluginInstance.cpp
@@ -674,30 +674,16 @@ nsresult nsNPAPIPluginInstance::GetNPP(N
     return NS_ERROR_NULL_POINTER;
 
   return NS_OK;
 }
 
 NPError nsNPAPIPluginInstance::SetWindowless(bool aWindowless)
 {
   mWindowless = aWindowless;
-
-  if (mMIMEType) {
-    // bug 558434 - Prior to 3.6.4, we assumed windowless was transparent.
-    // Silverlight apparently relied on this quirk, so we default to
-    // transparent unless they specify otherwise after setting the windowless
-    // property. (Last tested version: sl 4.0).
-    // Changes to this code should be matched with changes in
-    // PluginInstanceChild::InitQuirksMode.
-    if (nsPluginHost::GetSpecialType(nsDependentCString(mMIMEType)) ==
-        nsPluginHost::eSpecialType_Silverlight) {
-      mTransparent = true;
-    }
-  }
-
   return NPERR_NO_ERROR;
 }
 
 NPError nsNPAPIPluginInstance::SetTransparent(bool aTransparent)
 {
   mTransparent = aTransparent;
   return NPERR_NO_ERROR;
 }
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -1838,22 +1838,16 @@ nsPluginHost::GetSpecialType(const nsACS
   }
 
   if (aMIMEType.LowerCaseEqualsASCII("application/x-shockwave-flash") ||
       aMIMEType.LowerCaseEqualsASCII("application/futuresplash") ||
       aMIMEType.LowerCaseEqualsASCII("application/x-shockwave-flash-test")) {
     return eSpecialType_Flash;
   }
 
-  if (aMIMEType.LowerCaseEqualsASCII("application/x-silverlight") ||
-      aMIMEType.LowerCaseEqualsASCII("application/x-silverlight-2") ||
-      aMIMEType.LowerCaseEqualsASCII("application/x-silverlight-test")) {
-    return eSpecialType_Silverlight;
-  }
-
   if (aMIMEType.LowerCaseEqualsASCII("application/vnd.unity")) {
     return eSpecialType_Unity;
   }
 
   // Java registers variants of its MIME with parameters, e.g.
   // application/x-java-vm;version=1.3
   const nsACString &noParam = Substring(aMIMEType, 0, aMIMEType.FindChar(';'));
 
@@ -2012,29 +2006,24 @@ struct CompareFilesByTime
 };
 
 } // namespace
 
 bool
 nsPluginHost::ShouldAddPlugin(nsPluginTag* aPluginTag)
 {
 #if defined(XP_WIN) && (defined(__x86_64__) || defined(_M_X64))
-  // On 64-bit windows, the only plugins we should load are flash and
-  // silverlight. Use library filename and MIME type to check.
+  // On 64-bit Windows, the only plugin we should load is Flash. Use library
+  // filename and MIME type to check.
   if (StringBeginsWith(aPluginTag->FileName(), NS_LITERAL_CSTRING("NPSWF"), nsCaseInsensitiveCStringComparator()) &&
       (aPluginTag->HasMimeType(NS_LITERAL_CSTRING("application/x-shockwave-flash")) ||
        aPluginTag->HasMimeType(NS_LITERAL_CSTRING("application/x-shockwave-flash-test")))) {
     return true;
   }
-  if (StringBeginsWith(aPluginTag->FileName(), NS_LITERAL_CSTRING("npctrl"), nsCaseInsensitiveCStringComparator()) &&
-      (aPluginTag->HasMimeType(NS_LITERAL_CSTRING("application/x-silverlight-test")) ||
-       aPluginTag->HasMimeType(NS_LITERAL_CSTRING("application/x-silverlight-2")) ||
-       aPluginTag->HasMimeType(NS_LITERAL_CSTRING("application/x-silverlight")))) {
-    return true;
-  }
+
   // Accept the test plugin MIME types, so mochitests still work.
   if (aPluginTag->HasMimeType(NS_LITERAL_CSTRING("application/x-test")) ||
       aPluginTag->HasMimeType(NS_LITERAL_CSTRING("application/x-Second-Test")) ||
       aPluginTag->HasMimeType(NS_LITERAL_CSTRING("application/x-java-test"))) {
     return true;
   }
 #ifdef PLUGIN_LOGGING
   PLUGIN_LOG(PLUGIN_LOG_NORMAL,
--- a/dom/plugins/base/nsPluginHost.h
+++ b/dom/plugins/base/nsPluginHost.h
@@ -197,18 +197,16 @@ public:
   enum SpecialType { eSpecialType_None,
                      // Needed to whitelist for async init support
                      eSpecialType_Test,
                      // Informs some decisions about OOP and quirks
                      eSpecialType_Flash,
                      // Binds to the <applet> tag, has various special
                      // rules around opening channels, codebase, ...
                      eSpecialType_Java,
-                     // Some IPC quirks
-                     eSpecialType_Silverlight,
                      // Native widget quirks
                      eSpecialType_Unity };
   static SpecialType GetSpecialType(const nsACString & aMIMEType);
 
   static nsresult PostPluginUnloadEvent(PRLibrary* aLibrary);
 
   void PluginCrashed(nsNPAPIPlugin* plugin,
                      const nsAString& pluginDumpID,
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -602,17 +602,17 @@ NS_IMETHODIMP nsPluginInstanceOwner::Inv
   // Each time an asynchronously-drawing plugin sends a new surface to display,
   // the image in the ImageContainer is updated and InvalidateRect is called.
   // There are different side effects for (sync) Android plugins.
   RefPtr<ImageContainer> container;
   mInstance->GetImageContainer(getter_AddRefs(container));
 #endif
 
 #ifndef XP_MACOSX
-  // Silverlight calls invalidate for windowed plugins so this needs to work.
+  // Invalidate for windowed plugins needs to work.
   if (mWidget) {
     mWidget->Invalidate(
       LayoutDeviceIntRect(invalidRect->left, invalidRect->top,
                           invalidRect->right - invalidRect->left,
                           invalidRect->bottom - invalidRect->top));
     // Plugin instances also call invalidate when plugin windows are hidden
     // during scrolling. In this case fall through so we invalidate the
     // underlying layer.
--- a/dom/plugins/base/nsPluginTags.cpp
+++ b/dom/plugins/base/nsPluginTags.cpp
@@ -363,17 +363,16 @@ void nsPluginTag::InitMime(const char* c
       case nsPluginHost::eSpecialType_Flash:
         // VLC sometimes claims to implement the Flash MIME type, and we want
         // to allow users to control that separately from Adobe Flash.
         if (Name().EqualsLiteral("Shockwave Flash")) {
           mIsFlashPlugin = true;
           mSupportsAsyncInit = true;
         }
         break;
-      case nsPluginHost::eSpecialType_Silverlight:
       case nsPluginHost::eSpecialType_Unity:
       case nsPluginHost::eSpecialType_Test:
         mSupportsAsyncInit = true;
         break;
       case nsPluginHost::eSpecialType_None:
       default:
 #ifndef RELEASE_OR_BETA
         // Allow async init for all plugins on Nightly and Aurora
--- a/dom/plugins/ipc/PluginInstanceChild.cpp
+++ b/dom/plugins/ipc/PluginInstanceChild.cpp
@@ -2691,19 +2691,17 @@ PluginInstanceChild::AnswerSetPluginFocu
     MOZ_LOG(GetPluginLog(), LogLevel::Debug, ("%s", FULLFUNCTION));
 
 #if defined(OS_WIN)
     // Parent is letting us know the dom set focus to the plugin. Note,
     // focus can change during transit in certain edge cases, for example
     // when a button click brings up a full screen window. Since we send
     // this in response to a WM_SETFOCUS event on our parent, the parent
     // should have focus when we receive this. If not, ignore the call.
-    if (::GetFocus() == mPluginWindowHWND ||
-        ((GetQuirks() & QUIRK_SILVERLIGHT_FOCUS_CHECK_PARENT) &&
-         (::GetFocus() != mPluginParentHWND)))
+    if (::GetFocus() == mPluginWindowHWND)
         return IPC_OK();
     ::SetFocus(mPluginWindowHWND);
     return IPC_OK();
 #else
     NS_NOTREACHED("PluginInstanceChild::AnswerSetPluginFocus not implemented!");
     return IPC_FAIL_NO_REASON(this);
 #endif
 }
@@ -3365,19 +3363,16 @@ PluginInstanceChild::DoAsyncSetWindow(co
     mWindow.width = aWindow.width;
     mWindow.height = aWindow.height;
     mWindow.clipRect = aWindow.clipRect;
     mWindow.type = aWindow.type;
 #if defined(XP_MACOSX) || defined(XP_WIN)
     mContentsScaleFactor = aWindow.contentsScaleFactor;
 #endif
 
-    if (GetQuirks() & QUIRK_SILVERLIGHT_DEFAULT_TRANSPARENT)
-        mIsTransparent = true;
-
     mLayersRendering = true;
     mSurfaceType = aSurfaceType;
     UpdateWindowAttributes(true);
 
 #ifdef XP_WIN
     if (GetQuirks() & QUIRK_FLASH_THROTTLE_WMUSER_EVENTS)
         SetupFlashMsgThrottle();
 #endif
--- a/dom/plugins/ipc/PluginProcessChild.h
+++ b/dom/plugins/ipc/PluginProcessChild.h
@@ -35,17 +35,17 @@ public:
 
 protected:
     static PluginProcessChild* current() {
         return static_cast<PluginProcessChild*>(ProcessChild::current());
     }
 
 private:
 #if defined(XP_WIN)
-    /* Drag-and-drop and Silverlight depend on the host initializing COM.
+    /* Drag-and-drop depends on the host initializing COM.
      * This object initializes and configures COM. */
     mozilla::mscom::MainThreadRuntime mCOMRuntime;
 #endif
     PluginModuleChild mPlugin;
 
     DISALLOW_EVIL_CONSTRUCTORS(PluginProcessChild);
 };
 
--- a/dom/plugins/ipc/PluginQuirks.cpp
+++ b/dom/plugins/ipc/PluginQuirks.cpp
@@ -13,24 +13,16 @@ namespace plugins {
 
 int GetQuirksFromMimeTypeAndFilename(const nsCString& aMimeType,
                                      const nsCString& aPluginFilename)
 {
     int quirks = 0;
 
     nsPluginHost::SpecialType specialType = nsPluginHost::GetSpecialType(aMimeType);
 
-    if (specialType == nsPluginHost::eSpecialType_Silverlight) {
-        quirks |= QUIRK_SILVERLIGHT_DEFAULT_TRANSPARENT;
-#ifdef OS_WIN
-        quirks |= QUIRK_WINLESS_TRACKPOPUP_HOOK;
-        quirks |= QUIRK_SILVERLIGHT_FOCUS_CHECK_PARENT;
-#endif
-    }
-
     if (specialType == nsPluginHost::eSpecialType_Flash) {
         quirks |= QUIRK_FLASH_RETURN_EMPTY_DOCUMENT_ORIGIN;
 #ifdef OS_WIN
         quirks |= QUIRK_WINLESS_TRACKPOPUP_HOOK;
         quirks |= QUIRK_FLASH_THROTTLE_WMUSER_EVENTS;
         quirks |= QUIRK_FLASH_HOOK_SETLONGPTR;
         quirks |= QUIRK_FLASH_HOOK_GETWINDOWINFO;
         quirks |= QUIRK_FLASH_FIXUP_MOUSE_CAPTURE;
--- a/dom/plugins/ipc/PluginQuirks.h
+++ b/dom/plugins/ipc/PluginQuirks.h
@@ -8,19 +8,16 @@
 #define dom_plugins_PluginQuirks_h
 
 namespace mozilla {
 namespace plugins {
 
 // Quirks mode support for various plugin mime types
 enum PluginQuirks {
   QUIRKS_NOT_INITIALIZED                          = 0,
-  // Silverlight assumes it is transparent in windowless mode. This quirk
-  // matches the logic in nsNPAPIPluginInstance::SetWindowless.
-  QUIRK_SILVERLIGHT_DEFAULT_TRANSPARENT           = 1 << 0,
   // Win32: Hook TrackPopupMenu api so that we can swap out parent
   // hwnds. The api will fail with parents not associated with our
   // child ui thread. See WinlessHandleEvent for details.
   QUIRK_WINLESS_TRACKPOPUP_HOOK                   = 1 << 1,
   // Win32: Throttle flash WM_USER+1 heart beat messages to prevent
   // flooding chromium's dispatch loop, which can cause ipc traffic
   // processing lag.
   QUIRK_FLASH_THROTTLE_WMUSER_EVENTS              = 1 << 2,
@@ -32,20 +29,16 @@ enum PluginQuirks {
   QUIRK_FLASH_EXPOSE_COORD_TRANSLATION            = 1 << 4,
   // Win32: Catch get window info calls on the browser and tweak the
   // results so mouse input works when flash is displaying it's settings
   // window.
   QUIRK_FLASH_HOOK_GETWINDOWINFO                  = 1 << 5,
   // Win: Addresses a flash bug with mouse capture and full screen
   // windows.
   QUIRK_FLASH_FIXUP_MOUSE_CAPTURE                 = 1 << 6,
-  // Win: Check to make sure the parent window has focus before calling
-  // set focus on the child. Addresses a full screen dialog prompt
-  // problem in Silverlight.
-  QUIRK_SILVERLIGHT_FOCUS_CHECK_PARENT            = 1 << 8,
   // 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,
   // Work around a Flash bug where it fails to check the error code of a
   // NPN_GetValue(NPNVdocumentOrigin) call before trying to dereference
   // its char* output.
   QUIRK_FLASH_RETURN_EMPTY_DOCUMENT_ORIGIN        = 1 << 10,
   // Win: Addresses a Unity bug with mouse capture.
--- a/ipc/glue/WindowsMessageLoop.cpp
+++ b/ipc/glue/WindowsMessageLoop.cpp
@@ -489,19 +489,17 @@ WindowIsDeferredWindow(HWND hWnd)
       StringBeginsWith(className, NS_LITERAL_STRING("Gecko")) ||
       className.EqualsLiteral("nsToolkitClass") ||
       className.EqualsLiteral("nsAppShell:EventWindowClass")) {
     return true;
   }
 
   // Plugin windows that can trigger ipc calls in child:
   // 'ShockwaveFlashFullScreen' - flash fullscreen window
-  // 'AGFullScreenWinClass' - silverlight fullscreen window
-  if (className.EqualsLiteral("ShockwaveFlashFullScreen") ||
-      className.EqualsLiteral("AGFullScreenWinClass")) {
+  if (className.EqualsLiteral("ShockwaveFlashFullScreen")) {
     SetPropW(hWnd, k3rdPartyWindowProp, (HANDLE)1);
     return true;
   }
 
   // nsNativeAppSupport makes a window like "FirefoxMessageWindow" based on the
   // toolkit app's name. It's pretty expensive to calculate this so we only try
   // once.
   if (gAppMessageWindowNameLength == 0) {