CSSStyleSheetImpl* child = new CSSStyleSheetImpl(*otherChild, this, nsnull, nsnull, nsnull);
CSSStyleSheetImpl* child = new CSSStyleSheetImpl(*otherChild, this, nsnull, aDocumentToUse, nsnull);
CSSStyleSheetImpl::CSSStyleSheetImpl(const CSSStyleSheetImpl& aCopy,                                     nsICSSStyleSheet* aParentToUse,                                     nsICSSImportRule* aOwnerRuleToUse,                                     nsIDocument* aDocumentToUse,                                     nsIDOMNode* aOwningNodeToUse)  : nsICSSStyleSheet(),    mRefCnt(0),    mTitle(aCopy.mTitle),     mMedia(nsnull),    mFirstChild(nsnull),     mNext(nsnull),    mParent(aParentToUse),    mOwnerRule(aOwnerRuleToUse),    mImportsCollection(nsnull), // re-created lazily    mRuleCollection(nsnull), // re-created lazily    mDocument(aDocumentToUse),    mOwningNode(aOwningNodeToUse),    mDisabled(aCopy.mDisabled),    mDirty(PR_FALSE),    mInner(aCopy.mInner),    mRuleProcessors(nsnull){  mInner->AddSheet(this);  if (aCopy.mRuleCollection &&       aCopy.mRuleCollection->mRulesAccessed) {  // CSSOM's been there, force full copy now    NS_ASSERTION(mInner->mComplete, "Why have rules been accessed on an incomplete sheet?");    EnsureUniqueInner();  }  if (aCopy.mMedia) {    nsCOMPtr<nsISupportsArray> tmp;    (NS_STATIC_CAST(nsISupportsArray *, aCopy.mMedia))->Clone(getter_AddRefs(tmp));    mMedia = new DOMMediaListImpl(tmp, this);    NS_IF_ADDREF(mMedia);  }  if (aCopy.mFirstChild) {    CSSStyleSheetImpl*  otherChild = aCopy.mFirstChild;    CSSStyleSheetImpl** ourSlot = &mFirstChild;    do {      // XXX This is wrong; we should be keeping @import rules and      // sheets in sync!      CSSStyleSheetImpl* child = new CSSStyleSheetImpl(*otherChild, this,                                                       nsnull, nsnull, nsnull);      if (child) {        NS_ADDREF(child);        (*ourSlot) = child;        ourSlot = &(child->mNext);      }      otherChild = otherChild->mNext;    }    while (otherChild && ourSlot);  }}