Backed out changeset f1e6ccbef48d (bug 1501102) for linux leakcheck failures on a CLOSED TREE

This commit is contained in:
Gurzau Raul 2018-11-09 02:02:15 +02:00
Родитель f8bac7cdf2
Коммит bbba357bf9
4 изменённых файлов: 15 добавлений и 44 удалений

Просмотреть файл

@ -65,17 +65,24 @@ bool
PaymentRequest::PrefEnabled(JSContext* aCx, JSObject* aObj)
{
#if defined(NIGHTLY_BUILD)
const char* supportedRegions[] = { "US", "CA" };
if (!XRE_IsContentProcess()) {
return false;
}
if (!StaticPrefs::dom_payments_request_enabled()) {
return false;
}
RefPtr<PaymentRequestManager> manager = PaymentRequestManager::GetSingleton();
MOZ_ASSERT(manager);
nsAutoString region;
Preferences::GetString("browser.search.region", region);
if (!manager->IsRegionSupported(region)) {
bool regionIsSupported = false;
for (const char* each : supportedRegions) {
if (region.EqualsASCII(each)) {
regionIsSupported = true;
break;
}
}
if (!regionIsSupported) {
return false;
}
nsAutoCString locale;

Просмотреть файл

@ -296,42 +296,6 @@ ConvertResponseData(const IPCPaymentResponseData& aIPCData,
/* PaymentRequestManager */
StaticRefPtr<PaymentRequestManager> gPaymentManager;
const char kSupportedRegionsPref[] = "dom.payments.request.supportedRegions";
nsTArray<nsString> gSupportedRegions;
void
SupportedRegionsPrefChangedCallback(const char* aPrefName, void* aClosure)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!strcmp(aPrefName, kSupportedRegionsPref));
MOZ_ASSERT(!aClosure);
nsAutoString supportedRegions;
Preferences::GetString(aPrefName, supportedRegions);
gSupportedRegions.Clear();
for (const nsAString& each : supportedRegions.Split(',')) {
gSupportedRegions.AppendElement(each);
}
}
PaymentRequestManager::PaymentRequestManager()
{
Preferences::RegisterCallbackAndCall(SupportedRegionsPrefChangedCallback,
kSupportedRegionsPref);
}
PaymentRequestManager::~PaymentRequestManager()
{
MOZ_ASSERT(mActivePayments.Count() == 0);
Preferences::UnregisterCallback(SupportedRegionsPrefChangedCallback,
kSupportedRegionsPref);
}
bool
PaymentRequestManager::IsRegionSupported(const nsAString& region) const
{
return gSupportedRegions.Contains(region);
}
PaymentRequestChild*
PaymentRequestManager::GetPaymentChild(PaymentRequest* aRequest)

Просмотреть файл

@ -74,15 +74,16 @@ public:
const nsAString& aPayerEmail,
const nsAString& aPayerPhone);
bool IsRegionSupported(const nsAString& region) const;
// Called to ensure that we don't "leak" aRequest if we shut down while it had
// an active request to the parent.
void RequestIPCOver(PaymentRequest* aRequest);
private:
PaymentRequestManager();
~PaymentRequestManager();
PaymentRequestManager() = default;
~PaymentRequestManager()
{
MOZ_ASSERT(mActivePayments.Count() == 0);
}
PaymentRequestChild* GetPaymentChild(PaymentRequest* aRequest);

Просмотреть файл

@ -5881,7 +5881,6 @@ pref("dom.timeout.max_consecutive_callbacks_ms", 4);
pref("dom.payments.loglevel", "Warn");
pref("dom.payments.defaults.saveCreditCard", false);
pref("dom.payments.defaults.saveAddress", true);
pref("dom.payments.request.supportedRegions", "US,CA");
#ifdef MOZ_ASAN_REPORTER
pref("asanreporter.apiurl", "https://anf1.fuzzing.mozilla.org/crashproxy/submit/");