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

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: Fix up Android test Created 3 years, 7 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
« no previous file with comments | « no previous file | chrome/android/java_sources.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d6d3b11a2a766a6bb94c176e550eae415294c97f..ef7f31860f11720395db5a9bab0c8f9c22a4916d 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
@@ -424,6 +424,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 | chrome/android/java_sources.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698