else if (key.Equals(NS_LITERAL_STRING("language"), nsCaseInsensitiveStringComparator())) {
else if (key.Equals(NS_LITERAL_STRING("language"))) {
XULContentSinkImpl::OpenScript(const PRUnichar** aAttributes,                               const PRUint32 aLineNumber){  nsresult rv = NS_OK;  PRBool isJavaScript = PR_TRUE;  const char* jsVersionString = nsnull;  // Look for SRC attribute and look for a LANGUAGE attribute  nsAutoString src;  while (*aAttributes) {      const nsDependentString key(aAttributes[0]);      if (key.Equals(NS_LITERAL_STRING("src"),                     nsCaseInsensitiveStringComparator())) {          src.Assign(aAttributes[1]);      }      else if (key.Equals(NS_LITERAL_STRING("type"),                          nsCaseInsensitiveStringComparator())) {          nsAutoString  type(aAttributes[1]);          nsAutoString  mimeType;          nsAutoString  params;          nsParserUtils::SplitMimeType(type, mimeType, params);          isJavaScript = mimeType.EqualsIgnoreCase("application/x-javascript") ||                         mimeType.EqualsIgnoreCase("text/javascript");          if (isJavaScript) {              JSVersion jsVersion = JSVERSION_DEFAULT;              if (params.Find("version=", PR_TRUE) == 0) {                  if (params.Length() != 11 || params[8] != '1' || params[9] != '.')                      jsVersion = JSVERSION_UNKNOWN;                  else switch (params[10]) {                      case '0': jsVersion = JSVERSION_1_0; break;                      case '1': jsVersion = JSVERSION_1_1; break;                      case '2': jsVersion = JSVERSION_1_2; break;                      case '3': jsVersion = JSVERSION_1_3; break;                      case '4': jsVersion = JSVERSION_1_4; break;                      case '5': jsVersion = JSVERSION_1_5; break;                      default:  jsVersion = JSVERSION_UNKNOWN;                  }              }              jsVersionString = JS_VersionToString(jsVersion);          }      }      else if (key.Equals(NS_LITERAL_STRING("language"),                          nsCaseInsensitiveStringComparator())) {        nsAutoString  lang(aAttributes[1]);        isJavaScript = nsParserUtils::IsJavaScriptLanguage(lang, &jsVersionString);      }      aAttributes += 2;  }  // Don't process scripts that aren't JavaScript  if (isJavaScript) {      nsXULPrototypeScript* script =          new nsXULPrototypeScript(aLineNumber,                                   jsVersionString);      if (! script)          return NS_ERROR_OUT_OF_MEMORY;      // If there is a SRC attribute...      if (! src.IsEmpty()) {          // Use the SRC attribute value to load the URL          rv = NS_NewURI(getter_AddRefs(script->mSrcURI), src, nsnull, mDocumentURL);          // Check if this document is allowed to load a script from this source          // NOTE: if we ever allow scripts added via the DOM to run, we need to          // add a CheckLoadURI call for that as well.          if (NS_SUCCEEDED(rv)) {              if (!mSecMan)                  mSecMan = do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);              if (NS_SUCCEEDED(rv)) {                  rv = mSecMan->CheckLoadURI(mDocumentURL, script->mSrcURI,                                             nsIScriptSecurityManager::ALLOW_CHROME);              }          }          if (NS_FAILED(rv)) {              delete script;              return rv;          }          // Attempt to deserialize an out-of-line script from the FastLoad          // file right away.  Otherwise we'll end up reloading the script and          // corrupting the FastLoad file trying to serialize it, in the case          // where it's already there.          nsCOMPtr<nsIDocument> doc(do_QueryReferent(mDocument));          if (doc) {              nsIScriptGlobalObject* globalObject = doc->GetScriptGlobalObject();              if (globalObject) {                  nsCOMPtr<nsIScriptContext> scriptContext;                  globalObject->GetContext(getter_AddRefs(scriptContext));                  if (scriptContext)                      script->DeserializeOutOfLine(nsnull, scriptContext);              }          }      }      nsVoidArray* children;      rv = mContextStack.GetTopChildren(&children);      if (NS_FAILED(rv)) {          delete script;          return rv;      }      children->AppendElement(script);      mConstrainSize = PR_FALSE;      mContextStack.Push(script, mState);      mState = eInScript;  }  return NS_OK;}