rv = aURL->GetLoadAttribs(&loadAttributes); if (NS_SUCCEEDED(rv)) { rv = loadAttributes->GetLoadType(&loadType); if (NS_FAILED(rv)) { loadType = nsURLLoadNormal; } NS_RELEASE(loadAttributes); } if (nsURLLoadBackground != loadType) { mForegroundURLs -= 1; bIsForegroundURL = PR_TRUE; } mTotalURLs -= 1;
nsresult rv = aURL->GetLoadAttribs(&loadAttributes); if (NS_SUCCEEDED(rv) && loadAttributes) { rv = loadAttributes->GetLoadType(&loadType); if (NS_FAILED(rv)) { loadType = nsURLLoadNormal; } NS_RELEASE(loadAttributes); } if (nsURLLoadBackground != loadType) { mForegroundURLs--; isForegroundURL = PR_TRUE; } mTotalURLs -= 1;
void nsDocLoaderImpl::LoadURLComplete(nsIURL* aURL, nsISupports* aBindInfo, PRInt32 aStatus){  PRBool rv;  PRBool bIsForegroundURL = PR_FALSE;  PRBool bIsBusy = PR_TRUE;  /*   * If the entry is not found in the list, then it must have been cancelled   * via Stop(...). So ignore just it...    */  rv = m_LoadingDocsList->RemoveElement(aBindInfo);  if (PR_FALSE != rv) {    nsILoadAttribs* loadAttributes;    nsURLLoadType loadType = nsURLLoadNormal;    rv = aURL->GetLoadAttribs(&loadAttributes);    if (NS_SUCCEEDED(rv)) {      rv = loadAttributes->GetLoadType(&loadType);      if (NS_FAILED(rv)) {        loadType = nsURLLoadNormal;      }      NS_RELEASE(loadAttributes);    }    if (nsURLLoadBackground != loadType) {      mForegroundURLs -= 1;      bIsForegroundURL = PR_TRUE;    }    mTotalURLs -= 1;    NS_ASSERTION((mTotalURLs >= mForegroundURLs), "Foreground URL count is wrong.");#if defined(DEBUG)  const char* buffer;  aURL->GetSpec(&buffer);    PR_LOG(gDocLoaderLog, PR_LOG_DEBUG,            ("DocLoader - LoadURLComplete(...) called for %s.\nForeground URLs: %d\nTotal URLs: %d\n",             buffer, mForegroundURLs, mTotalURLs));#endif /* DEBUG */  }  /*   * Fire the OnEndURLLoad notification to any observers...   */   FireOnEndURLLoad(aURL, aStatus);  /*   * Fire the OnEndDocumentLoad notification to any observers...   */   IsBusy(bIsBusy);  if (bIsForegroundURL && !bIsBusy) {#if defined(DEBUG)    const char* buffer;    mDocumentUrl->GetSpec(&buffer);    PR_LOG(gDocLoaderLog, PR_LOG_DEBUG,           ("DocLoader - OnEndDocumentLoad(...) called for %s.\n", buffer));#endif /* DEBUG */    FireOnEndDocumentLoad(aStatus);  }}