Bug 844533 - Add a pref which controls whether we load plugins from the root appdir, default to off, r=glandium
authorBenjamin Smedberg <benjamin@smedbergs.us>
Tue, 05 Mar 2013 09:45:28 -0500
changeset 123983 64a8760069089f8af2f5f120b0277fe1600be208
parent 123982 a9533266197d4106fd70e628a2139dc984824146
child 123984 ba281dd782c3ba1e0984f5e3df5d19694fe0951d
push id24166
push userbsmedberg@mozilla.com
push dateWed, 06 Mar 2013 17:52:37 +0000
treeherdermozilla-inbound@64a876006908 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs844533
milestone22.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 844533 - Add a pref which controls whether we load plugins from the root appdir, default to off, r=glandium
modules/libpref/src/init/all.js
toolkit/xre/nsXREDirProvider.cpp
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -1779,16 +1779,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,