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

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContentsClientBridge.java

Issue 2887173004: [Android WebView] Propagate Java exceptions from handleJsBeforeUnload. (Closed)
Patch Set: 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/java/src/org/chromium/android_webview/AwContentsClientBridge.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContentsClientBridge.java b/android_webview/java/src/org/chromium/android_webview/AwContentsClientBridge.java
index a294913efc1270ead695e6a680faae6726f85b01..b98ba498b08e6fb8b6083ec4a614e43efcae1426 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContentsClientBridge.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContentsClientBridge.java
@@ -7,6 +7,7 @@ package org.chromium.android_webview;
import android.content.Context;
import android.net.http.SslCertificate;
import android.net.http.SslError;
+import android.os.Handler;
import android.util.Log;
import android.webkit.ValueCallback;
@@ -249,9 +250,18 @@ public class AwContentsClientBridge {
}
@CalledByNative
- private void handleJsBeforeUnload(String url, String message, int id) {
- JsResultHandler handler = new JsResultHandler(this, id);
- mClient.handleJsBeforeUnload(url, message, handler);
+ private void handleJsBeforeUnload(final String url, final String message, final int id) {
+ // Post the application callback back to the current thread to ensure the application
+ // callback is executed without any native code on the stack. This so that any exception
+ // thrown by the application callback won't have to be propagated through a native call
+ // stack.
+ new Handler().post(new Runnable() {
+ @Override
+ public void run() {
+ JsResultHandler handler = new JsResultHandler(AwContentsClientBridge.this, id);
+ mClient.handleJsBeforeUnload(url, message, handler);
+ }
+ });
}
@CalledByNative
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698