Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(712)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java

Issue 2859613002: Disable web payments API on blob: and data: schemes. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
« no previous file with comments | « no previous file | components/payments/content/payment_request.cc » ('j') | components/payments/content/payment_request.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698