From 4d5eb53fa2ca9eeeadbfcd2be832aa8e97d413fc Mon Sep 17 00:00:00 2001
From: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Date: Mon, 6 Apr 2020 19:17:43 +0200
Subject: [PATCH 03/30] Check additional plugins dir

Check original plugins dir along with default plugins dir.

Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
---
 xpcom/io/nsAppFileLocationProvider.cpp | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/xpcom/io/nsAppFileLocationProvider.cpp b/xpcom/io/nsAppFileLocationProvider.cpp
index ef974f9904..6261eafcc8 100644
--- a/xpcom/io/nsAppFileLocationProvider.cpp
+++ b/xpcom/io/nsAppFileLocationProvider.cpp
@@ -50,6 +50,7 @@
 #  define NS_MACOSX_LOCAL_PLUGIN_DIR "OSXLocalPlugins"
 #elif XP_UNIX
 #  define NS_SYSTEM_PLUGINS_DIR "SysPlugins"
+#  define NS_SYSTEM_NSBROWSER_PLUGINS_DIR "SysNsBrowserPlugins"
 #endif
 
 #define DEFAULTS_DIR_NAME "defaults"_ns
@@ -172,6 +173,21 @@ nsAppFileLocationProvider::GetFile(const char* aProp, bool* aPersistent,
                                getter_AddRefs(localFile));
 #    else
     rv = NS_ERROR_FAILURE;
+#    endif
+  } else if (nsCRT::strcmp(aProp, NS_SYSTEM_NSBROWSER_PLUGINS_DIR) == 0) {
+#    ifdef ENABLE_SYSTEM_EXTENSION_DIRS
+    static const char* const sysLPlgDir =
+#      if defined(HAVE_USR_LIB64_DIR) && defined(__LP64__)
+        "/usr/lib64/nsbrowser/plugins";
+#      elif defined(__OpenBSD__) || defined(__FreeBSD__)
+        "/usr/local/lib/nsbrowser/plugins";
+#      else
+        "/usr/lib/nsbrowser/plugins";
+#      endif
+    rv = NS_NewNativeLocalFile(nsDependentCString(sysLPlgDir), false,
+                               getter_AddRefs(localFile));
+#    else
+    rv = NS_ERROR_FAILURE;
 #    endif
   }
 #  endif
@@ -418,7 +434,7 @@ nsAppFileLocationProvider::GetFiles(const char* aProp,
 #else
 #  ifdef XP_UNIX
     static const char* keys[] = {NS_USER_PLUGINS_DIR, NS_SYSTEM_PLUGINS_DIR,
-                                 nullptr};
+                                 NS_SYSTEM_NSBROWSER_PLUGINS_DIR, nullptr};
 #  else
     static const char* keys[] = {NS_USER_PLUGINS_DIR, nullptr};
 #  endif
-- 
2.34.1

