diff options
author | Steve Block <steveblock@google.com> | 2012-04-25 21:12:50 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2012-04-26 13:49:12 +0100 |
commit | b5ce3d2b8190969ba36e8c0635c531e71d92e538 (patch) | |
tree | 0306e3235a4b7b1c111f49f9f50ab662fa756a4a /Source/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp | |
parent | 87431609180dfb277a94cb8b81554e8bd2ef355d (diff) | |
download | external_webkit-b5ce3d2b8190969ba36e8c0635c531e71d92e538.zip external_webkit-b5ce3d2b8190969ba36e8c0635c531e71d92e538.tar.gz external_webkit-b5ce3d2b8190969ba36e8c0635c531e71d92e538.tar.bz2 |
Handle uncaught exceptions from methods called through the Java Bridge
This is a cherry-pick from master. See
https://android-git.corp.google.com/g/184252
If a method called on a Java object through the Java Bridge throws an uncaught
exception, handle it native-side by clearing the exception to prevent a crash,
and throwing a JavaScript exception.
See tests in https://android-git.corp.google.com/g/184260
Bug: 6386557
Change-Id: I2d123672892887340798d2c0494941fc269ce99c
Diffstat (limited to 'Source/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp')
-rw-r--r-- | Source/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Source/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp b/Source/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp index b22d57f..784ea01 100644 --- a/Source/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp +++ b/Source/WebCore/bridge/jni/v8/JavaNPObjectV8.cpp @@ -146,10 +146,16 @@ bool JavaNPObjectInvoke(NPObject* obj, NPIdentifier identifier, const NPVariant* for (unsigned int i = 0; i < argCount; i++) jArgs[i] = convertNPVariantToJavaValue(args[i], jMethod->parameterAt(i)); - JavaValue jResult = instance->invokeMethod(jMethod, jArgs); +// ANDROID + bool exceptionOccurred; + JavaValue jResult = instance->invokeMethod(jMethod, jArgs, exceptionOccurred); instance->end(); delete[] jArgs; + if (exceptionOccurred) + return false; +// END ANDROID + VOID_TO_NPVARIANT(*result); convertJavaValueToNPVariant(jResult, result); return true; |