{
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
+ if (!obj.get())
+ return;
env->CallVoidMethod(obj.get(), mSetSharedTimer, timemillis);
}
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
+ if (!obj.get())
+ return;
env->CallVoidMethod(obj.get(), mStopSharedTimer);
}
JavaBridge::setCookies(WebCore::KURL const& url, WebCore::String const& value)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = getRealObject(env, mJavaObject);
+ if (!obj.get())
+ return;
const WebCore::String& urlStr = url.string();
jstring jUrlStr = env->NewString(urlStr.characters(), urlStr.length());
jstring jValueStr = env->NewString(value.characters(), value.length());
- AutoJObject obj = getRealObject(env, mJavaObject);
env->CallVoidMethod(obj.get(), mSetCookies, jUrlStr, jValueStr);
env->DeleteLocalRef(jUrlStr);
env->DeleteLocalRef(jValueStr);
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
const WebCore::String& urlStr = url.string();
- jstring jUrlStr = env->NewString(urlStr.characters(), urlStr.length());
-
AutoJObject obj = getRealObject(env, mJavaObject);
+ if (!obj.get())
+ return WebCore::String();
+ jstring jUrlStr = env->NewString(urlStr.characters(), urlStr.length());
jstring string = (jstring)(env->CallObjectMethod(obj.get(), mCookies, jUrlStr));
WebCore::String ret = to_string(env, string);
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
+ if (!obj.get())
+ return false;
jboolean ret = env->CallBooleanMethod(obj.get(), mCookiesEnabled);
return (ret != 0);
}
WTF::Vector<WebCore::String> directories;
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
+ if (!obj.get())
+ return directories;
jobjectArray array = (jobjectArray)
env->CallObjectMethod(obj.get(), mGetPluginDirectories);
int count = env->GetArrayLength(array);
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
+ if (!obj.get())
+ return WebCore::String();
jstring ret = (jstring)env->CallObjectMethod(obj.get(), mGetPluginSharedDataDirectory);
WebCore::String path = to_string(env, ret);
checkException(env);
// environment is setup.
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
+ if (!obj.get())
+ return;
env->CallVoidMethod(obj.get(), mSignalFuncPtrQueue);
}
WTF::Vector<WebCore::String> list;
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
+ if (!obj.get())
+ return list;
jobjectArray array = (jobjectArray) env->CallObjectMethod(obj.get(),
mGetKeyStrengthList);
int count = env->GetArrayLength(array);
WebCore::HTTPHeaderMap headers = request.httpHeaderFields();
JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = mJavaFrame->frame(env);
+ if (!obj.get())
+ return 0;
+
WebCore::String urlStr = request.url().string();
int colon = urlStr.find(':');
bool allLower = true;
jobject jLoadListener =
- env->CallObjectMethod(mJavaFrame->frame(env).get(), mJavaFrame->mStartLoadingResource,
+ env->CallObjectMethod(obj.get(), mJavaFrame->mStartLoadingResource,
(int)loader, jUrlStr, jMethodStr, jHeaderMap,
jPostDataStr, cacheMode, synchronous);
#endif
LOGV("::WebCore:: reportError(%d, %s)", errorCode, description.ascii().data());
JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = mJavaFrame->frame(env);
+ if (!obj.get())
+ return;
jstring descStr = env->NewString((unsigned short*)description.characters(), description.length());
jstring failUrl = env->NewString((unsigned short*)failingUrl.characters(), failingUrl.length());
- env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mReportError, errorCode, descStr, failUrl);
+ env->CallVoidMethod(obj.get(), mJavaFrame->mReportError, errorCode, descStr, failUrl);
env->DeleteLocalRef(descStr);
env->DeleteLocalRef(failUrl);
}
return;
JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = mJavaFrame->frame(env);
+ if (!obj.get())
+ return;
WebCore::String urlString(url.string());
// If this is the main frame and we already have a favicon in the database,
// send it along with the page started notification.
}
jstring urlStr = env->NewString((unsigned short*)urlString.characters(), urlString.length());
- env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mLoadStarted, urlStr, favicon,
+ env->CallVoidMethod(obj.get(), mJavaFrame->mLoadStarted, urlStr, favicon,
(int)loadType, isMainFrame);
checkException(env);
env->DeleteLocalRef(urlStr);
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = mJavaFrame->frame(env);
+ if (!obj.get())
+ return;
WebCore::FrameLoadType loadType = frame->loader()->loadType();
bool isMainFrame = (!frame->tree() || !frame->tree()->parent());
- env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mTransitionToCommitted,
+ env->CallVoidMethod(obj.get(), mJavaFrame->mTransitionToCommitted,
(int)loadType, isMainFrame);
checkException(env);
}
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = mJavaFrame->frame(env);
+ if (!obj.get())
+ return;
WebCore::FrameLoader* loader = frame->loader();
const WebCore::KURL& url = loader->activeDocumentLoader()->url();
if (url.isEmpty())
WebCore::FrameLoadType loadType = loader->loadType();
WebCore::String urlString(url.string());
jstring urlStr = env->NewString((unsigned short*)urlString.characters(), urlString.length());
- env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mLoadFinished, urlStr,
+ env->CallVoidMethod(obj.get(), mJavaFrame->mLoadFinished, urlStr,
(int)loadType, isMainFrame);
checkException(env);
env->DeleteLocalRef(urlStr);
LOGV("setTitle(%s)", title.ascii().data());
#endif
JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = mJavaFrame->frame(env);
+ if (!obj.get())
+ return;
jstring jTitleStr = env->NewString((unsigned short *)title.characters(), title.length());
- env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mSetTitle,
+ env->CallVoidMethod(obj.get(), mJavaFrame->mSetTitle,
jTitleStr);
checkException(env);
env->DeleteLocalRef(jTitleStr);
#endif
LOGV("::WebCore:: windowObjectCleared");
JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = mJavaFrame->frame(env);
+ if (!obj.get())
+ return;
- env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mWindowObjectCleared, (int)frame);
+ env->CallVoidMethod(obj.get(), mJavaFrame->mWindowObjectCleared, (int)frame);
checkException(env);
}
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = mJavaFrame->frame(env);
+ if (!obj.get())
+ return;
int progress = (int) (100 * newProgress);
- env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mSetProgress, progress);
+ env->CallVoidMethod(obj.get(), mJavaFrame->mSetProgress, progress);
checkException(env);
}
#endif
LOG_ASSERT(icon, "DidReceiveIcon called without an image!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = mJavaFrame->frame(env);
+ if (!obj.get())
+ return;
jobject bitmap = webcoreImageToJavaBitmap(env, icon);
if (!bitmap)
return;
- env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mDidReceiveIcon, bitmap);
+ env->CallVoidMethod(obj.get(), mJavaFrame->mDidReceiveIcon, bitmap);
env->DeleteLocalRef(bitmap);
checkException(env);
}
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = mJavaFrame->frame(env);
+ if (!obj.get())
+ return;
jstring jUrlStr = env->NewString((unsigned short*)url.characters(),
url.length());
- env->CallVoidMethod(mJavaFrame->frame(env).get(),
+ env->CallVoidMethod(obj.get(),
mJavaFrame->mDidReceiveTouchIconUrl, jUrlStr, precomposed);
checkException(env);
}
#endif
WebCore::String urlStr(url.string());
JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = mJavaFrame->frame(env);
+ if (!obj.get())
+ return;
+
jstring jUrlStr = env->NewString((unsigned short*)urlStr.characters(), urlStr.length());
- env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mUpdateVisitedHistory, jUrlStr, reload);
+ env->CallVoidMethod(obj.get(), mJavaFrame->mUpdateVisitedHistory, jUrlStr, reload);
checkException(env);
}
if (url.isEmpty())
return true;
JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = mJavaFrame->frame(env);
+ if (!obj.get())
+ return true;
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
// check to see whether browser app wants to hijack url loading.
// if browser app handles the url, we will return false to bail out WebCore loading
- jboolean ret = env->CallBooleanMethod(mJavaFrame->frame(env).get(), mJavaFrame->mHandleUrl, jUrlStr);
+ jboolean ret = env->CallBooleanMethod(obj.get(), mJavaFrame->mHandleUrl, jUrlStr);
checkException(env);
return (ret == 0);
}
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = JSC::Bindings::getJNIEnv();
- jobject obj = env->CallObjectMethod(mJavaFrame->frame(env).get(),
+ AutoJObject obj = mJavaFrame->frame(env);
+ if (!obj.get())
+ return NULL;
+ jobject jobj = env->CallObjectMethod(obj.get(),
mJavaFrame->mCreateWindow, dialog, userGesture);
- if (obj) {
- WebCore::Frame* frame = GET_NATIVE_FRAME(env, obj);
+ if (jobj) {
+ WebCore::Frame* frame = GET_NATIVE_FRAME(env, jobj);
return frame;
}
return NULL;
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mRequestFocus);
+ AutoJObject obj = mJavaFrame->frame(env);
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(), mJavaFrame->mRequestFocus);
checkException(env);
}
#endif
assert(webViewCore);
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mCloseWindow,
+ AutoJObject obj = mJavaFrame->frame(env);
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(), mJavaFrame->mCloseWindow,
webViewCore->getJavaObject().get());
}
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = mJavaFrame->frame(env);
+ if (!obj.get())
+ return;
PolicyFunctionWrapper* p = new PolicyFunctionWrapper;
p->func = func;
- env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mDecidePolicyForFormResubmission, p);
+ env->CallVoidMethod(obj.get(), mJavaFrame->mDecidePolicyForFormResubmission, p);
}
WebCore::String
WebFrame::getRawResourceFilename(RAW_RES_ID id) const
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- jstring ret = (jstring) env->CallObjectMethod(mJavaFrame->frame(env).get(),
+ AutoJObject obj = mJavaFrame->frame(env);
+ if (!obj.get())
+ return WebCore::String();
+ jstring ret = (jstring) env->CallObjectMethod(obj.get(),
mJavaFrame->mGetRawResFilename, (int)id);
return to_string(env, ret);
WebFrame::density() const
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- jfloat dpi = env->CallFloatMethod(mJavaFrame->frame(env).get(), mJavaFrame->mDensity);
+ AutoJObject obj = mJavaFrame->frame(env);
+ if (!obj.get())
+ return 1.0;
+ jfloat dpi = env->CallFloatMethod(obj.get(), mJavaFrame->mDensity);
checkException(env);
return dpi;
}
// LOGD("WebViewCore::scrollTo(%d %d)\n", x, y);
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue->object(env).get(), animate ? m_javaGlue->m_spawnScrollTo : m_javaGlue->m_scrollTo, x, y);
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(), animate ? m_javaGlue->m_spawnScrollTo : m_javaGlue->m_scrollTo, x, y);
checkException(env);
}
{
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_sendNotifyProgressFinished);
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(), m_javaGlue->m_sendNotifyProgressFinished);
checkException(env);
}
{
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue->object(env).get(),
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(),
m_javaGlue->m_sendViewInvalidate,
rect.x(), rect.y(), rect.right(), rect.bottom());
checkException(env);
if (!(dx | dy))
return;
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_scrollBy,
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(), m_javaGlue->m_scrollBy,
dx, dy, animate);
checkException(env);
}
void WebViewCore::contentDraw()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_contentDraw);
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(), m_javaGlue->m_contentDraw);
checkException(env);
}
WebCore::FrameLoadType loadType = loader->loadType();
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_didFirstLayout,
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(), m_javaGlue->m_didFirstLayout,
loadType == WebCore::FrameLoadTypeStandard
// When redirect with locked history, we would like to reset the
// scale factor. This is important for www.yahoo.com as it is
// redirected to www.yahoo.com/?rs=1 on load.
|| loadType == WebCore::FrameLoadTypeRedirectWithLockedBackForwardList);
checkException(env);
-
DBG_NAV_LOG("call updateFrameCache");
m_check_domtree_version = false;
updateFrameCache();
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_updateViewport);
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(), m_javaGlue->m_updateViewport);
checkException(env);
}
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_restoreScale, scale);
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(), m_javaGlue->m_restoreScale, scale);
checkException(env);
}
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_restoreScreenWidthScale, scale);
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(), m_javaGlue->m_restoreScreenWidthScale, scale);
checkException(env);
}
AutoJObject obj = m_javaGlue->object(env);
// if it is called during DESTROY is handled, the real object of WebViewCore
// can be gone. Check before using it.
- if (env && obj.get()) {
- env->CallVoidMethod(obj.get(), m_javaGlue->m_needTouchEvents, need);
- checkException(env);
- }
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(), m_javaGlue->m_needTouchEvents, need);
+ checkException(env);
#endif
}
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_requestKeyboard, showKeyboard);
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(), m_javaGlue->m_requestKeyboard, showKeyboard);
checkException(env);
}
// Create an array of java Strings for the drop down.
JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return;
jobjectArray labelArray = makeLabelArray(env, labels, count);
// Create an array determining whether each item is enabled.
}
env->ReleaseIntArrayElements(selectedArray, selArray, 0);
- env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_requestListBox, labelArray, enabledArray, selectedArray);
+ env->CallVoidMethod(obj.get(), m_javaGlue->m_requestListBox, labelArray, enabledArray, selectedArray);
env->DeleteLocalRef(selectedArray);
} else {
// Pass up the single selection.
- env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_requestSingleListBox, labelArray, enabledArray, selectedCountOrSelection);
+ env->CallVoidMethod(obj.get(), m_javaGlue->m_requestSingleListBox, labelArray, enabledArray, selectedCountOrSelection);
}
env->DeleteLocalRef(labelArray);
void WebViewCore::addMessageToConsole(const WebCore::String& message, unsigned int lineNumber, const WebCore::String& sourceID) {
JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return;
jstring jMessageStr = env->NewString((unsigned short *)message.characters(), message.length());
jstring jSourceIDStr = env->NewString((unsigned short *)sourceID.characters(), sourceID.length());
- env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_addMessageToConsole, jMessageStr, lineNumber, jSourceIDStr);
+ env->CallVoidMethod(obj.get(), m_javaGlue->m_addMessageToConsole, jMessageStr, lineNumber, jSourceIDStr);
env->DeleteLocalRef(jMessageStr);
env->DeleteLocalRef(jSourceIDStr);
checkException(env);
void WebViewCore::jsAlert(const WebCore::String& url, const WebCore::String& text)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return;
jstring jInputStr = env->NewString((unsigned short *)text.characters(), text.length());
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
- env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_jsAlert, jUrlStr, jInputStr);
+ env->CallVoidMethod(obj.get(), m_javaGlue->m_jsAlert, jUrlStr, jInputStr);
env->DeleteLocalRef(jInputStr);
env->DeleteLocalRef(jUrlStr);
checkException(env);
{
#if ENABLE(DATABASE)
JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return;
jstring jDatabaseIdentifierStr = env->NewString((unsigned short *)databaseIdentifier.characters(), databaseIdentifier.length());
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
- env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_exceededDatabaseQuota, jUrlStr, jDatabaseIdentifierStr, currentQuota, estimatedSize);
+ env->CallVoidMethod(obj.get(), m_javaGlue->m_exceededDatabaseQuota, jUrlStr, jDatabaseIdentifierStr, currentQuota, estimatedSize);
env->DeleteLocalRef(jDatabaseIdentifierStr);
env->DeleteLocalRef(jUrlStr);
checkException(env);
{
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_reachedMaxAppCacheSize, spaceNeeded);
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(), m_javaGlue->m_reachedMaxAppCacheSize, spaceNeeded);
checkException(env);
#endif
}
{
m_groupForVisitedLinks = group;
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_populateVisitedLinks);
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(), m_javaGlue->m_populateVisitedLinks);
checkException(env);
}
void WebViewCore::geolocationPermissionsShowPrompt(const WebCore::String& origin)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return;
jstring originString = env->NewString((unsigned short *)origin.characters(), origin.length());
- env->CallVoidMethod(m_javaGlue->object(env).get(),
+ env->CallVoidMethod(obj.get(),
m_javaGlue->m_geolocationPermissionsShowPrompt,
originString);
env->DeleteLocalRef(originString);
void WebViewCore::geolocationPermissionsHidePrompt()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue->object(env).get(),
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(),
m_javaGlue->m_geolocationPermissionsHidePrompt);
checkException(env);
}
bool WebViewCore::jsConfirm(const WebCore::String& url, const WebCore::String& text)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return false;
jstring jInputStr = env->NewString((unsigned short *)text.characters(), text.length());
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
- jboolean result = env->CallBooleanMethod(m_javaGlue->object(env).get(), m_javaGlue->m_jsConfirm, jUrlStr, jInputStr);
+ jboolean result = env->CallBooleanMethod(obj.get(), m_javaGlue->m_jsConfirm, jUrlStr, jInputStr);
env->DeleteLocalRef(jInputStr);
env->DeleteLocalRef(jUrlStr);
checkException(env);
bool WebViewCore::jsPrompt(const WebCore::String& url, const WebCore::String& text, const WebCore::String& defaultValue, WebCore::String& result)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return false;
+
jstring jInputStr = env->NewString((unsigned short *)text.characters(), text.length());
jstring jDefaultStr = env->NewString((unsigned short *)defaultValue.characters(), defaultValue.length());
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
- jstring returnVal = (jstring) env->CallObjectMethod(m_javaGlue->object(env).get(), m_javaGlue->m_jsPrompt, jUrlStr, jInputStr, jDefaultStr);
+ jstring returnVal = (jstring) env->CallObjectMethod(obj.get(), m_javaGlue->m_jsPrompt, jUrlStr, jInputStr, jDefaultStr);
// If returnVal is null, it means that the user cancelled the dialog.
if (!returnVal)
return false;
bool WebViewCore::jsUnload(const WebCore::String& url, const WebCore::String& message)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return false;
jstring jInputStr = env->NewString((unsigned short *)message.characters(), message.length());
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
- jboolean result = env->CallBooleanMethod(m_javaGlue->object(env).get(), m_javaGlue->m_jsUnload, jUrlStr, jInputStr);
+ jboolean result = env->CallBooleanMethod(obj.get(), m_javaGlue->m_jsUnload, jUrlStr, jInputStr);
env->DeleteLocalRef(jInputStr);
env->DeleteLocalRef(jUrlStr);
checkException(env);
bool WebViewCore::jsInterrupt()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- jboolean result = env->CallBooleanMethod(m_javaGlue->object(env).get(), m_javaGlue->m_jsInterrupt);
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return true; // default to interrupt
+ jboolean result = env->CallBooleanMethod(obj.get(), m_javaGlue->m_jsInterrupt);
checkException(env);
return result;
}
WebViewCore::getWebViewJavaObject()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- return env->GetObjectField(m_javaGlue->object(env).get(), gWebViewCoreFields.m_webView);
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return 0;
+ return env->GetObjectField(obj.get(), gWebViewCoreFields.m_webView);
}
void WebViewCore::updateTextSelection() {
return;
RenderTextControl* rtc = static_cast<RenderTextControl*>(renderer);
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue->object(env).get(),
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(),
m_javaGlue->m_updateTextSelection, reinterpret_cast<int>(focusNode),
rtc->selectionStart(), rtc->selectionEnd(), m_textGeneration);
checkException(env);
if (m_blockTextfieldUpdates)
return;
JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return;
+
if (changeToPassword) {
- env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_updateTextfield,
+ env->CallVoidMethod(obj.get(), m_javaGlue->m_updateTextfield,
(int) ptr, true, 0, m_textGeneration);
checkException(env);
return;
}
int length = text.length();
jstring string = env->NewString((unsigned short *) text.characters(), length);
- env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_updateTextfield,
+ env->CallVoidMethod(obj.get(), m_javaGlue->m_updateTextfield,
(int) ptr, false, string, m_textGeneration);
env->DeleteLocalRef(string);
checkException(env);
void WebViewCore::clearTextEntry()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue->object(env).get(),
- m_javaGlue->m_clearTextEntry);
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return;
+
+ env->CallVoidMethod(obj.get(), m_javaGlue->m_clearTextEntry);
}
void WebViewCore::setBackgroundColor(SkColor c)
JNIEnv* env = JSC::Bindings::getJNIEnv();
jstring libString = env->NewStringUTF(libName);
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return;
+
jstring classString = env->NewStringUTF(className);
- env->CallVoidMethod(m_javaGlue->object(env).get(),
+ env->CallVoidMethod(obj.get(),
m_javaGlue->m_startFullScreenPluginActivity,
libString, classString, (int) npp);
checkException(env);
NPP npp, int x, int y, int width, int height)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return 0;
jstring libString = env->NewStringUTF(libName);
jstring classString = env->NewStringUTF(className);
- jobject result = env->CallObjectMethod(m_javaGlue->object(env).get(),
+ jobject result = env->CallObjectMethod(obj.get(),
m_javaGlue->m_createSurface, libString,
classString,(int) npp, x, y, width, height);
checkException(env);
void WebViewCore::destroySurface(jobject childView)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_destroySurface, childView);
+ AutoJObject obj = m_javaGlue->object(env);
+ // if it is called during DESTROY is handled, the real object of WebViewCore
+ // can be gone. Check before using it.
+ if (!obj.get())
+ return;
+
+ env->CallVoidMethod(obj.get(), m_javaGlue->m_destroySurface, childView);
checkException(env);
}
{
DEBUG_NAV_UI_LOGD("%s", __FUNCTION__);
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_clearTextEntry);
+ AutoJObject obj = m_javaGlue.object(env);
+ // if it is called during or after DESTROY is handled, the real object of
+ // WebView can be gone. Check before using it.
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(), m_javaGlue.m_clearTextEntry);
checkException(env);
}
{
LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- int result = env->CallIntMethod(m_javaGlue.object(env).get(), m_javaGlue.m_getScaledMaxXScroll);
+ AutoJObject obj = m_javaGlue.object(env);
+ // if it is called during or after DESTROY is handled, the real object of
+ // WebView can be gone. Check before using it.
+ if (!obj.get())
+ return 0;
+ int result = env->CallIntMethod(obj.get(), m_javaGlue.m_getScaledMaxXScroll);
checkException(env);
return result;
}
{
LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- int result = env->CallIntMethod(m_javaGlue.object(env).get(), m_javaGlue.m_getScaledMaxYScroll);
+ AutoJObject obj = m_javaGlue.object(env);
+ // if it is called during or after DESTROY is handled, the real object of
+ // WebView can be gone. Check before using it.
+ if (!obj.get())
+ return 0;
+ int result = env->CallIntMethod(obj.get(), m_javaGlue.m_getScaledMaxYScroll);
checkException(env);
return result;
}
{
LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- jobject jRect = env->CallObjectMethod(m_javaGlue.object(env).get(), m_javaGlue.m_getVisibleRect);
+ AutoJObject obj = m_javaGlue.object(env);
+ // if it is called during or after DESTROY is handled, the real object of
+ // WebView can be gone. Check before using it.
+ if (!obj.get())
+ return;
+ jobject jRect = env->CallObjectMethod(obj.get(), m_javaGlue.m_getVisibleRect);
checkException(env);
int left = (int) env->GetIntField(jRect, m_javaGlue.m_rectLeft);
checkException(env);
void overrideUrlLoading(const WebCore::String& url)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = m_javaGlue.object(env);
+ // if it is called during or after DESTROY is handled, the real object of
+ // WebView can be gone. Check before using it.
+ if (!obj.get())
+ return;
jstring jName = env->NewString((jchar*) url.characters(), url.length());
- env->CallVoidMethod(m_javaGlue.object(env).get(),
- m_javaGlue.m_overrideLoading, jName);
+ env->CallVoidMethod(obj.get(), m_javaGlue.m_overrideLoading, jName);
env->DeleteLocalRef(jName);
}
//send message to plugin in webkit
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue.object(env).get(),
- m_javaGlue.m_sendPluginState,
+ AutoJObject obj = m_javaGlue.object(env);
+ // if it is called during or after DESTROY is handled, the real object of
+ // WebView can be gone. Check before using it.
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(), m_javaGlue.m_sendPluginState,
value ? kGainFocus_PluginState : kLoseFocus_PluginState);
checkException(env);
-
m_pluginReceivesEvents = value;
}
{
DBG_NAV_LOGD("framePtr=%p nodePtr=%p x=%d y=%d", framePtr, nodePtr, x, y);
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_sendMoveMouse,
+ AutoJObject obj = m_javaGlue.object(env);
+ // if it is called during or after DESTROY is handled, the real object of
+ // WebView can be gone. Check before using it.
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(), m_javaGlue.m_sendMoveMouse,
(jint) framePtr, (jint) nodePtr, x, y);
checkException(env);
}
{
LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue.object(env).get(),
- m_javaGlue.m_sendMoveMouseIfLatest, disableFocusController);
+ AutoJObject obj = m_javaGlue.object(env);
+ // if it is called during or after DESTROY is handled, the real object of
+ // WebView can be gone. Check before using it.
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(), m_javaGlue.m_sendMoveMouseIfLatest, disableFocusController);
checkException(env);
}
m_generation, framePtr, nodePtr, x, y);
LOG_ASSERT(m_javaGlue.m_obj, "A WebView was not associated with this WebViewNative!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_sendMotionUp,
+ AutoJObject obj = m_javaGlue.object(env);
+ // if it is called during or after DESTROY is handled, the real object of
+ // WebView can be gone. Check before using it.
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(), m_javaGlue.m_sendMotionUp,
m_generation, (jint) framePtr, (jint) nodePtr, x, y);
checkException(env);
}
LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- bool result = env->CallBooleanMethod(m_javaGlue.object(env).get(),
+ AutoJObject obj = m_javaGlue.object(env);
+ // if it is called during or after DESTROY is handled, the real object of
+ // WebView can be gone. Check before using it.
+ if (!obj.get())
+ return false;
+ bool result = env->CallBooleanMethod(obj.get(),
m_javaGlue.m_scrollBy, dx, dy, true);
checkException(env);
return result;
void rebuildWebTextView()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue.object(env).get(),
- m_javaGlue.m_rebuildWebTextView);
+ AutoJObject obj = m_javaGlue.object(env);
+ // if it is called during or after DESTROY is handled, the real object of
+ // WebView can be gone. Check before using it.
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(), m_javaGlue.m_rebuildWebTextView);
checkException(env);
}
void displaySoftKeyboard(bool isTextView)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue.object(env).get(),
+ AutoJObject obj = m_javaGlue.object(env);
+ // if it is called during or after DESTROY is handled, the real object of
+ // WebView can be gone. Check before using it.
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(),
m_javaGlue.m_displaySoftKeyboard, isTextView);
checkException(env);
}
void viewInvalidate()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_viewInvalidate);
+ AutoJObject obj = m_javaGlue.object(env);
+ // if it is called during or after DESTROY is handled, the real object of
+ // WebView can be gone. Check before using it.
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(), m_javaGlue.m_viewInvalidate);
checkException(env);
}
void viewInvalidateRect(int l, int t, int r, int b)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_viewInvalidateRect, l, r, t, b);
+ AutoJObject obj = m_javaGlue.object(env);
+ // if it is called during or after DESTROY is handled, the real object of
+ // WebView can be gone. Check before using it.
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(), m_javaGlue.m_viewInvalidateRect, l, r, t, b);
checkException(env);
}
void postInvalidateDelayed(int64_t delay, const WebCore::IntRect& bounds)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_postInvalidateDelayed,
- delay, bounds.x(), bounds.y(), bounds.right(), bounds.bottom());
+ AutoJObject obj = m_javaGlue.object(env);
+ // if it is called during or after DESTROY is handled, the real object of
+ // WebView can be gone. Check before using it.
+ if (!obj.get())
+ return;
+ env->CallVoidMethod(obj.get(), m_javaGlue.m_postInvalidateDelayed,
+ delay, bounds.x(), bounds.y(), bounds.right(), bounds.bottom());
checkException(env);
}