From ef40f655ef1fa3e3c0ddce072c68dc7e32533df0 Mon Sep 17 00:00:00 2001 From: "gavin%gavinsharp.com" Date: Thu, 4 Jan 2007 18:56:00 +0000 Subject: [PATCH] Bug 365381: treat 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 --- .../content/xbl/src/nsXBLProtoImplMethod.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/mozilla/content/xbl/src/nsXBLProtoImplMethod.cpp b/mozilla/content/xbl/src/nsXBLProtoImplMethod.cpp index 9f1dd2b0fb1..3aded6f2ffc 100644 --- a/mozilla/content/xbl/src/nsXBLProtoImplMethod.cpp +++ b/mozilla/content/xbl/src/nsXBLProtoImplMethod.cpp @@ -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);