diff options
Diffstat (limited to 'Source/WebCore')
-rw-r--r-- | Source/WebCore/platform/android/GeolocationServiceBridge.cpp | 17 | ||||
-rw-r--r-- | Source/WebCore/plugins/android/PluginViewAndroid.cpp | 2 |
2 files changed, 14 insertions, 5 deletions
diff --git a/Source/WebCore/platform/android/GeolocationServiceBridge.cpp b/Source/WebCore/platform/android/GeolocationServiceBridge.cpp index 2e81b32..697b63b 100644 --- a/Source/WebCore/platform/android/GeolocationServiceBridge.cpp +++ b/Source/WebCore/platform/android/GeolocationServiceBridge.cpp @@ -87,21 +87,24 @@ GeolocationServiceBridge::~GeolocationServiceBridge() bool GeolocationServiceBridge::start() { - ASSERT(m_javaGeolocationServiceObject); + if (!m_javaGeolocationServiceObject) + return false; return getJNIEnv()->CallBooleanMethod(m_javaGeolocationServiceObject, javaGeolocationServiceClassMethodIDs[GeolocationServiceMethodStart]); } void GeolocationServiceBridge::stop() { - ASSERT(m_javaGeolocationServiceObject); + if (!m_javaGeolocationServiceObject) + return; getJNIEnv()->CallVoidMethod(m_javaGeolocationServiceObject, javaGeolocationServiceClassMethodIDs[GeolocationServiceMethodStop]); } void GeolocationServiceBridge::setEnableGps(bool enable) { - ASSERT(m_javaGeolocationServiceObject); + if (!m_javaGeolocationServiceObject) + return; getJNIEnv()->CallVoidMethod(m_javaGeolocationServiceObject, javaGeolocationServiceClassMethodIDs[GeolocationServiceMethodSetEnableGps], enable); @@ -185,10 +188,13 @@ void GeolocationServiceBridge::startJavaImplementation(Frame* frame) env->GetMethodID(javaGeolocationServiceClass, "setEnableGps", "(Z)V"); // Create the Java GeolocationService object. + jobject context = android::WebViewCore::getWebViewCore(frame->view())->getContext(); + if (!context) + return; jlong nativeObject = reinterpret_cast<jlong>(this); jobject object = env->NewObject(javaGeolocationServiceClass, javaGeolocationServiceClassMethodIDs[GeolocationServiceMethodInit], - android::WebViewCore::getWebViewCore(frame->view())->getContext(), + context, nativeObject); m_javaGeolocationServiceObject = getJNIEnv()->NewGlobalRef(object); @@ -232,7 +238,8 @@ void GeolocationServiceBridge::startJavaImplementation(Frame* frame) void GeolocationServiceBridge::stopJavaImplementation() { // Called by GeolocationServiceAndroid on WebKit thread. - ASSERT(m_javaGeolocationServiceObject); + if (!m_javaGeolocationServiceObject) + return; getJNIEnv()->DeleteGlobalRef(m_javaGeolocationServiceObject); } diff --git a/Source/WebCore/plugins/android/PluginViewAndroid.cpp b/Source/WebCore/plugins/android/PluginViewAndroid.cpp index 6c712d0..8b737ea 100644 --- a/Source/WebCore/plugins/android/PluginViewAndroid.cpp +++ b/Source/WebCore/plugins/android/PluginViewAndroid.cpp @@ -539,6 +539,7 @@ bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* re // Return the top level WebView Java object associated // with this instance. jobject *retObject = static_cast<jobject*>(value); + // TODO: Is it safe for this to be NULL? It looks from the NPNVWindowNPObject case that it is. *retObject = android::WebViewCore::getWebViewCore(parent())->getWebViewJavaObject(); *result = NPERR_NO_ERROR; return true; @@ -564,6 +565,7 @@ bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* re case kJavaContext_ANPGetValue: { jobject* retObject = static_cast<jobject*>(value); + // TODO: Is it safe for this to be NULL? It looks from the NPNVWindowNPObject case that it is. *retObject = android::WebViewCore::getWebViewCore(parent())->getContext(); *result = NPERR_NO_ERROR; return true; |