nsCOMPtr<nsIXULContentUtils> utils(do_GetService("@mozilla.org/rdf/xul-content-utils;1")); if (utils && utils->UseXULCache()) { nsCOMPtr<nsIXULPrototypeCache> cache(do_GetService("@mozilla.org/rdf/xul-prototype-cache;1")); if (cache) {
nsCOMPtr<nsIXULPrototypeCache> cache(do_GetService("@mozilla.org/xul/xul-prototype-cache;1")); if (cache) { PRBool enabled; cache->GetEnabled(&enabled); if (enabled) {
CSSLoaderImpl::SheetComplete(nsICSSStyleSheet* aSheet, SheetLoadData* aLoadData){#ifdef INCLUDE_XUL  if (IsChromeURI(aLoadData->mURL)) {    nsCOMPtr<nsIXULContentUtils> utils(do_GetService("@mozilla.org/rdf/xul-content-utils;1"));    if (utils && utils->UseXULCache()) {      nsCOMPtr<nsIXULPrototypeCache> cache(do_GetService("@mozilla.org/rdf/xul-prototype-cache;1"));      if (cache) {        nsCOMPtr<nsICSSStyleSheet> sheet;        cache->GetStyleSheet(aLoadData->mURL, getter_AddRefs(sheet));        if (!sheet) {          cache->PutStyleSheet(aSheet);          aSheet->SetModified(PR_FALSE); // We're clean.        }      }    }  }#endif  nsresult result = NS_OK;  URLKey  key(aLoadData->mURL);  if (! aLoadData->mIsInline) { // don't remember inline sheets     NS_ADDREF(aSheet);  // add ref for table    nsICSSStyleSheet* oldSheet = (nsICSSStyleSheet*)mLoadedSheets.Put(&key, aSheet);    NS_IF_RELEASE(oldSheet);  // relase predecessor (was dirty)  }  SheetLoadData* data = aLoadData;  do {  // add to parent sheet, parent doc or pending doc sheet list    PrepareSheet(aSheet, data->mTitle, data->mMedia);    if (data->mParentSheet) { // is child sheet      InsertChildSheet(aSheet, data->mParentSheet, data->mSheetIndex);    }    else if (data->mIsAgent) {  // is agent sheet      if (data->mObserver) {        data->mObserver->StyleSheetLoaded(aSheet, PR_FALSE);      }    }    else {  // doc sheet      if (data->mParserToUnblock) { // if blocking, insert it immediately        InsertSheetInDoc(aSheet, data->mSheetIndex, data->mOwningElement, PR_TRUE, data->mObserver);      }      else { // otherwise wait until all are loaded (even inlines)        AddPendingSheet(aSheet, data->mSheetIndex, data->mOwningElement, data->mObserver);      }    }    data = data->mNext;    if (data) { // clone sheet for next insertion      nsICSSStyleSheet* clone = nsnull;      result = aSheet->Clone(clone);      NS_RELEASE(aSheet);      if (NS_SUCCEEDED(result)) {        aSheet = clone;      }    }    else {      NS_RELEASE(aSheet);    }  } while (data && aSheet);  Cleanup(key, aLoadData);  return result;}