Bug 844553 - Add a pref which controls whether we load plugins from the root appdir, default to off, r=glandium a=bbajaj
authorBenjamin Smedberg <benjamin@smedbergs.us>
Tue, 05 Mar 2013 09:45:28 -0500
changeset 128679 5251e66d26c3c97c2f3a296665a8f9e1dc45d14a
parent 128678 286f3ec182e8ca48fcfa8f4e08adc27d68cb0a41
child 128680 f0c0f6fe50a030001bd0eff132f94db93c1cc9f1
push id3549
push userbsmedberg@mozilla.com
push dateMon, 25 Mar 2013 14:57:03 +0000
treeherdermozilla-aurora@5251e66d26c3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium, bbajaj
bugs844553
milestone21.0a2
Bug 844553 - Add a pref which controls whether we load plugins from the root appdir, default to off, r=glandium a=bbajaj
modules/libpref/src/init/all.js
toolkit/xre/nsXREDirProvider.cpp
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -1772,16 +1772,17 @@ pref("dom.max_script_run_time", 10);
 pref("dom.archivereader.enabled", false);
 
 // Hang monitor timeout after which we kill the browser, in seconds
 // (0 is disabled)
 // Disabled on all platforms per bug 705748 until the found issues are
 // resolved.
 pref("hangmonitor.timeout", 0);
 
+pref("plugins.load_appdir_plugins", false);
 // If true, plugins will be click to play
 pref("plugins.click_to_play", false);
 
 #ifndef DEBUG
 // How long a plugin is allowed to process a synchronous IPC message
 // before we consider it "hung".
 pref("dom.ipc.plugins.timeoutSecs", 45);
 // How long a plugin process will wait for a response from the parent
--- a/toolkit/xre/nsXREDirProvider.cpp
+++ b/toolkit/xre/nsXREDirProvider.cpp
@@ -714,18 +714,28 @@ nsXREDirProvider::GetFilesInternal(const
                       directories);
     LoadDirsIntoArray(mExtensionDirectories,
                       kAppendChromeDir,
                       directories);
 
     rv = NS_NewArrayEnumerator(aResult, directories);
   }
   else if (!strcmp(aProperty, NS_APP_PLUGINS_DIR_LIST)) {
+    nsCOMArray<nsIFile> directories;
+
+    if (mozilla::Preferences::GetBool("plugins.load_appdir_plugins", false)) {
+      nsCOMPtr<nsIFile> appdir;
+      rv = XRE_GetBinaryPath(gArgv[0], getter_AddRefs(appdir));
+      if (NS_SUCCEEDED(rv)) {
+        appdir->SetNativeLeafName(NS_LITERAL_CSTRING("plugins"));
+        directories.AppendObject(appdir);
+      }
+    }
+
     static const char *const kAppendPlugins[] = { "plugins", nullptr };
-    nsCOMArray<nsIFile> directories;
 
     // The root dirserviceprovider does quite a bit for us: we're mainly
     // interested in xulapp and extension-provided plugins.
     LoadDirsIntoArray(mAppBundleDirectories,
                       kAppendPlugins,
                       directories);
     LoadDirsIntoArray(mExtensionDirectories,
                       kAppendPlugins,