2
browser/components/dirprovider/Makefile.in | 1
3
browser/components/dirprovider/nsBrowserDirectoryProvider.cpp | 54 +++++-----
4
2 files changed, 32 insertions(+), 23 deletions(-)
6
Index: mozilla/browser/components/dirprovider/nsBrowserDirectoryProvider.cpp
7
===================================================================
8
--- mozilla.orig/browser/components/dirprovider/nsBrowserDirectoryProvider.cpp
9
+++ mozilla/browser/components/dirprovider/nsBrowserDirectoryProvider.cpp
11
* use your version of this file under the terms of the MPL, indicate your
12
* decision by deleting the provisions above and replace them with the notice
13
* and other provisions required by the GPL or the LGPL. If you do not delete
14
* the provisions above, a recipient may use your version of this file under
15
* the terms of any one of the MPL, the GPL or the LGPL.
17
* ***** END LICENSE BLOCK ***** */
19
+#include "nsIChromeRegistry.h"
20
#include "nsIDirectoryService.h"
23
#include "nsISimpleEnumerator.h"
24
#include "nsIPrefService.h"
25
#include "nsIPrefBranch.h"
27
#include "nsArrayEnumerator.h"
28
@@ -234,47 +235,51 @@ AppendDistroSearchDirs(nsIProperties* aD
29
if (NS_FAILED(rv) || !exists)
32
nsCOMPtr<nsIFile> commonPlugins;
33
rv = searchPlugins->Clone(getter_AddRefs(commonPlugins));
34
if (NS_SUCCEEDED(rv)) {
35
commonPlugins->AppendNative(NS_LITERAL_CSTRING("common"));
36
rv = commonPlugins->Exists(&exists);
37
- if (NS_SUCCEEDED(rv) && exists)
38
- array.AppendObject(commonPlugins);
39
+ if (NS_FAILED(rv) || !exists)
40
+ commonPlugins = nsnull;
45
- nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
48
- nsCOMPtr<nsIFile> localePlugins;
49
- rv = searchPlugins->Clone(getter_AddRefs(localePlugins));
52
+ nsCAutoString locale;
53
+ nsCOMPtr<nsIFile> localePlugins;
54
+ rv = searchPlugins->Clone(getter_AddRefs(localePlugins));
58
- localePlugins->AppendNative(NS_LITERAL_CSTRING("locale"));
59
+ nsCOMPtr<nsIXULChromeRegistry> chromeReg =
60
+ do_GetService(NS_CHROMEREGISTRY_CONTRACTID);
65
- rv = prefs->GetCharPref("general.useragent.locale", getter_Copies(locale));
66
+ chromeReg->GetSelectedLocale(NS_LITERAL_CSTRING("global"), locale);
67
+ if (NS_SUCCEEDED(rv)) {
68
+ nsCOMPtr<nsIFile> curLocalePlugins;
69
+ rv = localePlugins->Clone(getter_AddRefs(curLocalePlugins));
70
if (NS_SUCCEEDED(rv)) {
72
- nsCOMPtr<nsIFile> curLocalePlugins;
73
- rv = localePlugins->Clone(getter_AddRefs(curLocalePlugins));
74
- if (NS_SUCCEEDED(rv)) {
76
- curLocalePlugins->AppendNative(locale);
77
- rv = curLocalePlugins->Exists(&exists);
78
- if (NS_SUCCEEDED(rv) && exists) {
79
- array.AppendObject(curLocalePlugins);
82
+ curLocalePlugins->AppendNative(locale);
83
+ rv = curLocalePlugins->Exists(&exists);
84
+ if (NS_SUCCEEDED(rv) && exists) {
85
+ array.AppendObject(curLocalePlugins);
87
+ array.AppendObject(commonPlugins);
93
+ nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
95
// we didn't append the locale dir - try the default one
97
rv = prefs->GetCharPref("distribution.searchplugins.defaultLocale",
98
getter_Copies(defLocale));
99
if (NS_SUCCEEDED(rv)) {
101
nsCOMPtr<nsIFile> defLocalePlugins;
102
rv = localePlugins->Clone(getter_AddRefs(defLocalePlugins));
103
@@ -282,16 +287,19 @@ AppendDistroSearchDirs(nsIProperties* aD
105
defLocalePlugins->AppendNative(defLocale);
106
rv = defLocalePlugins->Exists(&exists);
107
if (NS_SUCCEEDED(rv) && exists)
108
array.AppendObject(defLocalePlugins);
114
+ array.AppendObject(commonPlugins);
118
nsBrowserDirectoryProvider::GetFiles(const char *aKey,
119
nsISimpleEnumerator* *aResult)
123
Index: mozilla/browser/components/dirprovider/Makefile.in
124
===================================================================
125
--- mozilla.orig/browser/components/dirprovider/Makefile.in
126
+++ mozilla/browser/components/dirprovider/Makefile.in
127
@@ -53,16 +53,17 @@ FORCE_SHARED_LIB = 1
129
# Because we are an application component, link against the CRT statically
130
# (on Windows, but only if we're not building our own CRT for jemalloc)
143
CPPSRCS = nsBrowserDirectoryProvider.cpp