Bug 846881 - Add NULL checks to PuppetWidget; r=bz

This commit is contained in:
Eddy Bruel 2013-04-02 20:32:59 +02:00
parent 8f87337324
commit 089b93e329

View File

@ -122,7 +122,9 @@ PuppetWidget::InitIMEState()
{
if (mNeedIMEStateInit) {
uint32_t chromeSeqno;
mTabChild->SendNotifyIMEFocus(false, &mIMEPreference, &chromeSeqno);
if (mTabChild) {
mTabChild->SendNotifyIMEFocus(false, &mIMEPreference, &chromeSeqno);
}
mIMELastBlurSeqno = mIMELastReceivedSeqno = chromeSeqno;
mNeedIMEStateInit = false;
}
@ -535,8 +537,7 @@ PuppetWidget::SetCursor(nsCursor aCursor)
return NS_OK;
}
if (!mTabChild ||
!mTabChild->SendSetCursor(aCursor)) {
if (mTabChild && !mTabChild->SendSetCursor(aCursor)) {
return NS_ERROR_FAILURE;
}
@ -576,7 +577,9 @@ PuppetWidget::Paint()
AutoLayerManagerSetup setupLayerManager(this, ctx,
BUFFER_NONE);
mAttachedWidgetListener->PaintWindow(this, region, 0);
mTabChild->NotifyPainted();
if (mTabChild) {
mTabChild->NotifyPainted();
}
}
}
@ -616,8 +619,11 @@ float
PuppetWidget::GetDPI()
{
if (mDPI < 0) {
NS_ABORT_IF_FALSE(mTabChild, "Need TabChild to get the DPI from!");
mTabChild->GetDPI(&mDPI);
if (mTabChild) {
mTabChild->GetDPI(&mDPI);
} else {
mDPI = 96.0;
}
}
return mDPI;
@ -630,7 +636,9 @@ PuppetWidget::GetNativeData(uint32_t aDataType)
case NS_NATIVE_SHAREABLE_WINDOW: {
NS_ABORT_IF_FALSE(mTabChild, "Need TabChild to get the nativeWindow from!");
mozilla::WindowsHandle nativeData = 0;
mTabChild->SendGetWidgetNativeData(&nativeData);
if (mTabChild) {
mTabChild->SendGetWidgetNativeData(&nativeData);
}
return (void*)nativeData;
}
case NS_NATIVE_WINDOW: