rv = bundle->FormatStringFromName(key.get(), formatStrings, 2, getter_Copies(valUni));
rv = bundle->FormatStringFromName(NS_LITERAL_STRING("ImageTitleWithDimensions").get(), formatStrings, 2, getter_Copies(valUni)); } else { rv = bundle->GetStringFromName(NS_LITERAL_STRING("ImageTitleWithoutDimensionsAndFile").get(), getter_Copies(valUni));
nsresult nsImageDocument::UpdateTitle( void ){#ifdef USE_EXTENSION_FOR_TYPE  // XXX TEMPORARY XXX  // We want to display the image type, however there is no way to right now  // so instead we just get the image-extension  //  - get the URL interface, get the extension, convert to upper-case  //  Unless the Imagerequest or Image can tell us the type this is the best we can do.  nsIURL *pURL=nsnull;  if(NS_SUCCEEDED(mDocumentURL->QueryInterface(NS_GET_IID(nsIURL),(void **)&pURL))){    char *pExtension=nsnull;    pURL->GetFileExtension(&pExtension);    if(pExtension){      nsString strExt; strExt.AssignWithConversion(pExtension);      ToUpperCase(strExt);      titleStr.Append(strExt);      nsCRT::free(pExtension);      pExtension=nsnull;    }    NS_IF_RELEASE(pURL);  }#endif   nsCOMPtr<nsIStringBundle> bundle;  nsresult rv;   // Create a bundle for the localization  nsCOMPtr<nsIStringBundleService> stringService =            do_GetService(kStringBundleServiceCID, &rv);  if (NS_SUCCEEDED(rv) && stringService) {    rv = stringService->CreateBundle(NSIMAGEDOCUMENT_PROPERTIES_URI, getter_AddRefs(bundle));  }  if (NS_SUCCEEDED(rv) && bundle) {    nsAutoString key;    nsXPIDLString valUni;    if (mImageRequest) {      PRUint32 width, height;#ifdef USE_IMG2      imgIContainer* imgContainer;      rv = mImageRequest->GetImage(&imgContainer);      if (NS_SUCCEEDED(rv) && imgContainer) {        nscoord w = 0, h = 0;        imgContainer->GetWidth(&w);        imgContainer->GetHeight(&h);        width = w;        height = h;        NS_RELEASE(imgContainer);      }#else      mImageRequest->GetNaturalImageSize(&width, &height);#endif      // if we got a valid size (sometimes we do not) then display it      if (width != 0 && height != 0){        key.Assign(NS_LITERAL_STRING("ImageTitleWithDimensions"));        nsAutoString widthStr; widthStr.AppendInt(width);        nsAutoString heightStr; heightStr.AppendInt(height);        const PRUnichar *formatStrings[2]  = {widthStr.get(), heightStr.get()};        rv = bundle->FormatStringFromName(key.get(), formatStrings, 2, getter_Copies(valUni));      }    }    if (!valUni || !valUni[0]) {      key.Assign(NS_LITERAL_STRING("ImageTitleWithoutDimensions"));      rv = bundle->GetStringFromName(key.get(), getter_Copies(valUni));    }    if (NS_SUCCEEDED(rv) && valUni) {      // set it on the document      SetTitle(nsDependentString(valUni));    }  }  return NS_OK;}