зеркало из https://github.com/mozilla/gecko-dev.git
Bug 907430: XBL constructors/destructors should have names, r=bz
--HG-- extra : transplant_source : G%E8%B6%A4%9D%E3%A2%F8C%81%1Dc%3E%FC%CD%13%5Ea%8A%E0
This commit is contained in:
Родитель
ab71e7c016
Коммит
1c4f38a7c3
|
@ -54,7 +54,7 @@ nsXBLContentSink::nsXBLContentSink()
|
|||
mSecondaryState(eXBL_None),
|
||||
mDocInfo(nullptr),
|
||||
mIsChromeOrResource(false),
|
||||
mFoundFirstBinding(false),
|
||||
mFoundFirstBinding(false),
|
||||
mBinding(nullptr),
|
||||
mHandler(nullptr),
|
||||
mImplementation(nullptr),
|
||||
|
@ -453,8 +453,15 @@ nsXBLContentSink::OnOpenContainer(const PRUnichar **aAtts,
|
|||
NS_ASSERTION(mBinding, "Must have binding here");
|
||||
|
||||
mSecondaryState = eXBL_InConstructor;
|
||||
nsAutoString name;
|
||||
if (!mCurrentBindingID.IsEmpty()) {
|
||||
name.Assign(mCurrentBindingID);
|
||||
name.AppendLiteral("_XBL_Constructor");
|
||||
} else {
|
||||
name.AppendLiteral("XBL_Constructor");
|
||||
}
|
||||
nsXBLProtoImplAnonymousMethod* newMethod =
|
||||
new nsXBLProtoImplAnonymousMethod();
|
||||
new nsXBLProtoImplAnonymousMethod(name.get());
|
||||
if (newMethod) {
|
||||
newMethod->SetLineNumber(aLineNumber);
|
||||
mBinding->SetConstructor(newMethod);
|
||||
|
@ -466,8 +473,15 @@ nsXBLContentSink::OnOpenContainer(const PRUnichar **aAtts,
|
|||
mSecondaryState == eXBL_None);
|
||||
NS_ASSERTION(mBinding, "Must have binding here");
|
||||
mSecondaryState = eXBL_InDestructor;
|
||||
nsAutoString name;
|
||||
if (!mCurrentBindingID.IsEmpty()) {
|
||||
name.Assign(mCurrentBindingID);
|
||||
name.AppendLiteral("_XBL_Destructor");
|
||||
} else {
|
||||
name.AppendLiteral("XBL_Destructor");
|
||||
}
|
||||
nsXBLProtoImplAnonymousMethod* newMethod =
|
||||
new nsXBLProtoImplAnonymousMethod();
|
||||
new nsXBLProtoImplAnonymousMethod(name.get());
|
||||
if (newMethod) {
|
||||
newMethod->SetLineNumber(aLineNumber);
|
||||
mBinding->SetDestructor(newMethod);
|
||||
|
@ -529,9 +543,8 @@ nsresult
|
|||
nsXBLContentSink::ConstructBinding(uint32_t aLineNumber)
|
||||
{
|
||||
nsCOMPtr<nsIContent> binding = GetCurrentContent();
|
||||
nsAutoString id;
|
||||
binding->GetAttr(kNameSpaceID_None, nsGkAtoms::id, id);
|
||||
NS_ConvertUTF16toUTF8 cid(id);
|
||||
binding->GetAttr(kNameSpaceID_None, nsGkAtoms::id, mCurrentBindingID);
|
||||
NS_ConvertUTF16toUTF8 cid(mCurrentBindingID);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
|
|
@ -135,6 +135,8 @@ protected:
|
|||
bool mIsChromeOrResource; // For bug #45989
|
||||
bool mFoundFirstBinding;
|
||||
|
||||
nsString mCurrentBindingID;
|
||||
|
||||
nsXBLPrototypeBinding* mBinding;
|
||||
nsXBLPrototypeHandler* mHandler; // current handler, owned by its PrototypeBinding
|
||||
nsXBLProtoImpl* mImplementation;
|
||||
|
|
|
@ -397,7 +397,11 @@ nsXBLProtoImpl::Read(nsIObjectInputStream* aStream,
|
|||
}
|
||||
case XBLBinding_Serialize_Constructor:
|
||||
{
|
||||
mConstructor = new nsXBLProtoImplAnonymousMethod();
|
||||
nsAutoString name;
|
||||
rv = aStream->ReadString(name);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mConstructor = new nsXBLProtoImplAnonymousMethod(name.get());
|
||||
rv = mConstructor->Read(aStream);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete mConstructor;
|
||||
|
@ -410,7 +414,11 @@ nsXBLProtoImpl::Read(nsIObjectInputStream* aStream,
|
|||
}
|
||||
case XBLBinding_Serialize_Destructor:
|
||||
{
|
||||
mDestructor = new nsXBLProtoImplAnonymousMethod();
|
||||
nsAutoString name;
|
||||
rv = aStream->ReadString(name);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mDestructor = new nsXBLProtoImplAnonymousMethod(name.get());
|
||||
rv = mDestructor->Read(aStream);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete mDestructor;
|
||||
|
|
|
@ -372,6 +372,9 @@ nsXBLProtoImplAnonymousMethod::Write(nsIObjectOutputStream* aStream,
|
|||
nsresult rv = aStream->Write8(aType);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = aStream->WriteWStringZ(mName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Calling fromMarkedLocation() is safe because mMethod is traced by the
|
||||
// Trace() method above, and because its value is never changed after it has
|
||||
// been set to a compiled method.
|
||||
|
|
|
@ -131,8 +131,8 @@ protected:
|
|||
|
||||
class nsXBLProtoImplAnonymousMethod : public nsXBLProtoImplMethod {
|
||||
public:
|
||||
nsXBLProtoImplAnonymousMethod() :
|
||||
nsXBLProtoImplMethod(EmptyString().get())
|
||||
nsXBLProtoImplAnonymousMethod(const PRUnichar* aName) :
|
||||
nsXBLProtoImplMethod(aName)
|
||||
{}
|
||||
|
||||
nsresult Execute(nsIContent* aBoundElement);
|
||||
|
|
|
@ -16,7 +16,7 @@ typedef uint8_t XBLBindingSerializeDetails;
|
|||
|
||||
// A version number to ensure we don't load cached data in a different
|
||||
// file format.
|
||||
#define XBLBinding_Serialize_Version 0x00000001
|
||||
#define XBLBinding_Serialize_Version 0x00000002
|
||||
|
||||
// Set for the first binding in a document
|
||||
#define XBLBinding_Serialize_IsFirstBinding 1
|
||||
|
|
Загрузка…
Ссылка в новой задаче