Bug 1583636. Ensure that all the partials of an interface mixin are in the same .webidl file. r=edgar,saschanaz

The build system can't handle things being scattered about more than that.

Differential Revision: https://phabricator.services.mozilla.com/D47001

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Boris Zbarsky 2019-09-26 13:09:49 +00:00
Родитель 71a08e56c3
Коммит 6f69ca7498
2 изменённых файлов: 31 добавлений и 14 удалений

Просмотреть файл

@ -72,25 +72,34 @@ class Configuration(DescriptorProvider):
assert not thing.isType()
if not thing.isInterface() and not thing.isNamespace():
if (not thing.isInterface() and not thing.isNamespace() and
not thing.isInterfaceMixin()):
continue
iface = thing
# Our build system doesn't support dep builds involving
# addition/removal of partial interfaces that appear in a different
# .webidl file than the interface they are extending. Make sure we
# don't have any of those. See similar block above for "implements"
# addition/removal of partial interfaces/namespaces/mixins that
# appear in a different .webidl file than the
# interface/namespace/mixin they are extending. Make sure we don't
# have any of those. See similar block above for "includes"
# statements!
if not iface.isExternal():
for partialIface in iface.getPartials():
if partialIface.filename() != iface.filename():
if not thing.isExternal():
for partial in thing.getPartials():
if partial.filename() != thing.filename():
raise TypeError(
"The binding build system doesn't really support "
"partial interfaces which don't appear in the "
"file in which the interface they are extending is "
"partial interfaces/namespaces/mixins which don't "
"appear in the file in which the "
"interface/namespace/mixin they are extending is "
"defined. Don't do this.\n"
"%s\n"
"%s" %
(partialIface.location, iface.location))
(partial.location, thing.location))
# The rest of the logic doesn't apply to mixins.
if thing.isInterfaceMixin():
continue
iface = thing
if not iface.isExternal():
if not (iface.getExtendedAttribute("ChromeOnly") or
iface.getExtendedAttribute("Func") == ["IsChromeOrXBL"] or
iface.getExtendedAttribute("Func") == ["nsContentUtils::IsCallerChromeOrFuzzingEnabled"] or
@ -103,6 +112,7 @@ class Configuration(DescriptorProvider):
"if you do not want it exposed to the web.\n"
"%s" %
(webRoots, iface.location))
self.interfaces[iface.identifier.name] = iface
entry = config.get(iface.identifier.name, {})

Просмотреть файл

@ -154,6 +154,9 @@ class IDLObject(object):
def isNamespace(self):
return False
def isInterfaceMixin(self):
return False
def isEnum(self):
return False
@ -715,6 +718,7 @@ class IDLInterfaceOrInterfaceMixinOrNamespace(IDLObjectWithScope, IDLExposureMix
return "interface"
if self.isNamespace():
return "namespace"
assert self.isInterfaceMixin()
return "interface mixin"
def getExtendedAttribute(self, name):
@ -771,6 +775,9 @@ class IDLInterfaceOrInterfaceMixinOrNamespace(IDLObjectWithScope, IDLExposureMix
"larger exposure set than its container",
[member.location, self.location])
def isExternal(self):
return False
class IDLInterfaceMixin(IDLInterfaceOrInterfaceMixinOrNamespace):
def __init__(self, location, parentScope, name, members, isKnownNonPartial):
@ -785,6 +792,9 @@ class IDLInterfaceMixin(IDLInterfaceOrInterfaceMixinOrNamespace):
def __str__(self):
return "Interface mixin '%s'" % self.identifier.name
def isInterfaceMixin(self):
return True
def finish(self, scope):
if self._finished:
return
@ -1487,9 +1497,6 @@ class IDLInterfaceOrNamespace(IDLInterfaceOrInterfaceMixinOrNamespace):
'an integer-typed "length" attribute',
[self.location, indexedGetter.location])
def isExternal(self):
return False
def setCallback(self, value):
self._callback = value