const char *urlSpec = newSpec;
nsCAutoString urlSpec(newSpec);
static nsresult GetConvertedChromeURL(const char* uriStr, nsIFileSpec* *outSpec)//----------------------------------------------------------------------------------------{  nsresult rv;      nsCOMPtr<nsIURI> uri;  uri = do_CreateInstance(kStandardUrlCID);  uri->SetSpec(uriStr);  if (NS_FAILED(rv)) return rv;    nsCOMPtr<nsIChromeRegistry> chromeRegistry =      do_GetService(kChromeRegistryCID, &rv);  nsXPIDLCString newSpec;    if (NS_SUCCEEDED(rv)) {      rv = chromeRegistry->ConvertChromeURL(uri, getter_Copies(newSpec));      if (NS_FAILED(rv))          return rv;  }  const char *urlSpec = newSpec;  uri->SetSpec(urlSpec);  /* won't deal remote URI yet */  nsString fileStr; fileStr.AssignWithConversion("file");  nsString resStr; resStr.AssignWithConversion("res");  nsString resoStr; resoStr.AssignWithConversion("resource");    char *uriScheme = nsnull;  uri->GetScheme(&uriScheme);  nsString tmpStr; tmpStr.AssignWithConversion(uriScheme);     NS_ASSERTION(((tmpStr == fileStr) || (tmpStr == resStr) || (tmpStr == resoStr)), "won't deal remote URI yet! \n");     if ((tmpStr != fileStr)) {       /* resolve to fileURL */       nsSpecialSystemDirectory dir(nsSpecialSystemDirectory::Moz_BinDirectory);       nsFileURL fileURL(dir); // file:///moz_0511/mozilla/...              char *uriPath = nsnull;       uri->GetPath(&uriPath);       fileURL += uriPath;       urlSpec = fileURL.GetURLString();  }  nsCOMPtr<nsIFileSpec> dataFilesDir = do_GetService(kFileSpecCID, &rv);  NS_ENSURE_SUCCESS(rv,rv);  *outSpec = dataFilesDir;  NS_ADDREF(*outSpec);  return dataFilesDir->SetURLString(urlSpec);}