Bug 1492326, revert some of bug 1478372, so that callers need to get the custom interface from a custom element without using QueryInterface, r=peterv
This commit is contained in:
@@ -3871,10 +3871,17 @@ void Element::GetCustomInterface(nsGetterAddRefs<T> aResult) {
|
||||
nsCOMPtr<nsISupports> iface = CustomElementRegistry::CallGetCustomInterface(
|
||||
this, NS_GET_TEMPLATE_IID(T));
|
||||
if (iface) {
|
||||
CallQueryInterface(iface, static_cast<T**>(aResult));
|
||||
if (NS_SUCCEEDED(CallQueryInterface(iface, static_cast<T**>(aResult)))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise, check the binding manager to see if it implements the interface
|
||||
// for this element.
|
||||
OwnerDoc()->BindingManager()->GetBindingImplementation(
|
||||
this, NS_GET_TEMPLATE_IID(T), aResult);
|
||||
}
|
||||
|
||||
void Element::ClearServoData(nsIDocument* aDoc) {
|
||||
MOZ_ASSERT(aDoc);
|
||||
if (HasServoData()) {
|
||||
|
||||
@@ -296,16 +296,6 @@ NS_IMPL_RELEASE_INHERITED(nsXULElement, nsStyledElement)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsXULElement)
|
||||
NS_ELEMENT_INTERFACE_TABLE_TO_MAP_SEGUE
|
||||
|
||||
nsCOMPtr<nsISupports> iface =
|
||||
CustomElementRegistry::CallGetCustomInterface(this, aIID);
|
||||
if (iface) {
|
||||
iface->QueryInterface(aIID, aInstancePtr);
|
||||
if (*aInstancePtr) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsStyledElement)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
@@ -200,7 +200,8 @@ const MozElementMixin = Base => class MozElement extends Base {
|
||||
|
||||
/**
|
||||
* Indicate that a class defining a XUL element implements one or more
|
||||
* XPCOM interfaces by adding a getCustomInterface implementation to it.
|
||||
* XPCOM interfaces by adding a getCustomInterface implementation to it,
|
||||
* as well as an implementation of QueryInterface.
|
||||
*
|
||||
* The supplied class should implement the properties and methods of
|
||||
* all of the interfaces that are specified.
|
||||
@@ -218,6 +219,7 @@ const MozElementMixin = Base => class MozElement extends Base {
|
||||
}
|
||||
|
||||
cls.prototype.customInterfaceNumbers = numbers;
|
||||
cls.prototype.QueryInterface = ChromeUtils.generateQI(ifaces);
|
||||
cls.prototype.getCustomInterfaceCallback = function getCustomInterfaceCallback(iface) {
|
||||
if (numbers.has(iface.number)) {
|
||||
return getInterfaceProxy(this);
|
||||
|
||||
Reference in New Issue
Block a user