Bug 1127066 - Complain loudly if APZEventState is used with a widget that doesn't support weak references. r=kats

--HG--
extra : source : e4337bd21059a0ecbffa5d0d567dd9a8f0a3bcd1
This commit is contained in:
Botond Ballo 2015-02-09 14:10:08 -05:00
Родитель c83b7760e1
Коммит 933c29e8b5
1 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -25,7 +25,7 @@ static bool sActiveDurationMsSet = false;
APZEventState::APZEventState(nsIWidget* aWidget,
const nsRefPtr<ContentReceivedInputBlockCallback>& aCallback)
: mWidget(do_GetWeakReference(aWidget))
: mWidget(nullptr) // initialized in constructor body
, mActiveElementManager(new ActiveElementManager())
, mContentReceivedInputBlockCallback(aCallback)
, mPendingTouchPreventedResponse(false)
@ -33,6 +33,11 @@ APZEventState::APZEventState(nsIWidget* aWidget,
, mEndTouchIsClick(false)
, mTouchEndCancelled(false)
{
nsresult rv;
mWidget = do_GetWeakReference(aWidget, &rv);
MOZ_ASSERT(NS_SUCCEEDED(rv), "APZEventState constructed with a widget that"
" does not support weak references. APZ will NOT work!");
if (!sActiveDurationMsSet) {
Preferences::AddIntVarCache(&sActiveDurationMs,
"ui.touch_activation.duration_ms",