Bug 785472 - The Web IDL parser should not allow inheriting from an interface that is only forward declared; r=khuey

This commit is contained in:
Ehsan Akhgari 2012-08-24 15:23:21 -04:00
parent b1634fb871
commit 0ab97da3c8
2 changed files with 19 additions and 0 deletions

View File

@ -422,6 +422,12 @@ class IDLInterface(IDLObjectWithScope):
assert not self.parent or isinstance(self.parent, IDLIdentifierPlaceholder)
parent = self.parent.finish(scope) if self.parent else None
if parent and isinstance(parent, IDLExternalInterface):
raise WebIDLError("%s inherits from %s which does not have "
"a definition" %
(self.identifier.name,
self.parent.identifier.name),
[self.location])
assert not parent or isinstance(parent, IDLInterface)
self.parent = parent

View File

@ -173,3 +173,16 @@ def WebIDLTest(parser, harness):
threw = True
harness.ok(threw, "Should not allow indirectly inheriting from an interface that indirectly implements us")
parser = parser.reset()
threw = False
try:
parser.parse("""
interface A;
interface B : A {};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Should not allow inheriting from an interface that is only forward declared")