Relanding without the test just to make sure this is in fact what's breaking stuff

This commit is contained in:
bzbarsky@mit.edu 2007-12-02 14:27:11 -08:00
Родитель a27f86dd5d
Коммит 057155e2c2
2 изменённых файлов: 25 добавлений и 4 удалений

Просмотреть файл

@ -959,9 +959,16 @@ XULContentSinkImpl::OpenTag(const PRUnichar** aAttributes,
// even though it is ignored (the nsPrototypeScriptElement
// has its own script-type).
element->mScriptTypeID = nsIProgrammingLanguage::JAVASCRIPT;
// OpenScript will push the nsPrototypeScriptElement onto the
// stack, so we're done after this.
return OpenScript(aAttributes, aLineNumber);
rv = OpenScript(aAttributes, aLineNumber);
NS_ENSURE_SUCCESS(rv, rv);
NS_ASSERTION(mState == eInScript || mState == eInDocumentElement,
"Unexpected state");
if (mState == eInScript) {
// OpenScript has pushed the nsPrototypeScriptElement onto the
// stack, so we're done.
return NS_OK;
}
}
// Set the correct script-type for the element.
@ -1004,7 +1011,15 @@ XULContentSinkImpl::OpenScript(const PRUnichar** aAttributes,
rv = mimeHdrParser->GetParameter(typeAndParams, nsnull,
EmptyCString(), PR_FALSE, nsnull,
mimeType);
NS_ENSURE_SUCCESS(rv, rv);
if (NS_FAILED(rv)) {
if (rv == NS_ERROR_INVALID_ARG) {
// Might as well bail out now instead of setting langID to
// nsIProgrammingLanguage::UNKNOWN and bailing out later.
return NS_OK;
}
// We do want the warning here
NS_ENSURE_SUCCESS(rv, rv);
}
// Javascript keeps the fast path, optimized for most-likely type
// Table ordered from most to least likely JS MIME types. For .xul

Просмотреть файл

@ -105,6 +105,12 @@ protected:
const PRUint32 aLineNumber,
nsINodeInfo *aNodeInfo);
// If OpenScript returns NS_OK and after it returns our state is eInScript,
// that means that we created a prototype script and stuck it on
// mContextStack. If NS_OK is returned but the state is still
// eInDocumentElement then we didn't create a prototype script (e.g. the
// script had an unknown type), and the caller should create a prototype
// element.
nsresult OpenScript(const PRUnichar** aAttributes,
const PRUint32 aLineNumber);