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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java

Issue 2767333006: Add Digital Asset Links verification for postMessage API (Closed)
Patch Set: lizeb@ commetns Created 3 years, 9 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/customtabs/CustomTabsConnection.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java
index f9561882d3c25e7fb7d6c0f5b808ba67ba99a9d2..d5906361251765d3db345bf1c0e4c56fa826952e 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java
@@ -491,8 +491,17 @@ public class CustomTabsConnection {
// If the API is not enabled, we don't set the post message origin, which will
// avoid PostMessageHandler initialization and disallow postMessage calls.
if (!ChromeFeatureList.isEnabled(ChromeFeatureList.CCT_POST_MESSAGE_API)) return;
- mClientManager.initializeWithPostMessageOriginForSession(
- session, verifyOriginForSession(session, uid, postMessageOrigin));
+
+ // Attempt to verify origin synchronously. If successful directly initialize
+ // postMessage channel for session.
+ Uri verifiedOrigin = verifyOriginForSession(session, uid, postMessageOrigin);
+ if (verifiedOrigin == null) {
+ mClientManager.verifyAndInitializeWithPostMessageOriginForSession(
+ session, postMessageOrigin);
+ } else {
+ mClientManager.initializeWithPostMessageOriginForSession(
+ session, verifiedOrigin);
+ }
}
});
return true;

Powered by Google App Engine
This is Rietveld 408576698