Index: chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java |
index 8cb5b5759cb34f521d5b4b6b0cd5afb541bcdb9b..614e71e50115752799e25f0edad5b1630e36a92e 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java |
@@ -423,6 +423,16 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie |
mRequestPayerEmail = options != null && options.requestPayerEmail; |
mShippingType = options == null ? PaymentShippingType.SHIPPING : options.shippingType; |
+ if (!OriginSecurityChecker.isSchemeCryptographic(mWebContents.getLastCommittedUrl()) |
+ && !OriginSecurityChecker.isOriginLocalhostOrFile( |
+ mWebContents.getLastCommittedUrl())) { |
+ Log.d(TAG, "Only localhost, file://, and cryptographic scheme origins allowed"); |
+ // Don't show any UI. Resolve .canMakePayment() with "false". Reject .show() with |
+ // "NotSupportedError". |
+ onAllPaymentAppsCreated(); |
+ return; |
+ } |
+ |
PaymentRequestMetrics.recordRequestedInformationHistogram( |
mRequestPayerEmail, mRequestPayerPhone, mRequestShipping, mRequestPayerName); |