Bug 1140324 - Remove __noSuchMethod__ handling from WebIDL parser and throw an exception instead. r=peterv

--HG--
extra : rebase_source : 46e3fec0c5b1f399d209dd5e4038eeed6aabdc28
This commit is contained in:
Jan de Mooij 2015-03-07 16:35:04 +01:00
Родитель a58f208924
Коммит 1e027edc3b
2 изменённых файлов: 18 добавлений и 2 удалений

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

@ -338,7 +338,10 @@ class IDLUnresolvedIdentifier(IDLObject):
assert len(name) > 0
if name[:2] == "__" and name != "__content" and name != "___noSuchMethod__" and not allowDoubleUnderscore:
if name == "__noSuchMethod__":
raise WebIDLError("__noSuchMethod__ is deprecated", [location])
if name[:2] == "__" and name != "__content" and not allowDoubleUnderscore:
raise WebIDLError("Identifiers beginning with __ are reserved",
[location])
if name[0] == '_' and not allowDoubleUnderscore:
@ -3825,7 +3828,7 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
return self._hasOverloads
def isIdentifierLess(self):
return self.identifier.name[:2] == "__" and self.identifier.name != "__noSuchMethod__"
return self.identifier.name[:2] == "__"
def resolve(self, parentScope):
assert isinstance(parentScope, IDLScope)

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

@ -169,3 +169,16 @@ def WebIDLTest(parser, harness):
except Exception, x:
threw = True
harness.ok(threw, "Should spell [Throws] correctly on methods")
parser = parser.reset()
threw = False
try:
parser.parse("""
interface A {
void __noSuchMethod__();
};
""")
results = parser.finish()
except Exception, x:
threw = True
harness.ok(threw, "Should not allow __noSuchMethod__ methods")