if (NS_FAILED(rv)) { #ifdef PR_LOGGING nsAutoString qnameC; qnameC.Assign(aAttributes[0]); PR_LOG(gLog, PR_LOG_ALWAYS, ("xul: unable to parse attribute '%s' at line %d", NS_ConvertUCS2toUTF8(qnameC).get(), -1)); #endif    --(aElement->mNumAttributes); continue; } attrs->mValue.SetValue(nsDependentString(aAttributes[1]));
rv = aElement->SetAttrAt(i, nsDependentString(aAttributes[i * 2 + 1]), mDocumentURL); NS_ENSURE_SUCCESS(rv, rv);
XULContentSinkImpl::AddAttributes(const PRUnichar** aAttributes,                                   const PRUint32 aAttrLen,                                   nsXULPrototypeElement* aElement){  // Add tag attributes to the element  nsresult rv;  // Create storage for the attributes  nsXULPrototypeAttribute* attrs = nsnull;  if (aAttrLen > 0) {    attrs = new nsXULPrototypeAttribute[aAttrLen];    if (! attrs)      return NS_ERROR_OUT_OF_MEMORY;  }  aElement->mAttributes    = attrs;  aElement->mNumAttributes = aAttrLen;  // Copy the attributes into the prototype  for (; *aAttributes; aAttributes += 2) {      rv = NormalizeAttributeString(nsDependentString(aAttributes[0]),                                    getter_AddRefs(attrs->mNodeInfo));      if (NS_FAILED(rv)) {#ifdef PR_LOGGING          nsAutoString qnameC;          qnameC.Assign(aAttributes[0]);          PR_LOG(gLog, PR_LOG_ALWAYS,                 ("xul: unable to parse attribute '%s' at line %d",                  NS_ConvertUCS2toUTF8(qnameC).get(), -1)); // XXX pass in line number#endif          // Bring it. We'll just fail to copy an attribute that we          // can't parse. And that's one less attribute to worry          // about.          --(aElement->mNumAttributes);          continue;      }      attrs->mValue.SetValue(nsDependentString(aAttributes[1]));#ifdef PR_LOGGING      if (PR_LOG_TEST(gLog, PR_LOG_DEBUG)) {          nsAutoString extraWhiteSpace;          PRInt32 cnt = mContextStack.Depth();          while (--cnt >= 0)              extraWhiteSpace.Append(NS_LITERAL_STRING("  "));          nsAutoString qnameC,valueC;          qnameC.Assign(aAttributes[0]);          valueC.Assign(aAttributes[1]);          PR_LOG(gLog, PR_LOG_DEBUG,                 ("xul: %.5d. %s    %s=%s",                  -1, // XXX pass in line number                  NS_ConvertUCS2toUTF8(extraWhiteSpace).get(),                  NS_ConvertUCS2toUTF8(qnameC).get(),                  NS_ConvertUCS2toUTF8(valueC).get()));      }#endif      ++attrs;  }  // XUL elements may require some additional work to compute  // derived information.  if (aElement->mNodeInfo->NamespaceEquals(kNameSpaceID_XUL)) {      nsAutoString value;      // Compute the element's class list if the element has a 'class' attribute.      rv = aElement->GetAttr(kNameSpaceID_None, nsXULAtoms::clazz, value);      if (NS_FAILED(rv)) return rv;      if (rv == NS_CONTENT_ATTR_HAS_VALUE) {          rv = nsClassList::ParseClasses(&aElement->mClassList, value);          if (NS_FAILED(rv)) return rv;      }      // Parse the element's 'style' attribute      rv = aElement->GetAttr(kNameSpaceID_None, nsXULAtoms::style, value);      if (NS_FAILED(rv)) return rv;      if (rv == NS_CONTENT_ATTR_HAS_VALUE) {          if (!mCSSParser) {              mCSSParser = do_CreateInstance(kCSSParserCID, &rv);              if (NS_FAILED(rv)) return rv;          }          rv = mCSSParser->ParseStyleAttribute(value, mDocumentURL,                                 getter_AddRefs(aElement->mInlineStyleRule));          NS_ASSERTION(NS_SUCCEEDED(rv), "unable to parse style rule");          if (NS_FAILED(rv)) return rv;      }  }  return NS_OK;}