aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/codegen/parser
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2018-04-03 14:06:07 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2018-04-03 14:06:07 +0200
commit938f1362e7f1b1f8a121eacc36e24c9ac6236e13 (patch)
tree5c6819ebd277633561a9d5878c19dbfab71a97d3 /components/script/dom/bindings/codegen/parser
parent866a523914029089f3a4ce17ec70b88f1307ecd4 (diff)
downloadservo-938f1362e7f1b1f8a121eacc36e24c9ac6236e13.tar.gz
servo-938f1362e7f1b1f8a121eacc36e24c9ac6236e13.zip
Update the WebIDL parser
Diffstat (limited to 'components/script/dom/bindings/codegen/parser')
-rw-r--r--components/script/dom/bindings/codegen/parser/WebIDL.py157
-rw-r--r--components/script/dom/bindings/codegen/parser/abstract.patch6
-rw-r--r--components/script/dom/bindings/codegen/parser/tests/test_cereactions.py15
-rw-r--r--components/script/dom/bindings/codegen/parser/tests/test_constructor.py3
-rw-r--r--components/script/dom/bindings/codegen/parser/tests/test_duplicate_qualifiers.py28
-rw-r--r--components/script/dom/bindings/codegen/parser/tests/test_global_extended_attr.py18
-rw-r--r--components/script/dom/bindings/codegen/parser/tests/test_method.py3
-rw-r--r--components/script/dom/bindings/codegen/parser/tests/test_special_method_signature_mismatch.py70
-rw-r--r--components/script/dom/bindings/codegen/parser/tests/test_special_methods.py27
-rw-r--r--components/script/dom/bindings/codegen/parser/tests/test_special_methods_uniqueness.py17
10 files changed, 103 insertions, 241 deletions
diff --git a/components/script/dom/bindings/codegen/parser/WebIDL.py b/components/script/dom/bindings/codegen/parser/WebIDL.py
index 5045eae6493..b2daa1bce20 100644
--- a/components/script/dom/bindings/codegen/parser/WebIDL.py
+++ b/components/script/dom/bindings/codegen/parser/WebIDL.py
@@ -1095,12 +1095,12 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins):
testInterface = testInterface.parent
# Ensure that there's at most one of each {named,indexed}
- # {getter,setter,creator,deleter}, at most one stringifier,
+ # {getter,setter,deleter}, at most one stringifier,
# and at most one legacycaller. Note that this last is not
# quite per spec, but in practice no one overloads
# legacycallers. Also note that in practice we disallow
# indexed deleters, but it simplifies some other code to
- # treat deleter analogously to getter/setter/creator by
+ # treat deleter analogously to getter/setter by
# prefixing it with "named".
specialMembersSeen = {}
for member in self.members:
@@ -1111,8 +1111,6 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins):
memberType = "getters"
elif member.isSetter():
memberType = "setters"
- elif member.isCreator():
- memberType = "creators"
elif member.isDeleter():
memberType = "deleters"
elif member.isStringifier():
@@ -1158,8 +1156,8 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins):
ancestor = ancestor.parent
if self._isOnGlobalProtoChain:
- # Make sure we have no named setters, creators, or deleters
- for memberType in ["setter", "creator", "deleter"]:
+ # Make sure we have no named setters or deleters
+ for memberType in ["setter", "deleter"]:
memberId = "named " + memberType + "s"
if memberId in specialMembersSeen:
raise WebIDLError("Interface with [Global] has a named %s" %
@@ -1183,6 +1181,22 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins):
parent = parent.parent
def validate(self):
+
+ def checkDuplicateNames(member, name, attributeName):
+ for m in self.members:
+ if m.identifier.name == name:
+ raise WebIDLError("[%s=%s] has same name as interface member" %
+ (attributeName, name),
+ [member.location, m.location])
+ if m.isMethod() and m != member and name in m.aliases:
+ raise WebIDLError("conflicting [%s=%s] definitions" %
+ (attributeName, name),
+ [member.location, m.location])
+ if m.isAttr() and m != member and name in m.bindingAliases:
+ raise WebIDLError("conflicting [%s=%s] definitions" %
+ (attributeName, name),
+ [member.location, m.location])
+
# We don't support consequential unforgeable interfaces. Need to check
# this here, because in finish() an interface might not know yet that
# it's consequential.
@@ -1295,15 +1309,15 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins):
raise WebIDLError("[Alias] must not be used on an "
"[Unforgeable] operation",
[member.location])
- for m in self.members:
- if m.identifier.name == alias:
- raise WebIDLError("[Alias=%s] has same name as "
- "interface member" % alias,
- [member.location, m.location])
- if m.isMethod() and m != member and alias in m.aliases:
- raise WebIDLError("duplicate [Alias=%s] definitions" %
- alias,
- [member.location, m.location])
+
+ checkDuplicateNames(member, alias, "Alias")
+
+ # Check that the name of a [BindingAlias] doesn't conflict with an
+ # interface member.
+ if member.isAttr():
+ for bindingAlias in member.bindingAliases:
+ checkDuplicateNames(member, bindingAlias, "BindingAlias")
+
# Conditional exposure makes no sense for interfaces with no
# interface object, unless they're navigator properties.
@@ -1720,10 +1734,10 @@ class IDLInterface(IDLInterfaceOrNamespace):
identifier == "OverrideBuiltins" or
identifier == "ChromeOnly" or
identifier == "Unforgeable" or
- identifier == "UnsafeInPrerendering" or
identifier == "LegacyEventInit" or
identifier == "ProbablyShortLivingWrapper" or
identifier == "LegacyUnenumerableNamedProperties" or
+ identifier == "RunConstructorInCallerCompartment" or
identifier == "NonOrdinaryGetPrototypeOf" or
identifier == "Abstract" or
identifier == "Inline"):
@@ -1780,10 +1794,16 @@ class IDLNamespace(IDLInterfaceOrNamespace):
if not attr.hasValue():
raise WebIDLError("[%s] must have a value" % identifier,
[attr.location])
- elif identifier == "ProtoObjectHack":
+ elif (identifier == "ProtoObjectHack" or
+ identifier == "ChromeOnly"):
if not attr.noArguments():
raise WebIDLError("[%s] must not have arguments" % identifier,
[attr.location])
+ elif identifier == "Pref":
+ # Known extended attributes that take a string value
+ if not attr.hasValue():
+ raise WebIDLError("[%s] must have a value" % identifier,
+ [attr.location])
else:
raise WebIDLError("Unknown extended attribute %s on namespace" %
identifier,
@@ -3581,6 +3601,11 @@ class IDLInterfaceMember(IDLObjectWithIdentifier, IDLExposureMixins):
[self.location])
self.aliases.append(alias)
+ def _addBindingAlias(self, bindingAlias):
+ if bindingAlias in self.bindingAliases:
+ raise WebIDLError("Duplicate [BindingAlias=%s] on attribute" % bindingAlias,
+ [self.location])
+ self.bindingAliases.append(bindingAlias)
class IDLMaplikeOrSetlikeOrIterableBase(IDLInterfaceMember):
@@ -3701,6 +3726,11 @@ class IDLMaplikeOrSetlikeOrIterableBase(IDLInterfaceMember):
if isIteratorAlias:
method.addExtendedAttributes(
[IDLExtendedAttribute(self.location, ("Alias", "@@iterator"))])
+ # Methods generated for iterables should be enumerable, but the ones for
+ # maplike/setlike should not be.
+ if not self.isIterable():
+ method.addExtendedAttributes(
+ [IDLExtendedAttribute(self.location, ("NonEnumerable",))])
members.append(method)
def resolve(self, parentScope):
@@ -3824,11 +3854,15 @@ class IDLMaplikeOrSetlike(IDLMaplikeOrSetlikeOrIterableBase):
specification during parsing.
"""
# Both maplike and setlike have a size attribute
- members.append(IDLAttribute(self.location,
- IDLUnresolvedIdentifier(BuiltinLocation("<auto-generated-identifier>"), "size"),
- BuiltinTypes[IDLBuiltinType.Types.unsigned_long],
- True,
- maplikeOrSetlike=self))
+ sizeAttr = IDLAttribute(self.location,
+ IDLUnresolvedIdentifier(BuiltinLocation("<auto-generated-identifier>"), "size"),
+ BuiltinTypes[IDLBuiltinType.Types.unsigned_long],
+ True,
+ maplikeOrSetlike=self)
+ # This should be non-enumerable.
+ sizeAttr.addExtendedAttributes(
+ [IDLExtendedAttribute(self.location, ("NonEnumerable",))])
+ members.append(sizeAttr)
self.reserved_ro_names = ["size"]
self.disallowedMemberNames.append("size")
@@ -3964,7 +3998,9 @@ class IDLConst(IDLInterfaceMember):
elif (identifier == "Pref" or
identifier == "ChromeOnly" or
identifier == "Func" or
- identifier == "SecureContext"):
+ identifier == "SecureContext" or
+ identifier == "NonEnumerable" or
+ identifier == "NeedsWindowsUndef"):
# Known attributes that we don't need to do anything with here
pass
else:
@@ -4000,6 +4036,7 @@ class IDLAttribute(IDLInterfaceMember):
self.dependsOn = "Everything"
self.affects = "Everything"
self.navigatorObjectGetter = navigatorObjectGetter
+ self.bindingAliases = []
if static and identifier.name == "prototype":
raise WebIDLError("The identifier of a static attribute must not be 'prototype'",
@@ -4138,11 +4175,17 @@ class IDLAttribute(IDLInterfaceMember):
def handleExtendedAttribute(self, attr):
identifier = attr.identifier()
- if ((identifier == "SetterThrows" or identifier == "SetterCanOOM")
+ if ((identifier == "SetterThrows" or identifier == "SetterCanOOM" or
+ identifier == "SetterNeedsSubjectPrincipal")
and self.readonly):
raise WebIDLError("Readonly attributes must not be flagged as "
"[%s]" % identifier,
[self.location])
+ elif identifier == "BindingAlias":
+ if not attr.hasValue():
+ raise WebIDLError("[BindingAlias] takes an identifier or string",
+ [attr.location])
+ self._addBindingAlias(attr.value())
elif (((identifier == "Throws" or identifier == "GetterThrows" or
identifier == "CanOOM" or identifier == "GetterCanOOM") and
self.getExtendedAttribute("StoreInSlot")) or
@@ -4338,11 +4381,13 @@ class IDLAttribute(IDLInterfaceMember):
identifier == "SecureContext" or
identifier == "Frozen" or
identifier == "NewObject" or
- identifier == "UnsafeInPrerendering" or
identifier == "NeedsSubjectPrincipal" or
+ identifier == "SetterNeedsSubjectPrincipal" or
+ identifier == "GetterNeedsSubjectPrincipal" or
identifier == "NeedsCallerType" or
identifier == "ReturnValueNeedsContainsHack" or
- identifier == "BinaryName"):
+ identifier == "BinaryName" or
+ identifier == "NonEnumerable"):
# Known attributes that we don't need to do anything with here
pass
else:
@@ -4606,7 +4651,6 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
Special = enum(
'Getter',
'Setter',
- 'Creator',
'Deleter',
'LegacyCaller',
base=IDLInterfaceMember.Special
@@ -4619,7 +4663,7 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
)
def __init__(self, location, identifier, returnType, arguments,
- static=False, getter=False, setter=False, creator=False,
+ static=False, getter=False, setter=False,
deleter=False, specialType=NamedOrIndexed.Neither,
legacycaller=False, stringifier=False, jsonifier=False,
maplikeOrSetlikeOrIterable=None, htmlConstructor=False):
@@ -4640,8 +4684,6 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
self._getter = getter
assert isinstance(setter, bool)
self._setter = setter
- assert isinstance(creator, bool)
- self._creator = creator
assert isinstance(deleter, bool)
self._deleter = deleter
assert isinstance(legacycaller, bool)
@@ -4682,7 +4724,7 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
assert not arguments[0].optional and not arguments[0].variadic
assert not self._getter or not overload.returnType.isVoid()
- if self._setter or self._creator:
+ if self._setter:
assert len(self._overloads) == 1
arguments = self._overloads[0].arguments
assert len(arguments) == 2
@@ -4715,9 +4757,6 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
def isSetter(self):
return self._setter
- def isCreator(self):
- return self._creator
-
def isDeleter(self):
return self._deleter
@@ -4750,7 +4789,6 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
def isSpecial(self):
return (self.isGetter() or
self.isSetter() or
- self.isCreator() or
self.isDeleter() or
self.isLegacycaller() or
self.isStringifier() or
@@ -4806,8 +4844,6 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
assert not method.isGetter()
assert not self.isSetter()
assert not method.isSetter()
- assert not self.isCreator()
- assert not method.isCreator()
assert not self.isDeleter()
assert not method.isDeleter()
assert not self.isStringifier()
@@ -4984,7 +5020,9 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
if (identifier == "GetterThrows" or
identifier == "SetterThrows" or
identifier == "GetterCanOOM" or
- identifier == "SetterCanOOM"):
+ identifier == "SetterCanOOM" or
+ identifier == "SetterNeedsSubjectPrincipal" or
+ identifier == "GetterNeedsSubjectPrincipal"):
raise WebIDLError("Methods must not be flagged as "
"[%s]" % identifier,
[attr.location, self.location])
@@ -5071,7 +5109,6 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
identifier == "CanOOM" or
identifier == "NewObject" or
identifier == "ChromeOnly" or
- identifier == "UnsafeInPrerendering" or
identifier == "Pref" or
identifier == "Deprecated" or
identifier == "Func" or
@@ -5079,7 +5116,8 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
identifier == "BinaryName" or
identifier == "NeedsSubjectPrincipal" or
identifier == "NeedsCallerType" or
- identifier == "StaticClassOverride"):
+ identifier == "StaticClassOverride" or
+ identifier == "NonEnumerable"):
# Known attributes that we don't need to do anything with here
pass
else:
@@ -5262,7 +5300,6 @@ class Tokenizer(object):
"static": "STATIC",
"getter": "GETTER",
"setter": "SETTER",
- "creator": "CREATOR",
"deleter": "DELETER",
"legacycaller": "LEGACYCALLER",
"optional": "OPTIONAL",
@@ -5977,13 +6014,12 @@ class Parser(Tokenizer):
getter = True if IDLMethod.Special.Getter in p[1] else False
setter = True if IDLMethod.Special.Setter in p[1] else False
- creator = True if IDLMethod.Special.Creator in p[1] else False
deleter = True if IDLMethod.Special.Deleter in p[1] else False
legacycaller = True if IDLMethod.Special.LegacyCaller in p[1] else False
if getter or deleter:
- if setter or creator:
- raise WebIDLError("getter and deleter are incompatible with setter and creator",
+ if setter:
+ raise WebIDLError("getter and deleter are incompatible with setter",
[self.getLocation(p, 1)])
(returnType, identifier, arguments) = p[2]
@@ -6018,10 +6054,9 @@ class Parser(Tokenizer):
if returnType.isVoid():
raise WebIDLError("getter cannot have void return type",
[self.getLocation(p, 2)])
- if setter or creator:
+ if setter:
if len(arguments) != 2:
- raise WebIDLError("%s has wrong number of arguments" %
- ("setter" if setter else "creator"),
+ raise WebIDLError("setter has wrong number of arguments",
[self.getLocation(p, 2)])
argType = arguments[0].type
if argType == BuiltinTypes[IDLBuiltinType.Types.domstring]:
@@ -6029,18 +6064,15 @@ class Parser(Tokenizer):
elif argType == BuiltinTypes[IDLBuiltinType.Types.unsigned_long]:
specialType = IDLMethod.NamedOrIndexed.Indexed
else:
- raise WebIDLError("%s has wrong argument type (must be DOMString or UnsignedLong)" %
- ("setter" if setter else "creator"),
+ raise WebIDLError("settter has wrong argument type (must be DOMString or UnsignedLong)",
[arguments[0].location])
if arguments[0].optional or arguments[0].variadic:
- raise WebIDLError("%s cannot have %s argument" %
- ("setter" if setter else "creator",
- "optional" if arguments[0].optional else "variadic"),
+ raise WebIDLError("setter cannot have %s argument" %
+ ("optional" if arguments[0].optional else "variadic"),
[arguments[0].location])
if arguments[1].optional or arguments[1].variadic:
- raise WebIDLError("%s cannot have %s argument" %
- ("setter" if setter else "creator",
- "optional" if arguments[1].optional else "variadic"),
+ raise WebIDLError("setter cannot have %s argument" %
+ ("optional" if arguments[1].optional else "variadic"),
[arguments[1].location])
if stringifier:
@@ -6053,7 +6085,7 @@ class Parser(Tokenizer):
# identifier might be None. This is only permitted for special methods.
if not identifier:
- if (not getter and not setter and not creator and
+ if (not getter and not setter and
not deleter and not legacycaller and not stringifier):
raise WebIDLError("Identifier required for non-special methods",
[self.getLocation(p, 2)])
@@ -6061,19 +6093,18 @@ class Parser(Tokenizer):
location = BuiltinLocation("<auto-generated-identifier>")
identifier = IDLUnresolvedIdentifier(
location,
- "__%s%s%s%s%s%s%s" %
+ "__%s%s%s%s%s%s" %
("named" if specialType == IDLMethod.NamedOrIndexed.Named else
"indexed" if specialType == IDLMethod.NamedOrIndexed.Indexed else "",
"getter" if getter else "",
"setter" if setter else "",
"deleter" if deleter else "",
- "creator" if creator else "",
"legacycaller" if legacycaller else "",
"stringifier" if stringifier else ""),
allowDoubleUnderscore=True)
method = IDLMethod(self.getLocation(p, 2), identifier, returnType, arguments,
- static=static, getter=getter, setter=setter, creator=creator,
+ static=static, getter=getter, setter=setter,
deleter=deleter, specialType=specialType,
legacycaller=legacycaller, stringifier=stringifier)
p[0] = method
@@ -6149,12 +6180,6 @@ class Parser(Tokenizer):
"""
p[0] = IDLMethod.Special.Setter
- def p_SpecialCreator(self, p):
- """
- Special : CREATOR
- """
- p[0] = IDLMethod.Special.Creator
-
def p_SpecialDeleter(self, p):
"""
Special : DELETER
@@ -6246,7 +6271,6 @@ class Parser(Tokenizer):
| ATTRIBUTE
| CALLBACK
| CONST
- | CREATOR
| DELETER
| DICTIONARY
| ENUM
@@ -6396,7 +6420,6 @@ class Parser(Tokenizer):
| BYTE
| LEGACYCALLER
| CONST
- | CREATOR
| DELETER
| DOUBLE
| EXCEPTION
diff --git a/components/script/dom/bindings/codegen/parser/abstract.patch b/components/script/dom/bindings/codegen/parser/abstract.patch
index a8e2ddcf759..e43d12eb988 100644
--- a/components/script/dom/bindings/codegen/parser/abstract.patch
+++ b/components/script/dom/bindings/codegen/parser/abstract.patch
@@ -1,9 +1,9 @@
--- WebIDL.py
+++ WebIDL.py
-@@ -1416,7 +1416,8 @@
- identifier == "LegacyEventInit" or
- identifier == "ProbablyShortLivingObject" or
+@@ -1744,7 +1744,8 @@
+ identifier == "ProbablyShortLivingWrapper" or
identifier == "LegacyUnenumerableNamedProperties" or
+ identifier == "RunConstructorInCallerCompartment" or
- identifier == "NonOrdinaryGetPrototypeOf"):
+ identifier == "NonOrdinaryGetPrototypeOf" or
+ identifier == "Abstract"):
diff --git a/components/script/dom/bindings/codegen/parser/tests/test_cereactions.py b/components/script/dom/bindings/codegen/parser/tests/test_cereactions.py
index 2f9397d903e..a1e5e78630f 100644
--- a/components/script/dom/bindings/codegen/parser/tests/test_cereactions.py
+++ b/components/script/dom/bindings/codegen/parser/tests/test_cereactions.py
@@ -106,21 +106,6 @@ def WebIDLTest(parser, harness):
try:
parser.parse("""
interface Foo {
- [CEReactions] creator boolean (DOMString name, boolean value);
- };
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw,
- "Should have thrown for [CEReactions] used on a named creator")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- interface Foo {
[CEReactions] legacycaller double compute(double x);
};
""")
diff --git a/components/script/dom/bindings/codegen/parser/tests/test_constructor.py b/components/script/dom/bindings/codegen/parser/tests/test_constructor.py
index 6c68a6c79cf..c722d7bc5c7 100644
--- a/components/script/dom/bindings/codegen/parser/tests/test_constructor.py
+++ b/components/script/dom/bindings/codegen/parser/tests/test_constructor.py
@@ -11,7 +11,7 @@ def WebIDLTest(parser, harness):
harness.check(argument.variadic, variadic, "Argument has the right variadic value")
def checkMethod(method, QName, name, signatures,
- static=True, getter=False, setter=False, creator=False,
+ static=True, getter=False, setter=False,
deleter=False, legacycaller=False, stringifier=False,
chromeOnly=False, htmlConstructor=False):
harness.ok(isinstance(method, WebIDL.IDLMethod),
@@ -24,7 +24,6 @@ def WebIDLTest(parser, harness):
harness.check(method.isStatic(), static, "Method has the correct static value")
harness.check(method.isGetter(), getter, "Method has the correct getter value")
harness.check(method.isSetter(), setter, "Method has the correct setter value")
- harness.check(method.isCreator(), creator, "Method has the correct creator value")
harness.check(method.isDeleter(), deleter, "Method has the correct deleter value")
harness.check(method.isLegacycaller(), legacycaller, "Method has the correct legacycaller value")
harness.check(method.isStringifier(), stringifier, "Method has the correct stringifier value")
diff --git a/components/script/dom/bindings/codegen/parser/tests/test_duplicate_qualifiers.py b/components/script/dom/bindings/codegen/parser/tests/test_duplicate_qualifiers.py
index 799f2e0e0ed..4874b3aafe6 100644
--- a/components/script/dom/bindings/codegen/parser/tests/test_duplicate_qualifiers.py
+++ b/components/script/dom/bindings/codegen/parser/tests/test_duplicate_qualifiers.py
@@ -30,20 +30,6 @@ def WebIDLTest(parser, harness):
threw = False
try:
parser.parse("""
- interface DuplicateQualifiers3 {
- creator creator byte foo(unsigned long index, byte value);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
interface DuplicateQualifiers4 {
deleter deleter byte foo(unsigned long index);
};
@@ -68,17 +54,3 @@ def WebIDLTest(parser, harness):
threw = True
harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- results = parser.parse("""
- interface DuplicateQualifiers6 {
- creator setter creator byte foo(unsigned long index, byte value);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
diff --git a/components/script/dom/bindings/codegen/parser/tests/test_global_extended_attr.py b/components/script/dom/bindings/codegen/parser/tests/test_global_extended_attr.py
index c752cecd298..bc20da40bbe 100644
--- a/components/script/dom/bindings/codegen/parser/tests/test_global_extended_attr.py
+++ b/components/script/dom/bindings/codegen/parser/tests/test_global_extended_attr.py
@@ -39,24 +39,6 @@ def WebIDLTest(parser, harness):
[Global]
interface Foo {
getter any(DOMString name);
- creator void(DOMString name, any arg);
- };
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw,
- "Should have thrown for [Global] used on an interface with a "
- "named creator")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- [Global]
- interface Foo {
- getter any(DOMString name);
deleter void(DOMString name);
};
""")
diff --git a/components/script/dom/bindings/codegen/parser/tests/test_method.py b/components/script/dom/bindings/codegen/parser/tests/test_method.py
index cf7f1b40d76..29e6d6b25b7 100644
--- a/components/script/dom/bindings/codegen/parser/tests/test_method.py
+++ b/components/script/dom/bindings/codegen/parser/tests/test_method.py
@@ -41,7 +41,7 @@ def WebIDLTest(parser, harness):
harness.check(argument.variadic, variadic, "Argument has the right variadic value")
def checkMethod(method, QName, name, signatures,
- static=False, getter=False, setter=False, creator=False,
+ static=False, getter=False, setter=False,
deleter=False, legacycaller=False, stringifier=False):
harness.ok(isinstance(method, WebIDL.IDLMethod),
"Should be an IDLMethod")
@@ -53,7 +53,6 @@ def WebIDLTest(parser, harness):
harness.check(method.isStatic(), static, "Method has the correct static value")
harness.check(method.isGetter(), getter, "Method has the correct getter value")
harness.check(method.isSetter(), setter, "Method has the correct setter value")
- harness.check(method.isCreator(), creator, "Method has the correct creator value")
harness.check(method.isDeleter(), deleter, "Method has the correct deleter value")
harness.check(method.isLegacycaller(), legacycaller, "Method has the correct legacycaller value")
harness.check(method.isStringifier(), stringifier, "Method has the correct stringifier value")
diff --git a/components/script/dom/bindings/codegen/parser/tests/test_special_method_signature_mismatch.py b/components/script/dom/bindings/codegen/parser/tests/test_special_method_signature_mismatch.py
index 5ea1743d36a..52cfcb96817 100644
--- a/components/script/dom/bindings/codegen/parser/tests/test_special_method_signature_mismatch.py
+++ b/components/script/dom/bindings/codegen/parser/tests/test_special_method_signature_mismatch.py
@@ -222,73 +222,3 @@ def WebIDLTest(parser, harness):
threw = True
harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodSignatureMismatch20 {
- creator long long foo(long index, long long value);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodSignatureMismatch22 {
- creator boolean foo(unsigned long index, boolean value, long long extraArg);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodSignatureMismatch23 {
- creator boolean foo(unsigned long index, boolean... value);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodSignatureMismatch24 {
- creator boolean foo(unsigned long index, optional boolean value);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodSignatureMismatch25 {
- creator boolean foo();
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
diff --git a/components/script/dom/bindings/codegen/parser/tests/test_special_methods.py b/components/script/dom/bindings/codegen/parser/tests/test_special_methods.py
index 1e3a95b9bc2..7f911733b62 100644
--- a/components/script/dom/bindings/codegen/parser/tests/test_special_methods.py
+++ b/components/script/dom/bindings/codegen/parser/tests/test_special_methods.py
@@ -5,25 +5,21 @@ def WebIDLTest(parser, harness):
interface SpecialMethods {
getter long long (unsigned long index);
setter long long (unsigned long index, long long value);
- creator long long (unsigned long index, long long value);
getter boolean (DOMString name);
setter boolean (DOMString name, boolean value);
- creator boolean (DOMString name, boolean value);
deleter boolean (DOMString name);
readonly attribute unsigned long length;
};
interface SpecialMethodsCombination {
- setter creator long long (unsigned long index, long long value);
getter deleter boolean (DOMString name);
- setter creator boolean (DOMString name, boolean value);
};
""")
results = parser.finish()
def checkMethod(method, QName, name,
- static=False, getter=False, setter=False, creator=False,
+ static=False, getter=False, setter=False,
deleter=False, legacycaller=False, stringifier=False):
harness.ok(isinstance(method, WebIDL.IDLMethod),
"Should be an IDLMethod")
@@ -32,7 +28,6 @@ def WebIDLTest(parser, harness):
harness.check(method.isStatic(), static, "Method has the correct static value")
harness.check(method.isGetter(), getter, "Method has the correct getter value")
harness.check(method.isSetter(), setter, "Method has the correct setter value")
- harness.check(method.isCreator(), creator, "Method has the correct creator value")
harness.check(method.isDeleter(), deleter, "Method has the correct deleter value")
harness.check(method.isLegacycaller(), legacycaller, "Method has the correct legacycaller value")
harness.check(method.isStringifier(), stringifier, "Method has the correct stringifier value")
@@ -40,32 +35,24 @@ def WebIDLTest(parser, harness):
harness.check(len(results), 2, "Expect 2 interfaces")
iface = results[0]
- harness.check(len(iface.members), 8, "Expect 8 members")
+ harness.check(len(iface.members), 6, "Expect 6 members")
checkMethod(iface.members[0], "::SpecialMethods::__indexedgetter", "__indexedgetter",
getter=True)
checkMethod(iface.members[1], "::SpecialMethods::__indexedsetter", "__indexedsetter",
setter=True)
- checkMethod(iface.members[2], "::SpecialMethods::__indexedcreator", "__indexedcreator",
- creator=True)
- checkMethod(iface.members[3], "::SpecialMethods::__namedgetter", "__namedgetter",
+ checkMethod(iface.members[2], "::SpecialMethods::__namedgetter", "__namedgetter",
getter=True)
- checkMethod(iface.members[4], "::SpecialMethods::__namedsetter", "__namedsetter",
+ checkMethod(iface.members[3], "::SpecialMethods::__namedsetter", "__namedsetter",
setter=True)
- checkMethod(iface.members[5], "::SpecialMethods::__namedcreator", "__namedcreator",
- creator=True)
- checkMethod(iface.members[6], "::SpecialMethods::__nameddeleter", "__nameddeleter",
+ checkMethod(iface.members[4], "::SpecialMethods::__nameddeleter", "__nameddeleter",
deleter=True)
iface = results[1]
- harness.check(len(iface.members), 3, "Expect 3 members")
+ harness.check(len(iface.members), 1, "Expect 1 member")
- checkMethod(iface.members[0], "::SpecialMethodsCombination::__indexedsettercreator",
- "__indexedsettercreator", setter=True, creator=True)
- checkMethod(iface.members[1], "::SpecialMethodsCombination::__namedgetterdeleter",
+ checkMethod(iface.members[0], "::SpecialMethodsCombination::__namedgetterdeleter",
"__namedgetterdeleter", getter=True, deleter=True)
- checkMethod(iface.members[2], "::SpecialMethodsCombination::__namedsettercreator",
- "__namedsettercreator", setter=True, creator=True)
parser = parser.reset();
diff --git a/components/script/dom/bindings/codegen/parser/tests/test_special_methods_uniqueness.py b/components/script/dom/bindings/codegen/parser/tests/test_special_methods_uniqueness.py
index 42e2c5bb71b..9bf3d903463 100644
--- a/components/script/dom/bindings/codegen/parser/tests/test_special_methods_uniqueness.py
+++ b/components/script/dom/bindings/codegen/parser/tests/test_special_methods_uniqueness.py
@@ -35,23 +35,8 @@ def WebIDLTest(parser, harness):
try:
parser.parse("""
interface SpecialMethodUniqueness1 {
- setter creator boolean (DOMString name);
- creator boolean (DOMString name);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodUniqueness1 {
setter boolean (DOMString name);
- creator setter boolean (DOMString name);
+ setter boolean (DOMString name);
};
""")