mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 821850 - Pass nsXBLBinding instead of nsIContent during implementation installation. r=bz
This lets us hook up the binding to the JSClass.
This commit is contained in:
parent
a2d9d906cb
commit
d9a73ac04a
@ -1069,7 +1069,7 @@ nsXBLBinding::InstallImplementation()
|
||||
|
||||
// iterate through each property in the prototype's list and install the property.
|
||||
if (AllowScripts())
|
||||
return mPrototypeBinding->InstallImplementation(mBoundElement);
|
||||
return mPrototypeBinding->InstallImplementation(this);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -42,7 +42,8 @@ public:
|
||||
};
|
||||
|
||||
nsresult
|
||||
nsXBLProtoImpl::InstallImplementation(nsXBLPrototypeBinding* aBinding, nsIContent* aBoundElement)
|
||||
nsXBLProtoImpl::InstallImplementation(nsXBLPrototypeBinding* aPrototypeBinding,
|
||||
nsXBLBinding* aBinding)
|
||||
{
|
||||
// This function is called to install a concrete implementation on a bound element using
|
||||
// this prototype implementation as a guide. The prototype implementation is compiled lazily,
|
||||
@ -53,7 +54,7 @@ nsXBLProtoImpl::InstallImplementation(nsXBLPrototypeBinding* aBinding, nsIConten
|
||||
|
||||
// If the way this gets the script context changes, fix
|
||||
// nsXBLProtoImplAnonymousMethod::Execute
|
||||
nsIDocument* document = aBoundElement->OwnerDoc();
|
||||
nsIDocument* document = aBinding->GetBoundElement()->OwnerDoc();
|
||||
|
||||
nsIScriptGlobalObject *global = document->GetScopeObject();
|
||||
if (!global) return NS_OK;
|
||||
@ -67,7 +68,8 @@ nsXBLProtoImpl::InstallImplementation(nsXBLPrototypeBinding* aBinding, nsIConten
|
||||
// not been built already.
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
|
||||
JSObject* targetClassObject = nullptr;
|
||||
nsresult rv = InitTargetObjects(aBinding, context, aBoundElement,
|
||||
nsresult rv = InitTargetObjects(aPrototypeBinding, context,
|
||||
aBinding->GetBoundElement(),
|
||||
getter_AddRefs(holder), &targetClassObject);
|
||||
NS_ENSURE_SUCCESS(rv, rv); // kick out if we were unable to properly intialize our target objects
|
||||
|
||||
@ -82,7 +84,7 @@ nsXBLProtoImpl::InstallImplementation(nsXBLPrototypeBinding* aBinding, nsIConten
|
||||
for (nsXBLProtoImplMember* curr = mMembers;
|
||||
curr;
|
||||
curr = curr->GetNext())
|
||||
curr->InstallMember(context, aBoundElement, targetScriptObject,
|
||||
curr->InstallMember(context, aBinding->GetBoundElement(), targetScriptObject,
|
||||
targetClassObject, mClassName);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "nsXBLPrototypeHandler.h"
|
||||
#include "nsXBLProtoImplMember.h"
|
||||
#include "nsXBLProtoImplField.h"
|
||||
#include "nsXBLBinding.h"
|
||||
|
||||
class nsIXPConnectJSObjectHolder;
|
||||
class nsXBLPrototypeBinding;
|
||||
@ -36,7 +37,7 @@ public:
|
||||
delete mFields;
|
||||
}
|
||||
|
||||
nsresult InstallImplementation(nsXBLPrototypeBinding* aBinding, nsIContent* aBoundElement);
|
||||
nsresult InstallImplementation(nsXBLPrototypeBinding* aPrototypeBinding, nsXBLBinding* aBinding);
|
||||
nsresult InitTargetObjects(nsXBLPrototypeBinding* aBinding, nsIScriptContext* aContext,
|
||||
nsIContent* aBoundElement,
|
||||
nsIXPConnectJSObjectHolder** aScriptObjectHolder,
|
||||
|
@ -541,10 +541,10 @@ nsXBLPrototypeBinding::SetDestructor(nsXBLProtoImplAnonymousMethod* aMethod)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXBLPrototypeBinding::InstallImplementation(nsIContent* aBoundElement)
|
||||
nsXBLPrototypeBinding::InstallImplementation(nsXBLBinding* aBinding)
|
||||
{
|
||||
if (mImplementation)
|
||||
return mImplementation->InstallImplementation(this, aBoundElement);
|
||||
return mImplementation->InstallImplementation(this, aBinding);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ public:
|
||||
nsresult ConstructInterfaceTable(const nsAString& aImpls);
|
||||
|
||||
void SetImplementation(nsXBLProtoImpl* aImpl) { mImplementation = aImpl; }
|
||||
nsresult InstallImplementation(nsIContent* aBoundElement);
|
||||
nsresult InstallImplementation(nsXBLBinding* aBinding);
|
||||
bool HasImplementation() const { return mImplementation != nullptr; }
|
||||
|
||||
void AttributeChanged(nsIAtom* aAttribute, int32_t aNameSpaceID,
|
||||
|
Loading…
Reference in New Issue
Block a user