diff --git a/dom/bindings/parser/WebIDL.py b/dom/bindings/parser/WebIDL.py index e5263bb11cfa..cef662266fb7 100644 --- a/dom/bindings/parser/WebIDL.py +++ b/dom/bindings/parser/WebIDL.py @@ -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) diff --git a/dom/bindings/parser/tests/test_method.py b/dom/bindings/parser/tests/test_method.py index 43fa2828b664..f6f54c33ab6e 100644 --- a/dom/bindings/parser/tests/test_method.py +++ b/dom/bindings/parser/tests/test_method.py @@ -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")