chromeRegistry->GetBackstopSheets(getter_AddRefs(sheets));
nsCOMPtr<nsIDocShell> ds(do_QueryInterface(mContainer)); chromeRegistry->GetBackstopSheets(ds, getter_AddRefs(sheets));
DocumentViewerImpl::CreateStyleSet(nsIDocument* aDocument,                                   nsIStyleSet** aStyleSet){  // this should eventually get expanded to allow for creating  // different sets for different media  nsresult rv;  if (!mUAStyleSheet) {    NS_WARNING("unable to load UA style sheet");  }  rv = nsComponentManager::CreateInstance(kStyleSetCID,nsnull,NS_GET_IID(nsIStyleSet),(void**)aStyleSet);  if (NS_OK == rv) {    PRInt32 index = aDocument->GetNumberOfStyleSheets();    while (0 < index--) {      nsCOMPtr<nsIStyleSheet> sheet(getter_AddRefs(aDocument->GetStyleSheetAt(index)));      /*       * GetStyleSheetAt will return all style sheets in the document but       * we're only interested in the ones that are enabled.       */      PRBool styleEnabled;      sheet->GetEnabled(styleEnabled);      if (styleEnabled) {        (*aStyleSet)->AddDocStyleSheet(sheet, aDocument);      }    }    NS_WITH_SERVICE(nsIChromeRegistry, chromeRegistry, "@mozilla.org/chrome/chrome-registry;1", &rv);    if (NS_SUCCEEDED(rv) && chromeRegistry) {      nsCOMPtr<nsISupportsArray> sheets;      chromeRegistry->GetBackstopSheets(getter_AddRefs(sheets));      if(sheets){        nsCOMPtr<nsICSSStyleSheet> sheet;        PRUint32 count;        sheets->Count(&count);        for(PRUint32 i=0; i<count; i++) {          sheets->GetElementAt(i, getter_AddRefs(sheet));          (*aStyleSet)->AppendBackstopStyleSheet(sheet);        }      }      // Now handle the user sheets.      nsCOMPtr<nsIDocShellTreeItem> docShell(do_QueryInterface(mContainer));      PRInt32 shellType;      docShell->GetItemType(&shellType);      PRBool isChrome = (shellType == nsIDocShellTreeItem::typeChrome);      sheets = nsnull;      chromeRegistry->GetUserSheets(isChrome, getter_AddRefs(sheets));      if(sheets){        nsCOMPtr<nsICSSStyleSheet> sheet;        PRUint32 count;        sheets->Count(&count);        for(PRUint32 i=0; i<count; i++) {          sheets->GetElementAt(i, getter_AddRefs(sheet));          // XXX For now, append as backstop until we figure out something          // better to do.          (*aStyleSet)->AppendBackstopStyleSheet(sheet);        }      }    }    if (mUAStyleSheet) {      (*aStyleSet)->AppendBackstopStyleSheet(mUAStyleSheet);    }  }  return NS_OK;}