nsRDFParserUtils::StripAndConvert(type);
XULContentSinkImpl::OpenScript(const nsIParserNode& aNode){    nsresult rv = NS_OK;    PRBool isJavaScript = PR_TRUE;    const char* jsVersionString = nsnull;    PRInt32 ac = aNode.GetAttributeCount();    // Look for SRC attribute and look for a LANGUAGE attribute    nsAutoString src;    for (PRInt32 i = 0; i < ac; i++) {        nsAutoString key(aNode.GetKeyAt(i));        if (key.EqualsIgnoreCase("src")) {            src.Assign(aNode.GetValueAt(i));            nsRDFParserUtils::StripAndConvert(src);        }        else if (key.EqualsIgnoreCase("type")) {            nsAutoString  type(aNode.GetValueAt(i));            nsRDFParserUtils::StripAndConvert(type);            nsAutoString  mimeType;            nsAutoString  params;            SplitMimeType(type, mimeType, params);            isJavaScript = 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.EqualsIgnoreCase("language")) {            nsAutoString  lang(aNode.GetValueAt(i));            nsRDFParserUtils::StripAndConvert(lang);            isJavaScript = nsRDFParserUtils::IsJavaScriptLanguage(lang, &jsVersionString);        }    }      // Don't process scripts that aren't JavaScript    if (isJavaScript) {        nsXULPrototypeScript* script =            new nsXULPrototypeScript(aNode.GetSourceLineNumber(),                                     jsVersionString);        if (! script)            return NS_ERROR_OUT_OF_MEMORY;        nsVoidArray* children;        rv = mContextStack.GetTopChildren(&children);        if (NS_FAILED(rv)) {            delete script;            return rv;        }        children->AppendElement(script);        // If there is a SRC attribute...        if (src.Length() > 0) {            // Use the SRC attribute value to load the URL            nsCOMPtr<nsIURI> url;            rv = NS_NewURI(getter_AddRefs(url), src, mDocumentURL);            if (NS_FAILED(rv)) return rv;            script->mSrcURI = url;        }        mConstrainSize = PR_FALSE;        mContextStack.Push(script, mState);        mState = eInScript;    }    return NS_OK;}