Bug 1578455. Allow Web IDL operation arguments named "constructor". r=edgar

Differential Revision: https://phabricator.services.mozilla.com/D44505

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Boris Zbarsky 2019-09-04 19:44:29 +00:00
Родитель 770e0fc0d2
Коммит 7a49cd3dd7
3 изменённых файлов: 24 добавлений и 3 удалений

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

@ -6729,7 +6729,9 @@ class Parser(Tokenizer):
"""
t = p[2]
assert isinstance(t, IDLType)
identifier = IDLUnresolvedIdentifier(self.getLocation(p, 3), p[3])
# Arg names can be reserved identifiers
identifier = IDLUnresolvedIdentifier(self.getLocation(p, 3), p[3],
allowForbidden=True)
defaultValue = p[4]
@ -6746,7 +6748,9 @@ class Parser(Tokenizer):
"""
t = p[1]
assert isinstance(t, IDLType)
identifier = IDLUnresolvedIdentifier(self.getLocation(p, 3), p[3])
# Arg names can be reserved identifiers
identifier = IDLUnresolvedIdentifier(self.getLocation(p, 3), p[3],
allowForbidden=True)
variadic = p[2]

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

@ -0,0 +1,17 @@
def WebIDLTest(parser, harness):
parser.parse("""
interface Foo {
void foo(object constructor);
};
""")
results = parser.finish()
harness.check(len(results), 1, "Should have an interface");
iface = results[0];
harness.check(len(iface.members), 1, "Should have an operation");
operation = iface.members[0];
harness.check(len(operation.signatures()), 1, "Should have one signature");
(retval, args) = operation.signatures()[0];
harness.check(len(args), 1, "Should have an argument");
harness.check(args[0].identifier.name, "constructor",
"Should have an identifier named 'constructor'");

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

@ -5,7 +5,7 @@
// https://html.spec.whatwg.org/#dom-window-customelements
interface CustomElementRegistry {
[CEReactions, Throws, UseCounter]
void define(DOMString name, CustomElementConstructor functionConstructor,
void define(DOMString name, CustomElementConstructor constructor,
optional ElementDefinitionOptions options = {});
[ChromeOnly, Throws]
void setElementCreationCallback(DOMString name, CustomElementCreationCallback callback);