summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard He <linyhe@microsoft.com>2023-04-15 01:53:46 +0000
committerCopybara-Service <copybara-worker@google.com>2023-04-14 19:05:57 -0700
commit416ff60eeb72fec744cc5c15d5898243b477a188 (patch)
tree99b07b84fec8f1ac3208ccd526cb5ab5e41d2c57
parent0baab1a7112ed22f356e0a1482df8050dd0a20e9 (diff)
downloadwebview_support_interfaces-416ff60eeb72fec744cc5c15d5898243b477a188.tar.gz
Wire up WebMessageListener ArrayBuffer support with AndroidX boundary
This CL wire up newly added ArrayBuffer type support of WebMessageListener to AndroidX boundary. All changes are still behind feature flags: `WEB_MESSAGE_GET_MESSAGE_PAYLOAD` and `kArrayBufferJsToBrowser` in native. - Rename feature flag to indicate ArrayBuffer type. The flag is not used in prod (behind DEV suffix). - WebView->AndroidX: Post ArrayBuffer when AndroidX supports the new flag. (Right now JS -> Java ArrayBuffer is behind feature flag). - AndroidX->WebView: Add new 'postMessageWithPayload' method to 'JsReplyProxy', the existing one only accepts string. Same changes in AndroidX are required later. Test: Build and install WebView on userdbg pixel, run AndroidX webkit tests. ArrayBuffer tests will be added in AndroidX when feature is ready. Bug: 1374142 Change-Id: I3dbcd714cddc0efb0c1619019f26d2c82d2aa73e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4297714 Reviewed-by: Peter Pakkenberg <pbirk@chromium.org> Commit-Queue: Richard He <linyhe@microsoft.com> Reviewed-by: Bo Liu <boliu@chromium.org> Cr-Commit-Position: refs/heads/main@{#1130770} NOKEYCHECK=True GitOrigin-RevId: 8dd9b603fc60984977ceadf78475da8c6889043e
-rw-r--r--src/org/chromium/support_lib_boundary/JsReplyProxyBoundaryInterface.java5
-rw-r--r--src/org/chromium/support_lib_boundary/util/Features.java7
2 files changed, 9 insertions, 3 deletions
diff --git a/src/org/chromium/support_lib_boundary/JsReplyProxyBoundaryInterface.java b/src/org/chromium/support_lib_boundary/JsReplyProxyBoundaryInterface.java
index 046b157..d8ad2b1 100644
--- a/src/org/chromium/support_lib_boundary/JsReplyProxyBoundaryInterface.java
+++ b/src/org/chromium/support_lib_boundary/JsReplyProxyBoundaryInterface.java
@@ -4,9 +4,14 @@
package org.chromium.support_lib_boundary;
+import java.lang.reflect.InvocationHandler;
+
/**
* Boundary interface for org.chromium.android_webview.WebMessageListener.
*/
public interface JsReplyProxyBoundaryInterface extends IsomorphicObjectBoundaryInterface {
+ @Deprecated
void postMessage(String message);
+
+ void postMessageWithPayload(/* MessagePayload */ InvocationHandler payload);
}
diff --git a/src/org/chromium/support_lib_boundary/util/Features.java b/src/org/chromium/support_lib_boundary/util/Features.java
index a0e17e5..19552a1 100644
--- a/src/org/chromium/support_lib_boundary/util/Features.java
+++ b/src/org/chromium/support_lib_boundary/util/Features.java
@@ -105,11 +105,12 @@ public class Features {
public static final String SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL =
"SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL";
+ // JsReplyProxy.postMessageWithPayload
// WebMessage.getMessagePayload
- // WebMessagePayload.getType
- // WebMessagePayload.getAsString
// WebMessagePayload.getAsArrayBuffer
- public static final String WEB_MESSAGE_GET_MESSAGE_PAYLOAD = "WEB_MESSAGE_GET_MESSAGE_PAYLOAD";
+ // WebMessagePayload.getAsString
+ // WebMessagePayload.getType
+ public static final String WEB_MESSAGE_ARRAY_BUFFER = "WEB_MESSAGE_ARRAY_BUFFER";
// WebMessagePortCompat.postMessage
public static final String WEB_MESSAGE_PORT_POST_MESSAGE = "WEB_MESSAGE_PORT_POST_MESSAGE";