Bug 365381: treat <method><body/></method> XBL as 'function () {}' instead of ignoring it, r+sr=bzbarsky

git-svn-id: svn://10.0.0.236/trunk@217745 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
gavin%gavinsharp.com 2007-01-04 18:56:00 +00:00
parent 120ebebc31
commit ef40f655ef

View File

@ -193,15 +193,8 @@ nsXBLProtoImplMethod::CompileMember(nsIScriptContext* aContext, const nsCString&
if (!mUncompiledMethod)
return NS_OK;
// Don't install method if no name or body was supplied.
if (!(mName && mUncompiledMethod->mBodyText.GetText())) {
delete mUncompiledMethod;
mUncompiledMethod = nsnull;
return NS_OK;
}
nsDependentString body(mUncompiledMethod->mBodyText.GetText());
if (body.IsEmpty()) {
// Don't install method if no name was supplied.
if (!mName) {
delete mUncompiledMethod;
mUncompiledMethod = nsnull;
return NS_OK;
@ -232,6 +225,12 @@ nsXBLProtoImplMethod::CompileMember(nsIScriptContext* aContext, const nsCString&
argPos++;
}
// Get the body
nsDependentString body;
PRUnichar *bodyText = mUncompiledMethod->mBodyText.GetText();
if (bodyText)
body.Rebind(bodyText);
// Now that we have a body and args, compile the function
// and then define it.
NS_ConvertUTF16toUTF8 cname(mName);