Skip to content

Commit 7b340f9

Browse files
author
Butkovits Atila
committed
Backed out 15 changesets (bug 1612824, bug 1661234, bug 1619926, bug 1612380, bug 1559530, bug 1642990) for Xpc failures. CLOSED TREE
Backed out changeset 426d017d7e46 (bug 1642990) Backed out changeset 84ab4021d403 (bug 1559530) Backed out changeset 82a8305543e5 (bug 1559530) Backed out changeset 38832c1185b8 (bug 1559530) Backed out changeset f16918c10a6b (bug 1661234) Backed out changeset 3a13258fbd51 (bug 1661234) Backed out changeset abf8d8b24845 (bug 1612824) Backed out changeset 7dfeb065a385 (bug 1619926) Backed out changeset bc9d3e210fe7 (bug 1619926) Backed out changeset 786164c461ae (bug 1619926) Backed out changeset d89793e9d17d (bug 1619926) Backed out changeset d665885bc912 (bug 1619926) Backed out changeset 9260b6620943 (bug 1619926) Backed out changeset af69a4896f2f (bug 1619926) Backed out changeset b9cd6b7047b9 (bug 1612380)
1 parent 9252211 commit 7b340f9

File tree

92 files changed

+3542
-351
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+3542
-351
lines changed

browser/app/profile/firefox.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,10 @@ pref("browser.helperApps.showOpenOptionForViewableInternally", true);
421421
// search engines URL
422422
pref("browser.search.searchEnginesURL", "https://addons.mozilla.org/%LOCALE%/firefox/search-engines/");
423423

424+
// Market-specific search defaults
425+
pref("browser.search.geoSpecificDefaults", true);
426+
pref("browser.search.geoSpecificDefaults.url", "https://search.services.mozilla.com/1/%APP%/%VERSION%/%CHANNEL%/%LOCALE%/%REGION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%");
427+
424428
// search bar results always open in a new tab
425429
pref("browser.search.openintab", false);
426430

@@ -441,6 +445,8 @@ pref("browser.search.widget.inNavBar", false);
441445
// The maximum amount of times the private default banner is shown.
442446
pref("browser.search.separatePrivateDefault.ui.banner.max", 0);
443447

448+
pref("browser.search.modernConfig", true);
449+
444450
pref("browser.sessionhistory.max_entries", 50);
445451

446452
// Built-in default permissions.

browser/components/build/components.conf

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@
44
# License, v. 2.0. If a copy of the MPL was not distributed with this
55
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
66

7-
Classes = []
7+
Classes = [
8+
{
9+
'cid': '{6deb193c-f87d-4078-bc78-5e64655b4d62}',
10+
'contract_ids': ['@mozilla.org/browser/directory-provider;1'],
11+
'type': 'mozilla::browser::DirectoryProvider',
12+
'headers': ['mozilla/browser/DirectoryProvider.h'],
13+
'categories': {'xpcom-directory-providers': 'browser-directory-provider'},
14+
},
15+
]
816

917
TOOLKIT = buildconfig.substs['MOZ_WIDGET_TOOLKIT']
1018

browser/components/build/moz.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ FINAL_LIBRARY = 'xul'
1616

1717
LOCAL_INCLUDES += [
1818
'../about',
19+
'../dirprovider',
1920
'../migration',
2021
'../sessionstore',
2122
'../shell',

browser/components/build/nsBrowserCompsCID.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,11 @@
3939
0xb1, 0x31, 0xd9, 0x3d, 0x7d, 0x70, 0x4f, 0x64 \
4040
} \
4141
}
42+
43+
// {6DEB193C-F87D-4078-BC78-5E64655B4D62}
44+
#define NS_BROWSERDIRECTORYPROVIDER_CID \
45+
{ \
46+
0x6deb193c, 0xf87d, 0x4078, { \
47+
0xbc, 0x78, 0x5e, 0x64, 0x65, 0x5b, 0x4d, 0x62 \
48+
} \
49+
}
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
5+
#include "DirectoryProvider.h"
6+
7+
#include "nsIFile.h"
8+
#include "nsISimpleEnumerator.h"
9+
#include "nsIPrefService.h"
10+
#include "nsIPrefBranch.h"
11+
12+
#include "nsArrayEnumerator.h"
13+
#include "nsEnumeratorUtils.h"
14+
#include "nsAppDirectoryServiceDefs.h"
15+
#include "nsDirectoryServiceDefs.h"
16+
#include "nsCategoryManagerUtils.h"
17+
#include "nsComponentManagerUtils.h"
18+
#include "nsCOMArray.h"
19+
#include "nsDirectoryServiceUtils.h"
20+
#include "mozilla/ModuleUtils.h"
21+
#include "mozilla/intl/LocaleService.h"
22+
#include "nsServiceManagerUtils.h"
23+
#include "nsString.h"
24+
#include "nsXULAppAPI.h"
25+
26+
using mozilla::intl::LocaleService;
27+
28+
namespace mozilla {
29+
namespace browser {
30+
31+
NS_IMPL_ISUPPORTS(DirectoryProvider, nsIDirectoryServiceProvider,
32+
nsIDirectoryServiceProvider2)
33+
34+
NS_IMETHODIMP
35+
DirectoryProvider::GetFile(const char* aKey, bool* aPersist,
36+
nsIFile** aResult) {
37+
return NS_ERROR_FAILURE;
38+
}
39+
40+
// Appends the distribution-specific search engine directories to the
41+
// array. The directory structure is as follows:
42+
43+
// appdir/
44+
// \- distribution/
45+
// \- searchplugins/
46+
// |- common/
47+
// \- locale/
48+
// |- <locale 1>/
49+
// ...
50+
// \- <locale N>/
51+
52+
// common engines are loaded for all locales. If there is no locale
53+
// directory for the current locale, there is a pref:
54+
// "distribution.searchplugins.defaultLocale"
55+
// which specifies a default locale to use.
56+
57+
static void AppendDistroSearchDirs(nsIProperties* aDirSvc,
58+
nsCOMArray<nsIFile>& array) {
59+
nsCOMPtr<nsIFile> searchPlugins;
60+
nsresult rv = aDirSvc->Get(XRE_APP_DISTRIBUTION_DIR, NS_GET_IID(nsIFile),
61+
getter_AddRefs(searchPlugins));
62+
if (NS_FAILED(rv)) return;
63+
searchPlugins->AppendNative("searchplugins"_ns);
64+
65+
nsCOMPtr<nsIFile> commonPlugins;
66+
rv = searchPlugins->Clone(getter_AddRefs(commonPlugins));
67+
if (NS_SUCCEEDED(rv)) {
68+
commonPlugins->AppendNative("common"_ns);
69+
array.AppendObject(commonPlugins);
70+
}
71+
72+
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
73+
if (prefs) {
74+
nsCOMPtr<nsIFile> localePlugins;
75+
rv = searchPlugins->Clone(getter_AddRefs(localePlugins));
76+
if (NS_FAILED(rv)) return;
77+
78+
localePlugins->AppendNative("locale"_ns);
79+
80+
nsAutoCString defLocale;
81+
rv = prefs->GetCharPref("distribution.searchplugins.defaultLocale",
82+
defLocale);
83+
if (NS_SUCCEEDED(rv)) {
84+
nsCOMPtr<nsIFile> defLocalePlugins;
85+
rv = localePlugins->Clone(getter_AddRefs(defLocalePlugins));
86+
if (NS_SUCCEEDED(rv)) {
87+
defLocalePlugins->AppendNative(defLocale);
88+
array.AppendObject(defLocalePlugins);
89+
return; // all done
90+
}
91+
}
92+
93+
// we didn't have a defaultLocale, use the user agent locale
94+
nsAutoCString locale;
95+
LocaleService::GetInstance()->GetAppLocaleAsBCP47(locale);
96+
97+
nsCOMPtr<nsIFile> curLocalePlugins;
98+
rv = localePlugins->Clone(getter_AddRefs(curLocalePlugins));
99+
if (NS_SUCCEEDED(rv)) {
100+
curLocalePlugins->AppendNative(locale);
101+
array.AppendObject(curLocalePlugins);
102+
return; // all done
103+
}
104+
}
105+
}
106+
107+
NS_IMETHODIMP
108+
DirectoryProvider::GetFiles(const char* aKey, nsISimpleEnumerator** aResult) {
109+
if (!strcmp(aKey, NS_APP_DISTRIBUTION_SEARCH_DIR_LIST)) {
110+
nsCOMPtr<nsIProperties> dirSvc(
111+
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID));
112+
if (!dirSvc) return NS_ERROR_FAILURE;
113+
114+
nsCOMArray<nsIFile> distroFiles;
115+
AppendDistroSearchDirs(dirSvc, distroFiles);
116+
117+
return NS_NewArrayEnumerator(aResult, distroFiles, NS_GET_IID(nsIFile));
118+
}
119+
120+
return NS_ERROR_FAILURE;
121+
}
122+
123+
NS_IMETHODIMP
124+
DirectoryProvider::AppendingEnumerator::HasMoreElements(bool* aResult) {
125+
*aResult = mNext ? true : false;
126+
return NS_OK;
127+
}
128+
129+
NS_IMETHODIMP
130+
DirectoryProvider::AppendingEnumerator::GetNext(nsISupports** aResult) {
131+
if (aResult) NS_ADDREF(*aResult = mNext);
132+
133+
mNext = nullptr;
134+
135+
// Ignore all errors
136+
137+
bool more;
138+
while (NS_SUCCEEDED(mBase->HasMoreElements(&more)) && more) {
139+
nsCOMPtr<nsISupports> nextbasesupp;
140+
mBase->GetNext(getter_AddRefs(nextbasesupp));
141+
142+
nsCOMPtr<nsIFile> nextbase(do_QueryInterface(nextbasesupp));
143+
if (!nextbase) continue;
144+
145+
nextbase->Clone(getter_AddRefs(mNext));
146+
if (!mNext) continue;
147+
148+
char const* const* i = mAppendList;
149+
while (*i) {
150+
mNext->AppendNative(nsDependentCString(*i));
151+
++i;
152+
}
153+
154+
mNext = nullptr;
155+
}
156+
157+
return NS_OK;
158+
}
159+
160+
DirectoryProvider::AppendingEnumerator::AppendingEnumerator(
161+
nsISimpleEnumerator* aBase, char const* const* aAppendList)
162+
: mBase(aBase), mAppendList(aAppendList) {
163+
// Initialize mNext to begin.
164+
GetNext(nullptr);
165+
}
166+
167+
} // namespace browser
168+
} // namespace mozilla
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
5+
#ifndef DirectoryProvider_h__
6+
#define DirectoryProvider_h__
7+
8+
#include "nsIDirectoryService.h"
9+
#include "nsComponentManagerUtils.h"
10+
#include "nsSimpleEnumerator.h"
11+
#include "mozilla/Attributes.h"
12+
13+
#define NS_BROWSERDIRECTORYPROVIDER_CONTRACTID \
14+
"@mozilla.org/browser/directory-provider;1"
15+
16+
namespace mozilla {
17+
namespace browser {
18+
19+
class DirectoryProvider final : public nsIDirectoryServiceProvider2 {
20+
public:
21+
NS_DECL_ISUPPORTS
22+
NS_DECL_NSIDIRECTORYSERVICEPROVIDER
23+
NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
24+
25+
private:
26+
~DirectoryProvider() {}
27+
28+
class AppendingEnumerator final : public nsSimpleEnumerator {
29+
public:
30+
NS_DECL_NSISIMPLEENUMERATOR
31+
32+
AppendingEnumerator(nsISimpleEnumerator* aBase,
33+
char const* const* aAppendList);
34+
35+
private:
36+
~AppendingEnumerator() override = default;
37+
38+
nsCOMPtr<nsISimpleEnumerator> mBase;
39+
char const* const* const mAppendList;
40+
nsCOMPtr<nsIFile> mNext;
41+
};
42+
};
43+
44+
} // namespace browser
45+
} // namespace mozilla
46+
47+
#endif // DirectoryProvider_h__
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
2+
# vim: set filetype=python:
3+
# This Source Code Form is subject to the terms of the Mozilla Public
4+
# License, v. 2.0. If a copy of the MPL was not distributed with this
5+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
6+
7+
with Files("**"):
8+
BUG_COMPONENT = ("Firefox", "General")
9+
10+
EXPORTS.mozilla.browser += [
11+
'DirectoryProvider.h',
12+
]
13+
14+
SOURCES += [
15+
'DirectoryProvider.cpp',
16+
]
17+
18+
FINAL_LIBRARY = 'browsercomps'
19+
20+
LOCAL_INCLUDES += [
21+
'../build'
22+
]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"default": {
3+
"searchDefault": "test",
4+
"visibleDefaultEngines": [
5+
"test", "test2"
6+
]
7+
}
8+
}

browser/components/extensions/test/xpcshell/test_ext_urlbar.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const ORIGINAL_NOTIFICATION_TIMEOUT =
4242

4343
add_task(async function startup() {
4444
Services.prefs.setCharPref("browser.search.region", "US");
45+
Services.prefs.setBoolPref("browser.search.geoSpecificDefaults", false);
4546
Services.prefs.setIntPref("browser.search.addonLoadTimeout", 0);
4647
Services.prefs.setBoolPref(
4748
"browser.search.separatePrivateDefault.ui.enabled",

browser/components/extensions/test/xpcshell/xpcshell.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ skip-if = tsan # Times out, bug 1612707
2727
support-files =
2828
data/test/manifest.json
2929
data/test2/manifest.json
30+
data/list.json
3031
[test_ext_settings_overrides_search.js]
3132
[test_ext_settings_overrides_search_mozParam.js]
3233
support-files =
3334
data/test/manifest.json
35+
data/list.json
3436
[test_ext_settings_overrides_shutdown.js]
3537
[test_ext_settings_validate.js]
3638
[test_ext_topSites.js]

0 commit comments

Comments
 (0)