NS_IMETHODIMP
nsBrowserStatusFilter::OnProgressChange(nsIWebProgress *aWebProgress,
                                        nsIRequest *aRequest,
                                        PRInt32 aCurSelfProgress,
                                        PRInt32 aMaxSelfProgress,
                                        PRInt32 aCurTotalProgress,
                                        PRInt32 aMaxTotalProgress)
{
    if (!mListener)
        return NS_OK;

    if (!mUseRealProgressFlag && aRequest)
        return NS_OK;

    //
    // limit frequency of calls to OnProgressChange
    //

    mCurProgress = (PRInt64)aCurTotalProgress;
    mMaxProgress = (PRInt64)aMaxTotalProgress;

    if (mDelayedProgress)
        return NS_OK;

    if (!mDelayedStatus) {
        MaybeSendProgress();
        StartDelayTimer();
    }

    mDelayedProgress = PR_TRUE;

    return NS_OK;
}
void
nsBrowserStatusFilter::ProcessTimeout()
{
    mTimer = nsnull;

    if (!mListener)
        return;

    if (mDelayedStatus) {
        mDelayedStatus = PR_FALSE;
        MaybeSendStatus();
    }

    if (mDelayedProgress) {
        mDelayedProgress = PR_FALSE;
        MaybeSendProgress();
    }
}
void
nsBrowserStatusFilter::ProcessTimeout()
{
    mTimer = nullptr;

    if (!mListener)
        return;

    if (mDelayedStatus) {
        mDelayedStatus = false;
        MaybeSendStatus();
    }

    if (mDelayedProgress) {
        mDelayedProgress = false;
        MaybeSendProgress();
    }
}