if (ic->url) ic->expires = ic->url->GetExpires();
IL_StreamFirstWrite(il_container *ic, const unsigned char *str, int32 len){  nsresult rv = NS_OK;    PR_ASSERT(ic);    PR_ASSERT(ic->image);        /* If URL redirection occurs, the url stored in the    image container is the redirect url not the image file url.    If the image is animated, the imglib will never match the    file name in the cache unless you update ic->url_address.    ic->fetch_url keeps the actual url for you.     */ 	/* ic->fetch_url is being set in NetReaderImpl::FirstWrite(..). 	   This is just a backup code to set ic->fetch_url, in the case 	   we do not set ic->fetch_url in NetReaderImpl::FirstWrite(..).*///    FREE_IF_NOT_NULL(ic->fetch_url);	if (!ic->fetch_url) {		if (ic->url) {			ic->fetch_url = ic->url->GetAddress();		}		else {			if(ic->url_address) // check needed because of mkicons.c					ic->fetch_url = PL_strdup(ic->url_address);			else				ic->fetch_url = NULL;		}	}    /* Grab the URL's expiration date */  if (ic->url)      ic->expires = ic->url->GetExpires();  /* if our mime sniffer can recognize what's in the    data stream and it is one of our std vanilla types.    Check to see if it matches the mimetype sent by creator.  */  char contenttype[50];  if(sniffout_mimetype((const char*) str, len, contenttype)){      // data type understood by mime sniffer        if(nsCRT::strcmp(contenttype, ic->type) != 0){            //what the sniff saw and what the mime header said is            //different. We'll believe the data from the sniffer            nsCRT::free(ic->type);            ic->type = nsCRT::strdup(contenttype);        }  }  nsIImgDecoder *imgdec ;     char imgtypestr[200];  PR_snprintf(imgtypestr, sizeof(imgtypestr), "component://netscape/image/decoder&type=%s"            , ic->type );    static NS_DEFINE_IID(kIImgDecoderIID, NS_IIMGDECODER_IID);  rv = nsComponentManager::CreateInstance(imgtypestr, NULL,                                              kIImgDecoderIID,                                           (void **)&imgdec);  /* we did our best. Gotta give up. */  if (NS_FAILED(rv)){      return MK_IMAGE_LOSSAGE;   }    imgdec->SetContainer(ic);      // We will already have a decoder instance for this      //  image container if the image is animated. For now,      //  we release it before taking the new one.       //  Later I'll see how animated image containers can      //   reuse the decoder for subsequent frames.  if(ic->imgdec)      NS_RELEASE(ic->imgdec);  ic->imgdec = imgdec;    rv = imgdec->ImgDInit();  if(NS_FAILED(rv)){    NS_RELEASE(ic->imgdec);    ic->imgdec = nsnull;     ILTRACE(0,("il: image init failed"));    return MK_OUT_OF_MEMORY;  }            return 0; //ok}