зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1481971 - Enable PaymentRequest on Nightly for Windows/macOS for US/CA users on en-US builds r=MattN,baku,gandalf
--HG-- extra : rebase_source : afd01adfdfdd57b497dff28e674b69e2a7d9e73a
This commit is contained in:
Родитель
dafac54f4d
Коммит
0ad023d797
|
@ -10,6 +10,8 @@
|
|||
#include "mozilla/dom/PaymentRequest.h"
|
||||
#include "mozilla/dom/PaymentRequestChild.h"
|
||||
#include "mozilla/dom/PaymentResponse.h"
|
||||
#include "mozilla/intl/LocaleService.h"
|
||||
#include "mozilla/intl/MozLocale.h"
|
||||
#include "mozilla/EventStateManager.h"
|
||||
#include "mozilla/StaticPrefs.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
@ -19,6 +21,8 @@
|
|||
#include "PaymentRequestManager.h"
|
||||
#include "mozilla/dom/MerchantValidationEvent.h"
|
||||
|
||||
using mozilla::intl::LocaleService;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
|
@ -60,11 +64,35 @@ NS_IMPL_RELEASE_INHERITED(PaymentRequest, DOMEventTargetHelper)
|
|||
bool
|
||||
PaymentRequest::PrefEnabled(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
#ifdef NIGHTLY_BUILD
|
||||
#if defined(NIGHTLY_BUILD)
|
||||
const char* supportedRegions[] = { "US", "CA" };
|
||||
|
||||
if (!XRE_IsContentProcess()) {
|
||||
return false;
|
||||
}
|
||||
return StaticPrefs::dom_payments_request_enabled();
|
||||
if (!StaticPrefs::dom_payments_request_enabled()) {
|
||||
return false;
|
||||
}
|
||||
nsAutoString region;
|
||||
Preferences::GetString("browser.search.region", region);
|
||||
bool regionIsSupported = false;
|
||||
for (const char* each : supportedRegions) {
|
||||
if (region.EqualsASCII(each)) {
|
||||
regionIsSupported = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!regionIsSupported) {
|
||||
return false;
|
||||
}
|
||||
nsAutoCString locale;
|
||||
LocaleService::GetInstance()->GetAppLocaleAsLangTag(locale);
|
||||
mozilla::intl::Locale loc = mozilla::intl::Locale(locale);
|
||||
if (!(loc.GetLanguage() == "en" && loc.GetRegion() == "US")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
|
|
@ -658,6 +658,8 @@ var interfaceNamesInGlobalScope =
|
|||
{name: "MediaStreamTrackEvent", insecureContext: true},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "MediaStreamTrack", insecureContext: true},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "MerchantValidationEvent", insecureContext: false, desktop: true, nightly: true, linux: false},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "MessageChannel", insecureContext: true},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
|
@ -738,6 +740,16 @@ var interfaceNamesInGlobalScope =
|
|||
{name: "PannerNode", insecureContext: true},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "Path2D", insecureContext: true},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "PaymentAddress", insecureContext: false, desktop: true, nightly: true, linux: false},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "PaymentMethodChangeEvent", insecureContext: false, desktop: true, nightly: true, linux: false},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "PaymentRequest", insecureContext: false, desktop: true, nightly: true, linux: false},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "PaymentRequestUpdateEvent", insecureContext: false, desktop: true, nightly: true, linux: false},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "PaymentResponse", insecureContext: false, desktop: true, nightly: true, linux: false},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "Performance", insecureContext: true},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
|
|
|
@ -223,7 +223,7 @@ VARCACHE_PREF(
|
|||
PREF("dom.serviceWorkers.parent_intercept", bool, false)
|
||||
|
||||
// Enable PaymentRequest API
|
||||
#ifdef NIGHTLY_BUILD
|
||||
#if defined(NIGHTLY_BUILD) && (defined(XP_WIN) || defined(XP_MACOSX))
|
||||
# define PREF_VALUE true
|
||||
#else
|
||||
# define PREF_VALUE false
|
||||
|
|
|
@ -5847,8 +5847,7 @@ pref("dom.moduleScripts.enabled", true);
|
|||
// callback are allowed to run before yielding the event loop.
|
||||
pref("dom.timeout.max_consecutive_callbacks_ms", 4);
|
||||
|
||||
// Use this preference to house "Payment Request API" during development
|
||||
pref("dom.payments.request.enabled", false);
|
||||
// Payment Request API preferences
|
||||
pref("dom.payments.loglevel", "Warn");
|
||||
pref("dom.payments.defaults.saveCreditCard", false);
|
||||
pref("dom.payments.defaults.saveAddress", true);
|
||||
|
|
Загрузка…
Ссылка в новой задаче