Bug 899857 - Make xpcshell default to a plugins directory only if -p is not specified. r=ted
authorMihnea Dobrescu-Balaur <mihneadb@gmail.com>
Fri, 02 Aug 2013 15:07:54 -0700
changeset 141465 7fcf4c1b8463c5caa952c835d757da1370603331
parent 141464 019c0b931ad4f065495d145fd2e575734039685d
child 141466 bded8515b5db5a6e68b4a8006061154d6dc42a7c
push id25059
push userryanvm@gmail.com
push dateTue, 06 Aug 2013 03:20:31 +0000
treeherdermozilla-central@a0dd80f800e2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs899857
milestone25.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 899857 - Make xpcshell default to a plugins directory only if -p is not specified. r=ted
js/xpconnect/shell/xpcshell.cpp
--- a/js/xpconnect/shell/xpcshell.cpp
+++ b/js/xpconnect/shell/xpcshell.cpp
@@ -1939,31 +1939,33 @@ XPCShellDirProvider::GetFiles(const char
             NS_SUCCEEDED(appDir->AppendNative(NS_LITERAL_CSTRING("defaults"))) &&
             NS_SUCCEEDED(appDir->AppendNative(NS_LITERAL_CSTRING("preferences"))) &&
             NS_SUCCEEDED(appDir->Exists(&exists)) && exists) {
             dirs.AppendObject(appDir);
             return NS_NewArrayEnumerator(result, dirs);
         }
         return NS_ERROR_FAILURE;
     } else if (!strcmp(prop, NS_APP_PLUGINS_DIR_LIST)) {
-        nsCOMPtr<nsIFile> file;
         nsCOMArray<nsIFile> dirs;
-        bool exists;
-        // We have to add this path, buildbot copies the test plugin directory
-        // to (app)/bin when unpacking test zips.
-        if (mGREDir) {
-            mGREDir->Clone(getter_AddRefs(file));
-            if (NS_SUCCEEDED(mGREDir->Clone(getter_AddRefs(file)))) {
-                file->AppendNative(NS_LITERAL_CSTRING("plugins"));
-                if (NS_SUCCEEDED(file->Exists(&exists)) && exists) {
-                    dirs.AppendObject(file);
-                }
-            }
-        }
         // Add the test plugin location passed in by the caller or through
         // runxpcshelltests.
         if (mPluginDir) {
             dirs.AppendObject(mPluginDir);
+        // If there was no path specified, default to the one set up by automation
+        } else {
+            nsCOMPtr<nsIFile> file;
+            bool exists;
+            // We have to add this path, buildbot copies the test plugin directory
+            // to (app)/bin when unpacking test zips.
+            if (mGREDir) {
+                mGREDir->Clone(getter_AddRefs(file));
+                if (NS_SUCCEEDED(mGREDir->Clone(getter_AddRefs(file)))) {
+                    file->AppendNative(NS_LITERAL_CSTRING("plugins"));
+                    if (NS_SUCCEEDED(file->Exists(&exists)) && exists) {
+                        dirs.AppendObject(file);
+                    }
+                }
+            }
         }
         return NS_NewArrayEnumerator(result, dirs);
     }
     return NS_ERROR_FAILURE;
 }