if (aResult) { *aResult = nsnull; } return NS_OK;
if (!aURL.EqualsWithConversion("chrome:", PR_TRUE, 7) || mStopChrome) { if (aResult) { *aResult = nsnull; } return NS_OK; }
nsPresContext::StartLoadImage(const nsString& aURL,                              const nscolor* aBackgroundColor,                              const nsSize* aDesiredSize,                              nsIFrame* aTargetFrame,                              nsIFrameImageLoaderCB aCallBack,                              void* aClosure,                              nsIFrameImageLoader** aResult){  if (mStopped) {    if (aResult) {      *aResult = nsnull;    }    return NS_OK;  }  // Allow for a null target frame argument (for precached images)  if (nsnull != aTargetFrame) {    // Mark frame as having loaded an image    nsFrameState state;    aTargetFrame->GetFrameState(&state);    state |= NS_FRAME_HAS_LOADED_IMAGES;    aTargetFrame->SetFrameState(state);  }  // Lookup image request in our loaders array (maybe the load request  // has already been made for that url at the desired size).  PRInt32 i, n = mImageLoaders.Count();  nsIFrameImageLoader* loader;  for (i = 0; i < n; i++) {    PRBool same;    loader = (nsIFrameImageLoader*) mImageLoaders.ElementAt(i);    loader->IsSameImageRequest(aURL, aBackgroundColor, aDesiredSize, &same);    if (same) {      // This is pretty sick, but because we can get a notification      // *before* the caller has returned we have to store into      // aResult before calling the AddFrame method.      if (aResult) {        NS_ADDREF(loader);        *aResult = loader;      }      // Add frame to list of interested frames for this loader      loader->AddFrame(aTargetFrame, aCallBack, aClosure);      return NS_OK;    }  }  // Create image group if needed  nsresult rv;  if (!mImageGroup) {    nsCOMPtr<nsIImageGroup> group;    rv = GetImageGroup(getter_AddRefs(group));   // sets mImageGroup as side effect    if (NS_OK != rv) {      return rv;    }  }  // We haven't seen that image before. Create a new loader and  // start it going.  rv = NS_NewFrameImageLoader(&loader);  if (NS_OK != rv) {    return rv;  }  mImageLoaders.AppendElement(loader);  // This is pretty sick, but because we can get a notification  // *before* the caller has returned we have to store into aResult  // before calling the loaders init method.  if (aResult) {    *aResult = loader;    NS_ADDREF(loader);  }  rv = loader->Init(this, mImageGroup, aURL, aBackgroundColor, aDesiredSize,                    aTargetFrame, aCallBack, aClosure);  if (NS_OK != rv) {    mImageLoaders.RemoveElement(loader);    loader->StopImageLoad();    NS_RELEASE(loader);    // Undo premature store of reslut    if (aResult) {      *aResult = nsnull;      NS_RELEASE(loader);    }    return rv;  }  return NS_OK;}