mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 08:45:46 +00:00
Backed out changeset 64c8ab5ec067 (bug 1611173) for linting failure at xpidl.py. CLOSED TREE
This commit is contained in:
parent
ba3997abc8
commit
d5dee0c16b
@ -97,7 +97,11 @@ class MOZ_STACK_CLASS AutoSavePendingResult {
|
||||
// static
|
||||
const nsXPTInterfaceInfo* nsXPCWrappedJS::GetInterfaceInfo(REFNSIID aIID) {
|
||||
const nsXPTInterfaceInfo* info = nsXPTInterfaceInfo::ByIID(aIID);
|
||||
if (!info || info->IsBuiltinClass()) {
|
||||
if (!info) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (info->IsBuiltinClass() || !nsXPConnect::IsISupportsDescendant(info)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -248,6 +248,16 @@ already_AddRefed<XPCNativeInterface> XPCNativeInterface::NewInstance(
|
||||
|
||||
uint16_t methodCount = aInfo->MethodCount();
|
||||
uint16_t constCount = aInfo->ConstantCount();
|
||||
|
||||
// If the interface does not have nsISupports in its inheritance chain
|
||||
// then we know we can't reflect its methods. However, some interfaces that
|
||||
// are used just to reflect constants are declared this way. We need to
|
||||
// go ahead and build the thing. But, we'll ignore whatever methods it may
|
||||
// have.
|
||||
if (!nsXPConnect::IsISupportsDescendant(aInfo)) {
|
||||
methodCount = 0;
|
||||
}
|
||||
|
||||
totalCount = methodCount + constCount;
|
||||
|
||||
if (totalCount > MAX_LOCAL_MEMBER_COUNT) {
|
||||
|
@ -166,6 +166,11 @@ XPCJSRuntime* nsXPConnect::GetRuntimeInstance() {
|
||||
return gSelf->mRuntime;
|
||||
}
|
||||
|
||||
// static
|
||||
bool nsXPConnect::IsISupportsDescendant(const nsXPTInterfaceInfo* info) {
|
||||
return info && info->HasAncestor(NS_GET_IID(nsISupports));
|
||||
}
|
||||
|
||||
void xpc::ErrorBase::Init(JSErrorBase* aReport) {
|
||||
if (!aReport->filename) {
|
||||
mFileName.SetIsVoid(true);
|
||||
|
@ -226,6 +226,8 @@ class nsXPConnect final : public nsIXPConnect {
|
||||
static XPCJSRuntime* GetRuntimeInstance();
|
||||
XPCJSContext* GetContext() { return mContext; }
|
||||
|
||||
static bool IsISupportsDescendant(const nsXPTInterfaceInfo* info);
|
||||
|
||||
static nsIScriptSecurityManager* SecurityManager() {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(gScriptSecurityManager);
|
||||
|
@ -479,7 +479,12 @@ def write_interface(iface, fd):
|
||||
if iface.namemap is None:
|
||||
raise Exception("Interface was not resolved.")
|
||||
|
||||
assert iface.base or (iface.name == "nsISupports")
|
||||
# if we see a base class-less type other than nsISupports, we just need
|
||||
# to discard anything else about it other than its constants.
|
||||
if iface.base is None and iface.name != "nsISupports":
|
||||
assert len([m for m in iface.members
|
||||
if type(m) == xpidl.Attribute or type(m) == xpidl.Method]) == 0
|
||||
return
|
||||
|
||||
# Extract the UUID's information so that it can be written into the struct definition
|
||||
names = uuid_decoder.match(iface.attributes.uuid).groupdict()
|
||||
|
@ -51,7 +51,12 @@ def write_interface(iface, fd):
|
||||
if iface.namemap is None:
|
||||
raise Exception("Interface was not resolved.")
|
||||
|
||||
assert iface.base or (iface.name == "nsISupports")
|
||||
# if we see a base class-less type other than nsISupports, we just need
|
||||
# to discard anything else about it other than its constants.
|
||||
if iface.base is None and iface.name != "nsISupports":
|
||||
assert len([m for m in iface.members
|
||||
if type(m) == xpidl.Attribute or type(m) == xpidl.Method]) == 0
|
||||
return
|
||||
|
||||
base = 'Some("%s")' % iface.base if iface.base is not None else 'None'
|
||||
try:
|
||||
|
@ -704,8 +704,6 @@ class Interface(object):
|
||||
raise IDLError("interface '%s' is not builtinclass but derives from "
|
||||
"builtinclass '%s'" %
|
||||
(self.name, self.base), self.location)
|
||||
elif self.name != 'nsISupports':
|
||||
raise IDLError("Interface '%s' must inherit from nsISupports" % self.name, self.location)
|
||||
|
||||
for member in self.members:
|
||||
member.resolve(self)
|
||||
|
Loading…
Reference in New Issue
Block a user