nsCSSLoaderCallbackFunc aCallback, void *aData)
nsICSSLoaderObserver* aObserver)
CSSLoaderImpl::LoadAgentSheet(nsIURI* aURL,                               nsICSSStyleSheet*& aSheet,                              PRBool& aCompleted,                              nsCSSLoaderCallbackFunc aCallback,                              void *aData){  nsresult result = NS_ERROR_NULL_POINTER;  if (aURL) {    // Get an input stream from the url    nsIInputStream* in;    nsIURI* urlClone;    result = aURL->Clone(&urlClone); // dont give key URL to netlib, it gets munged    if (NS_SUCCEEDED(result)) {      result = NS_OpenURI(&in, urlClone);      NS_RELEASE(urlClone);      if (NS_SUCCEEDED(result)) {        // Translate the input using the argument character set id into unicode        nsIUnicharInputStream* uin;        result = NS_NewConverterStream(&uin, nsnull, in);        if (NS_SUCCEEDED(result)) {          SheetLoadData* data = new SheetLoadData(this, aURL, aCallback, aData);          if (data == nsnull) {            result = NS_ERROR_OUT_OF_MEMORY;          }          else {            NS_ADDREF(data);            URLKey  key(aURL);            mLoadingSheets.Put(&key, data);            result = ParseSheet(uin, data, aCompleted, aSheet);          }          NS_RELEASE(uin);        }        else {          fputs("CSSLoader::LoadAgentSheet - failed to get converter stream\n", stderr);        }        NS_RELEASE(in);      }      else {        // Dump an error message to the console        char *url;        aURL->GetSpec(&url);        cerr << "CSSLoaderImpl::LoadAgentSheet: Load of URL '" << url              << "' failed.  Error code: " << NS_ERROR_GET_CODE(result)  << "\n";        nsCRT::free(url);      }    }  }  return result;}