result = AddPendingSheet(clone, aDocIndex, aElement);
result = AddPendingSheet(clone, aDocIndex, aElement, aObserver);
CSSLoaderImpl::LoadStyleLink(nsIContent* aElement,                             nsIURI* aURL,                              const nsString& aTitle,                              const nsString& aMedia,                              PRInt32 aDefaultNameSpaceID,                             PRInt32 aDocIndex,                             nsIParser* aParserToUnblock,                             PRBool& aCompleted){  NS_ASSERTION(mDocument, "not initialized");  if (! mDocument) {    return NS_ERROR_NOT_INITIALIZED;  }  // XXX need to add code to cancel any pending sheets for element  nsresult result = NS_ERROR_NULL_POINTER;  aCompleted = PR_TRUE;  if (aURL) {    URLKey  key(aURL);    nsICSSStyleSheet* sheet = (nsICSSStyleSheet*)mLoadedSheets.Get(&key);    if (sheet && (NS_COMFALSE == sheet->IsUnmodified())) {  // if dirty, forget it      sheet = nsnull;    }    if (sheet) {  // already have one fully loaded and unmodified      nsICSSStyleSheet* clone = nsnull;      result = sheet->Clone(clone);      if (NS_SUCCEEDED(result)) {        PrepareSheet(clone, aTitle, aMedia);        if (aParserToUnblock) { // stick it in now, parser is waiting for it          result = InsertSheetInDoc(clone, aDocIndex, aElement, PR_TRUE);        }        else {  // add to pending list          result = AddPendingSheet(clone, aDocIndex, aElement);        }        NS_RELEASE(clone);      }    }    else {  // need to load it      SheetLoadData* data = new SheetLoadData(this, aURL, aTitle, aMedia, aDefaultNameSpaceID,                                              aElement, aDocIndex,                                               aParserToUnblock, PR_FALSE);      if (data == nsnull) {        result = NS_ERROR_OUT_OF_MEMORY;      }      else {        NS_ADDREF(data);        if (IsAlternate(aTitle) && mLoadingSheets.Count() &&            (! mLoadingSheets.Get(&key)) && (! aParserToUnblock)) {          // this is an alternate, and we're already loading others, but not loading this, defer it          mPendingAlternateSheets.AppendElement(data);          result = NS_OK;        }        else {          if (aParserToUnblock) {            data->mDidBlockParser = PR_TRUE;          }          result = LoadSheet(key, data);        }      }      aCompleted = PR_FALSE;    }  }  return result;}