| 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
|
|
|