Bug 1140324 - Remove __noSuchMethod__ handling from WebIDL parser and throw an exception instead. r=peterv
authorJan de Mooij <jdemooij@mozilla.com>
Sat, 07 Mar 2015 16:35:04 +0100
changeset 232395 4a5a4eafd2ce83a096001a4e1546f218d80dd9ad
parent 232394 b78fd38002f50344d6fc3a2fcba1f3a2f784fad9
child 232396 12e446d95738b8f7d29ded35c3b3d6d36140b15e
push id56538
push userjandemooij@gmail.com
push dateSat, 07 Mar 2015 15:37:27 +0000
treeherdermozilla-inbound@cb7d748abbe8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
bugs1140324
milestone39.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1140324 - Remove __noSuchMethod__ handling from WebIDL parser and throw an exception instead. r=peterv
dom/bindings/parser/WebIDL.py
dom/bindings/parser/tests/test_method.py
--- a/dom/bindings/parser/WebIDL.py
+++ b/dom/bindings/parser/WebIDL.py
@@ -333,17 +333,20 @@ class IDLIdentifier(IDLObject):
 
 class IDLUnresolvedIdentifier(IDLObject):
     def __init__(self, location, name, allowDoubleUnderscore = False,
                  allowForbidden = False):
         IDLObject.__init__(self, location)
 
         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:
             name = name[1:]
         # TODO: Bug 872377, Restore "toJSON" to below list.
         # We sometimes need custom serialization, so allow toJSON for now.
         if (name in ["constructor", "toString"] and
             not allowForbidden):
@@ -3820,17 +3823,17 @@ class IDLMethod(IDLInterfaceMember, IDLS
 
     def isJsonifier(self):
         return self._jsonifier
 
     def hasOverloads(self):
         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)
         IDLObjectWithIdentifier.resolve(self, parentScope)
         IDLScope.__init__(self, self.location, parentScope, self.identifier)
         for (returnType, arguments) in self.signatures():
             for argument in arguments:
                 argument.resolve(self)
--- a/dom/bindings/parser/tests/test_method.py
+++ b/dom/bindings/parser/tests/test_method.py
@@ -164,8 +164,21 @@ def WebIDLTest(parser, harness):
           interface A {
             [Throw] void foo();
           };
         """)
         results = parser.finish()
     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")