Bug 1317109 - Remove Acrobat plugin quirk handling. r=jimm
authorChris Peterson <cpeterson@mozilla.com>
Mon, 14 Nov 2016 23:37:44 -0800
changeset 439826 c8f05f715087777d0e7bc46de4a5fbc2c99d364b
parent 439825 3fa59ec4e1addd2f5e02748cc487e51c3fc41d5b
child 439827 6abf12a9d408803d49f8cae81ff6a64230198c51
push id36113
push userbmo:afarre@mozilla.com
push dateWed, 16 Nov 2016 18:15:04 +0000
reviewersjimm
bugs1317109
milestone53.0a1
Bug 1317109 - Remove Acrobat plugin quirk handling. r=jimm
dom/plugins/base/nsNPAPIPlugin.cpp
dom/plugins/base/nsPluginDirServiceProvider.cpp
dom/plugins/base/nsPluginDirServiceProvider.h
dom/plugins/base/nsPluginHost.cpp
dom/plugins/base/nsPluginHost.h
dom/plugins/base/nsPluginNativeWindowWin.cpp
modules/libpref/init/all.js
--- a/dom/plugins/base/nsNPAPIPlugin.cpp
+++ b/dom/plugins/base/nsNPAPIPlugin.cpp
@@ -719,33 +719,16 @@ NPError
   }
 
   NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
   ("NPN_GetURL: npp=%p, target=%s, url=%s\n", (void *)npp, target,
    relativeURL));
 
   PluginDestructionGuard guard(npp);
 
-  // Block Adobe Acrobat from loading URLs that are not http:, https:,
-  // or ftp: URLs if the given target is null.
-  if (!target && relativeURL &&
-      (strncmp(relativeURL, "http:", 5) != 0) &&
-      (strncmp(relativeURL, "https:", 6) != 0) &&
-      (strncmp(relativeURL, "ftp:", 4) != 0)) {
-    nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *) npp->ndata;
-
-    const char *name = nullptr;
-    RefPtr<nsPluginHost> host = nsPluginHost::GetInst();
-    host->GetPluginName(inst, &name);
-
-    if (name && strstr(name, "Adobe") && strstr(name, "Acrobat")) {
-      return NPERR_NO_ERROR;
-    }
-  }
-
   return MakeNewNPAPIStreamInternal(npp, relativeURL, target,
                                     eNPPStreamTypeInternal_Get);
 }
 
 NPError
 _geturlnotify(NPP npp, const char* relativeURL, const char* target,
               void* notifyData)
 {
--- a/dom/plugins/base/nsPluginDirServiceProvider.cpp
+++ b/dom/plugins/base/nsPluginDirServiceProvider.cpp
@@ -285,80 +285,16 @@ nsPluginDirServiceProvider::GetFile(cons
       nsAutoString path;
       rv = regKey->ReadStringValue(NS_LITERAL_STRING("Installation Directory"),
                                    path);
       if (NS_SUCCEEDED(rv)) {
         rv = NS_NewLocalFile(path, true,
                              getter_AddRefs(localFile));
       }
     }
-  } else if (nsCRT::strcmp(charProp, NS_WIN_ACROBAT_SCAN_KEY) == 0) {
-    nsAdoptingCString strVer = Preferences::GetCString(charProp);
-    if (!strVer) {
-      return NS_ERROR_FAILURE;
-    }
-
-    verBlock minVer;
-    TranslateVersionStr(NS_ConvertASCIItoUTF16(strVer).get(), &minVer);
-
-    // Look for Adobe Acrobat system installation plugins directory
-    verBlock maxVer;
-    ClearVersion(&maxVer);
-
-    nsAutoString newestPath;
-
-    rv = regKey->Open(nsIWindowsRegKey::ROOT_KEY_LOCAL_MACHINE,
-                      NS_LITERAL_STRING("software\\Adobe\\Acrobat Reader"),
-                      nsIWindowsRegKey::ACCESS_READ);
-    if (NS_FAILED(rv)) {
-      rv = regKey->Open(nsIWindowsRegKey::ROOT_KEY_LOCAL_MACHINE,
-                        NS_LITERAL_STRING("software\\Adobe\\Adobe Acrobat"),
-                        nsIWindowsRegKey::ACCESS_READ);
-      if (NS_FAILED(rv)) {
-        return NS_ERROR_FAILURE;
-      }
-    }
-
-    // We must enumerate through the keys because what if there is
-    // more than one version?
-    uint32_t childCount = 0;
-    regKey->GetChildCount(&childCount);
-
-    for (uint32_t index = 0; index < childCount; ++index) {
-      nsAutoString childName;
-      rv = regKey->GetChildName(index, childName);
-      if (NS_SUCCEEDED(rv)) {
-        verBlock curVer;
-        TranslateVersionStr(childName.get(), &curVer);
-
-        childName += NS_LITERAL_STRING("\\InstallPath");
-
-        nsCOMPtr<nsIWindowsRegKey> childKey;
-        rv = regKey->OpenChild(childName, nsIWindowsRegKey::ACCESS_QUERY_VALUE,
-                               getter_AddRefs(childKey));
-        if (NS_SUCCEEDED(rv)) {
-          // We have a sub key
-          nsAutoString path;
-          rv = childKey->ReadStringValue(NS_LITERAL_STRING(""), path);
-          if (NS_SUCCEEDED(rv)) {
-            if (CompareVersion(curVer, maxVer) >= 0 &&
-                CompareVersion(curVer, minVer) >= 0) {
-              newestPath = path;
-              CopyVersion(&maxVer, &curVer);
-            }
-          }
-        }
-      }
-    }
-
-    if (!newestPath.IsEmpty()) {
-      newestPath += NS_LITERAL_STRING("\\browser");
-      rv = NS_NewLocalFile(newestPath, true,
-                           getter_AddRefs(localFile));
-    }
   }
 
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   localFile.forget(_retval);
   return NS_OK;
--- a/dom/plugins/base/nsPluginDirServiceProvider.h
+++ b/dom/plugins/base/nsPluginDirServiceProvider.h
@@ -11,17 +11,16 @@
 #if defined (XP_WIN)
 #include "nsCOMArray.h"
 #endif
 
 class nsISimpleEnumerator;
 
 // Note: Our directory service provider scan keys are prefs which are check
 //       for minimum versions compatibility
-#define NS_WIN_ACROBAT_SCAN_KEY        "plugin.scan.Acrobat"
 #define NS_WIN_QUICKTIME_SCAN_KEY      "plugin.scan.Quicktime"
 #define NS_WIN_WMP_SCAN_KEY            "plugin.scan.WindowsMediaPlayer"
 
 //*****************************************************************************
 // class nsPluginDirServiceProvider
 //*****************************************************************************   
 
 class nsPluginDirServiceProvider : public nsIDirectoryServiceProvider
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -1851,20 +1851,16 @@ nsPluginHost::GetSpecialType(const nsACS
     return eSpecialType_Silverlight;
   }
 
   if (aMIMEType.LowerCaseEqualsASCII("audio/x-pn-realaudio-plugin")) {
     NS_WARNING("You are loading RealPlayer");
     return eSpecialType_RealPlayer;
   }
 
-  if (aMIMEType.LowerCaseEqualsASCII("application/pdf")) {
-    return eSpecialType_PDF;
-  }
-
   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(';'));
 
@@ -2554,18 +2550,17 @@ nsresult nsPluginHost::FindPlugins(bool 
       }
     }
   }
 
 
   // Scan the installation paths of our popular plugins if the prefs are enabled
 
   // This table controls the order of scanning
-  const char* const prefs[] = {NS_WIN_ACROBAT_SCAN_KEY,
-                               NS_WIN_QUICKTIME_SCAN_KEY,
+  const char* const prefs[] = {NS_WIN_QUICKTIME_SCAN_KEY,
                                NS_WIN_WMP_SCAN_KEY};
 
   uint32_t size = sizeof(prefs) / sizeof(prefs[0]);
 
   for (uint32_t i = 0; i < size; i+=1) {
     nsCOMPtr<nsIFile> dirToScan;
     bool bExists;
     if (NS_SUCCEEDED(dirService->Get(prefs[i], NS_GET_IID(nsIFile), getter_AddRefs(dirToScan))) &&
--- a/dom/plugins/base/nsPluginHost.h
+++ b/dom/plugins/base/nsPluginHost.h
@@ -200,18 +200,16 @@ public:
                      // 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_PDF,
-                     // Native widget quirks
                      eSpecialType_RealPlayer,
                      // Native widget quirks
                      eSpecialType_Unity };
   static SpecialType GetSpecialType(const nsACString & aMIMEType);
 
   static nsresult PostPluginUnloadEvent(PRLibrary* aLibrary);
 
   void PluginCrashed(nsNPAPIPlugin* plugin,
--- a/dom/plugins/base/nsPluginNativeWindowWin.cpp
+++ b/dom/plugins/base/nsPluginNativeWindowWin.cpp
@@ -622,27 +622,16 @@ nsresult nsPluginNativeWindowWin::CallSe
   if (window) {
     // grab the widget procedure before the plug-in does a subclass in
     // setwindow. We'll use this in PluginWndProc for forwarding focus
     // events to the widget.
     WNDPROC currentWndProc =
       (WNDPROC)::GetWindowLongPtr((HWND)window, GWLP_WNDPROC);
     if (!mPrevWinProc && currentWndProc != PluginWndProc)
       mPrevWinProc = currentWndProc;
-
-    // PDF plugin v7.0.9, v8.1.3, and v9.0 subclass parent window, bug 531551
-    // V8.2.2 and V9.1 don't have such problem.
-    if (mPluginType == nsPluginHost::eSpecialType_PDF) {
-      HWND parent = ::GetParent((HWND)window);
-      if (mParentWnd != parent) {
-        NS_ASSERTION(!mParentWnd, "Plugin's parent window changed");
-        mParentWnd = parent;
-        mParentProc = ::GetWindowLongPtr(mParentWnd, GWLP_WNDPROC);
-      }
-    }
   }
 
   nsPluginNativeWindow::CallSetWindow(aPluginInstance);
 
   SubclassAndAssociateWindow();
 
   if (window && mPluginType == nsPluginHost::eSpecialType_Flash &&
       !GetPropW((HWND)window, L"PluginInstanceParentProperty")) {
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -3430,19 +3430,16 @@ pref("slider.snapMultiplier", 6);
 
 // print_extra_margin enables platforms to specify an extra gap or margin
 // around the content of the page for Print Preview only
 pref("print.print_extra_margin", 90); // twips (90 twips is an eigth of an inch)
 
 // Whether to extend the native dialog with information on printing frames.
 pref("print.extend_native_print_dialog", true);
 
-// Locate plugins by scanning the Adobe Acrobat installation directory with a minimum version
-pref("plugin.scan.Acrobat", "5.0");
-
 // Locate plugins by scanning the Quicktime installation directory with a minimum version
 pref("plugin.scan.Quicktime", "5.0");
 
 // Locate and scan the Window Media Player installation directory for plugins with a minimum version
 pref("plugin.scan.WindowsMediaPlayer", "7.0");
 
 // Locate plugins by the directories specified in the Windows registry for PLIDs
 // Which is currently HKLM\Software\MozillaPlugins\xxxPLIDxxx\Path