Migrate to new constructor operation syntax

This commit is contained in:
Kagami Sascha Rosylight 2019-10-02 21:45:01 +09:00
parent 9706cd497d
commit 9ce82ea1ae
103 changed files with 659 additions and 413 deletions

View file

@ -554,9 +554,6 @@ class IDLExternalInterface(IDLObjectWithIdentifier, IDLExposureMixins):
def hasProbablyShortLivingWrapper(self): def hasProbablyShortLivingWrapper(self):
return False return False
def isNavigatorProperty(self):
return False
def isSerializable(self): def isSerializable(self):
return False return False
@ -611,7 +608,7 @@ class IDLPartialInterfaceOrNamespace(IDLObject):
for attr in attrs: for attr in attrs:
identifier = attr.identifier() identifier = attr.identifier()
if identifier in ["Constructor", "NamedConstructor"]: if identifier == "NamedConstructor":
self.propagatedExtendedAttrs.append(attr) self.propagatedExtendedAttrs.append(attr)
elif identifier == "SecureContext": elif identifier == "SecureContext":
self._haveSecureContextExtendedAttribute = True self._haveSecureContextExtendedAttribute = True
@ -737,7 +734,7 @@ class IDLInterfaceOrInterfaceMixinOrNamespace(IDLObjectWithScope, IDLExposureMix
self.location = location self.location = location
# Put the new members at the beginning # Put the new members at the beginning
self.members = members + self.members self.members = members + self.members
def addPartial(self, partial): def addPartial(self, partial):
assert self.identifier.name == partial.identifier.name assert self.identifier.name == partial.identifier.name
self._partials.append(partial) self._partials.append(partial)
@ -790,7 +787,7 @@ class IDLInterfaceMixin(IDLInterfaceOrInterfaceMixinOrNamespace):
def __str__(self): def __str__(self):
return "Interface mixin '%s'" % self.identifier.name return "Interface mixin '%s'" % self.identifier.name
def finish(self, scope): def finish(self, scope):
if self._finished: if self._finished:
return return
@ -969,7 +966,11 @@ class IDLInterfaceOrNamespace(IDLInterfaceOrInterfaceMixinOrNamespace):
(self.identifier.name, (self.identifier.name,
self.parent.identifier.name), self.parent.identifier.name),
[self.location]) [self.location])
assert not parent or isinstance(parent, IDLInterface) if parent and not isinstance(parent, IDLInterface):
raise WebIDLError("%s inherits from %s which is not an interface " %
(self.identifier.name,
self.parent.identifier.name),
[self.location, parent.location])
self.parent = parent self.parent = parent
@ -1076,11 +1077,34 @@ class IDLInterfaceOrNamespace(IDLInterfaceOrInterfaceMixinOrNamespace):
ctor = self.ctor() ctor = self.ctor()
if ctor is not None: if ctor is not None:
assert len(ctor._exposureGlobalNames) == 0 if not self.hasInterfaceObject():
raise WebIDLError(
"Can't have both a constructor and [NoInterfaceObject]",
[self.location, ctor.location])
if self.globalNames:
raise WebIDLError(
"Can't have both a constructor and [Global]",
[self.location, ctor.location])
assert(len(ctor._exposureGlobalNames) == 0 or
ctor._exposureGlobalNames == self._exposureGlobalNames)
ctor._exposureGlobalNames.update(self._exposureGlobalNames) ctor._exposureGlobalNames.update(self._exposureGlobalNames)
ctor.finish(scope) if ctor in self.members:
# constructor operation.
self.members.remove(ctor)
else:
# extended attribute. This can only happen with
# [HTMLConstructor] and this is the only way we can get into this
# code with len(ctor._exposureGlobalNames) !=
# self._exposureGlobalNames.
ctor.finish(scope)
for ctor in self.namedConstructors: for ctor in self.namedConstructors:
if self.globalNames:
raise WebIDLError(
"Can't have both a named constructor and [Global]",
[self.location, self.namedConstructors.location])
assert len(ctor._exposureGlobalNames) == 0 assert len(ctor._exposureGlobalNames) == 0
ctor._exposureGlobalNames.update(self._exposureGlobalNames) ctor._exposureGlobalNames.update(self._exposureGlobalNames)
ctor.finish(scope) ctor.finish(scope)
@ -1462,12 +1486,11 @@ class IDLInterfaceOrNamespace(IDLInterfaceOrInterfaceMixinOrNamespace):
# Conditional exposure makes no sense for interfaces with no # Conditional exposure makes no sense for interfaces with no
# interface object, unless they're navigator properties. # interface object.
# And SecureContext makes sense for interfaces with no interface object, # And SecureContext makes sense for interfaces with no interface object,
# since it is also propagated to interface members. # since it is also propagated to interface members.
if (self.isExposedConditionally(exclusions=["SecureContext"]) and if (self.isExposedConditionally(exclusions=["SecureContext"]) and
not self.hasInterfaceObject() and not self.hasInterfaceObject()):
not self.isNavigatorProperty()):
raise WebIDLError("Interface with no interface object is " raise WebIDLError("Interface with no interface object is "
"exposed conditionally", "exposed conditionally",
[self.location]) [self.location])
@ -1640,39 +1663,6 @@ class IDLInterfaceOrNamespace(IDLInterfaceOrInterfaceMixinOrNamespace):
current = current.parent current = current.parent
return False return False
def isNavigatorProperty(self):
naviProp = self.getExtendedAttribute("NavigatorProperty")
if not naviProp:
return False
assert len(naviProp) == 1
assert isinstance(naviProp, list)
assert len(naviProp[0]) != 0
return True
def getNavigatorProperty(self):
naviProp = self.getExtendedAttribute("NavigatorProperty")
if not naviProp:
return None
assert len(naviProp) == 1
assert isinstance(naviProp, list)
assert len(naviProp[0]) != 0
conditionExtendedAttributes = self._extendedAttrDict.viewkeys() & IDLInterfaceOrNamespace.conditionExtendedAttributes
attr = IDLAttribute(self.location,
IDLUnresolvedIdentifier(BuiltinLocation("<auto-generated-identifier>"), naviProp[0]),
IDLUnresolvedType(self.location, IDLUnresolvedIdentifier(self.location, self.identifier.name)),
True,
extendedAttrDict={ a: self._extendedAttrDict[a] for a in conditionExtendedAttributes },
navigatorObjectGetter=True)
attr._exposureGlobalNames = self._exposureGlobalNames
# We're abusing Constant a little bit here, because we need Cached. The
# getter will create a new object every time, but we're never going to
# clear the cached value.
extendedAttrs = [ IDLExtendedAttribute(self.location, ("Throws", )),
IDLExtendedAttribute(self.location, ("Cached", )),
IDLExtendedAttribute(self.location, ("Constant", )) ]
attr.addExtendedAttributes(extendedAttrs)
return attr
def hasChildInterfaces(self): def hasChildInterfaces(self):
return self._hasChildInterfaces return self._hasChildInterfaces
@ -1731,67 +1721,39 @@ class IDLInterface(IDLInterfaceOrNamespace):
raise WebIDLError("[NoInterfaceObject] must take no arguments", raise WebIDLError("[NoInterfaceObject] must take no arguments",
[attr.location]) [attr.location])
if self.ctor():
raise WebIDLError("Constructor and NoInterfaceObject are incompatible",
[self.location])
self._noInterfaceObject = True self._noInterfaceObject = True
elif identifier == "Constructor" or identifier == "NamedConstructor" or identifier == "ChromeConstructor" or identifier == "HTMLConstructor": elif identifier == "NamedConstructor" or identifier == "HTMLConstructor":
if identifier == "Constructor" and not self.hasInterfaceObject():
raise WebIDLError(str(identifier) + " and NoInterfaceObject are incompatible",
[self.location])
if identifier == "NamedConstructor" and not attr.hasValue(): if identifier == "NamedConstructor" and not attr.hasValue():
raise WebIDLError("NamedConstructor must either take an identifier or take a named argument list", raise WebIDLError("NamedConstructor must either take an identifier or take a named argument list",
[attr.location]) [attr.location])
if identifier == "ChromeConstructor" and not self.hasInterfaceObject():
raise WebIDLError(str(identifier) + " and NoInterfaceObject are incompatible",
[self.location])
if identifier == "HTMLConstructor": if identifier == "HTMLConstructor":
if not self.hasInterfaceObject():
raise WebIDLError(str(identifier) + " and NoInterfaceObject are incompatible",
[self.location])
if not attr.noArguments(): if not attr.noArguments():
raise WebIDLError(str(identifier) + " must take no arguments", raise WebIDLError(str(identifier) + " must take no arguments",
[attr.location]) [attr.location])
if self.globalNames:
raise WebIDLError("[%s] must not be specified together with "
"[Global]" % identifier,
[self.location, attr.location])
args = attr.args() if attr.hasArgs() else [] args = attr.args() if attr.hasArgs() else []
retType = IDLWrapperType(self.location, self) retType = IDLWrapperType(self.location, self)
if identifier == "Constructor" or identifier == "ChromeConstructor" or identifier == "HTMLConstructor": if identifier == "HTMLConstructor":
name = "constructor" name = "constructor"
allowForbidden = True allowForbidden = True
else: else:
name = attr.value() name = attr.value()
allowForbidden = False allowForbidden = False
methodIdentifier = IDLUnresolvedIdentifier(self.location, name, method = IDLConstructor(
allowForbidden=allowForbidden) attr.location, args, name,
htmlConstructor=(identifier == "HTMLConstructor"))
method.reallyInit(self)
method = IDLMethod(self.location, methodIdentifier, retType, # Are always assumed to be able to throw (since there's no way to
args, static=True, # indicate otherwise).
htmlConstructor=(identifier == "HTMLConstructor"))
# Constructors are always NewObject and are always
# assumed to be able to throw (since there's no way to
# indicate otherwise) and never have any other
# extended attributes.
method.addExtendedAttributes( method.addExtendedAttributes(
[IDLExtendedAttribute(self.location, ("NewObject",)), [IDLExtendedAttribute(self.location, ("Throws",))])
IDLExtendedAttribute(self.location, ("Throws",))])
if identifier == "ChromeConstructor":
method.addExtendedAttributes(
[IDLExtendedAttribute(self.location, ("ChromeOnly",))])
if identifier == "Constructor" or identifier == "ChromeConstructor" or identifier == "HTMLConstructor": if identifier == "HTMLConstructor":
method.resolve(self) method.resolve(self)
else: else:
# We need to detect conflicts for NamedConstructors across # We need to detect conflicts for NamedConstructors across
@ -1823,10 +1785,6 @@ class IDLInterface(IDLInterfaceOrNamespace):
"an interface with inherited interfaces", "an interface with inherited interfaces",
[attr.location, self.location]) [attr.location, self.location])
elif identifier == "Global": elif identifier == "Global":
if self.ctor() or self.namedConstructors:
raise WebIDLError("[Global] cannot be specified on an "
"interface with a constructor",
[attr.location, self.location]);
if attr.hasValue(): if attr.hasValue():
self.globalNames = [attr.value()] self.globalNames = [attr.value()]
elif attr.hasArgs(): elif attr.hasArgs():
@ -1896,7 +1854,6 @@ class IDLInterface(IDLInterfaceOrNamespace):
elif (identifier == "Pref" or elif (identifier == "Pref" or
identifier == "JSImplementation" or identifier == "JSImplementation" or
identifier == "HeaderFile" or identifier == "HeaderFile" or
identifier == "NavigatorProperty" or
identifier == "Func" or identifier == "Func" or
identifier == "Deprecated"): identifier == "Deprecated"):
# Known extended attributes that take a string value # Known extended attributes that take a string value
@ -1923,6 +1880,17 @@ class IDLInterface(IDLInterfaceOrNamespace):
def isSerializable(self): def isSerializable(self):
return self.getExtendedAttribute("Serializable") return self.getExtendedAttribute("Serializable")
def setNonPartial(self, location, parent, members):
# Before we do anything else, finish initializing any constructors that
# might be in "members", so we don't have partially-initialized objects
# hanging around. We couldn't do it before now because we needed to have
# to have the IDLInterface on hand to properly set the return type.
for member in members:
if isinstance(member, IDLConstructor):
member.reallyInit(self)
IDLInterfaceOrNamespace.setNonPartial(self, location, parent, members)
class IDLNamespace(IDLInterfaceOrNamespace): class IDLNamespace(IDLInterfaceOrNamespace):
def __init__(self, location, parentScope, name, members, isKnownNonPartial): def __init__(self, location, parentScope, name, members, isKnownNonPartial):
@ -2193,6 +2161,7 @@ class IDLType(IDLObject):
'domstring', 'domstring',
'bytestring', 'bytestring',
'usvstring', 'usvstring',
'jsstring',
'object', 'object',
'date', 'date',
'void', 'void',
@ -2254,6 +2223,9 @@ class IDLType(IDLObject):
def isUSVString(self): def isUSVString(self):
return False return False
def isJSString(self):
return False
def isVoid(self): def isVoid(self):
return self.name == "Void" return self.name == "Void"
@ -2479,6 +2451,9 @@ class IDLNullableType(IDLParametrizedType):
def isUSVString(self): def isUSVString(self):
return self.inner.isUSVString() return self.inner.isUSVString()
def isJSString(self):
return self.inner.isJSString()
def isFloat(self): def isFloat(self):
return self.inner.isFloat() return self.inner.isFloat()
@ -2600,6 +2575,9 @@ class IDLSequenceType(IDLParametrizedType):
def isUSVString(self): def isUSVString(self):
return False return False
def isJSString(self):
return False
def isVoid(self): def isVoid(self):
return False return False
@ -2861,6 +2839,9 @@ class IDLTypedefType(IDLType):
def isUSVString(self): def isUSVString(self):
return self.inner.isUSVString() return self.inner.isUSVString()
def isJSString(self):
return self.inner.isJSString()
def isVoid(self): def isVoid(self):
return self.inner.isVoid() return self.inner.isVoid()
@ -2991,6 +2972,9 @@ class IDLWrapperType(IDLType):
def isUSVString(self): def isUSVString(self):
return False return False
def isJSString(self):
return False
def isVoid(self): def isVoid(self):
return False return False
@ -3190,6 +3174,7 @@ class IDLBuiltinType(IDLType):
'domstring', 'domstring',
'bytestring', 'bytestring',
'usvstring', 'usvstring',
'jsstring',
'object', 'object',
'date', 'date',
'void', 'void',
@ -3227,6 +3212,7 @@ class IDLBuiltinType(IDLType):
Types.domstring: IDLType.Tags.domstring, Types.domstring: IDLType.Tags.domstring,
Types.bytestring: IDLType.Tags.bytestring, Types.bytestring: IDLType.Tags.bytestring,
Types.usvstring: IDLType.Tags.usvstring, Types.usvstring: IDLType.Tags.usvstring,
Types.jsstring: IDLType.Tags.jsstring,
Types.object: IDLType.Tags.object, Types.object: IDLType.Tags.object,
Types.date: IDLType.Tags.date, Types.date: IDLType.Tags.date,
Types.void: IDLType.Tags.void, Types.void: IDLType.Tags.void,
@ -3311,7 +3297,8 @@ class IDLBuiltinType(IDLType):
def isString(self): def isString(self):
return (self._typeTag == IDLBuiltinType.Types.domstring or return (self._typeTag == IDLBuiltinType.Types.domstring or
self._typeTag == IDLBuiltinType.Types.bytestring or self._typeTag == IDLBuiltinType.Types.bytestring or
self._typeTag == IDLBuiltinType.Types.usvstring) self._typeTag == IDLBuiltinType.Types.usvstring or
self._typeTag == IDLBuiltinType.Types.jsstring)
def isByteString(self): def isByteString(self):
return self._typeTag == IDLBuiltinType.Types.bytestring return self._typeTag == IDLBuiltinType.Types.bytestring
@ -3322,6 +3309,9 @@ class IDLBuiltinType(IDLType):
def isUSVString(self): def isUSVString(self):
return self._typeTag == IDLBuiltinType.Types.usvstring return self._typeTag == IDLBuiltinType.Types.usvstring
def isJSString(self):
return self._typeTag == IDLBuiltinType.Types.jsstring
def isInteger(self): def isInteger(self):
return self._typeTag <= IDLBuiltinType.Types.unsigned_long_long return self._typeTag <= IDLBuiltinType.Types.unsigned_long_long
@ -3524,6 +3514,9 @@ BuiltinTypes = {
IDLBuiltinType.Types.usvstring: IDLBuiltinType.Types.usvstring:
IDLBuiltinType(BuiltinLocation("<builtin type>"), "USVString", IDLBuiltinType(BuiltinLocation("<builtin type>"), "USVString",
IDLBuiltinType.Types.usvstring), IDLBuiltinType.Types.usvstring),
IDLBuiltinType.Types.jsstring:
IDLBuiltinType(BuiltinLocation("<builtin type>"), "JSString",
IDLBuiltinType.Types.jsstring),
IDLBuiltinType.Types.object: IDLBuiltinType.Types.object:
IDLBuiltinType(BuiltinLocation("<builtin type>"), "Object", IDLBuiltinType(BuiltinLocation("<builtin type>"), "Object",
IDLBuiltinType.Types.object), IDLBuiltinType.Types.object),
@ -3690,8 +3683,8 @@ class IDLValue(IDLObject):
# TreatNullAsEmpty is a different type for resolution reasons, # TreatNullAsEmpty is a different type for resolution reasons,
# however once you have a value it doesn't matter # however once you have a value it doesn't matter
return self return self
elif self.type.isString() and type.isByteString(): elif self.type.isString() and (type.isByteString() or type.isJSString()):
# Allow ByteStrings to use a default value like DOMString. # Allow ByteStrings and JSStrings to use a default value like DOMString.
# No coercion is required as Codegen.py will handle the # No coercion is required as Codegen.py will handle the
# extra steps. We want to make sure that our string contains # extra steps. We want to make sure that our string contains
# only valid characters, so we check that here. # only valid characters, so we check that here.
@ -4340,7 +4333,7 @@ class IDLConst(IDLInterfaceMember):
class IDLAttribute(IDLInterfaceMember): class IDLAttribute(IDLInterfaceMember):
def __init__(self, location, identifier, type, readonly, inherit=False, def __init__(self, location, identifier, type, readonly, inherit=False,
static=False, stringifier=False, maplikeOrSetlike=None, static=False, stringifier=False, maplikeOrSetlike=None,
extendedAttrDict=None, navigatorObjectGetter=False): extendedAttrDict=None):
IDLInterfaceMember.__init__(self, location, identifier, IDLInterfaceMember.__init__(self, location, identifier,
IDLInterfaceMember.Tags.Attr, IDLInterfaceMember.Tags.Attr,
extendedAttrDict=extendedAttrDict) extendedAttrDict=extendedAttrDict)
@ -4358,7 +4351,6 @@ class IDLAttribute(IDLInterfaceMember):
self.maplikeOrSetlike = maplikeOrSetlike self.maplikeOrSetlike = maplikeOrSetlike
self.dependsOn = "Everything" self.dependsOn = "Everything"
self.affects = "Everything" self.affects = "Everything"
self.navigatorObjectGetter = navigatorObjectGetter
self.bindingAliases = [] self.bindingAliases = []
if static and identifier.name == "prototype": if static and identifier.name == "prototype":
@ -5239,7 +5231,7 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
assert argument.type.isComplete() assert argument.type.isComplete()
if ((argument.type.isDictionary() and if ((argument.type.isDictionary() and
argument.type.inner.canBeEmpty())or argument.type.unroll().inner.canBeEmpty()) or
(argument.type.isUnion() and (argument.type.isUnion() and
argument.type.unroll().hasPossiblyEmptyDictionaryType())): argument.type.unroll().hasPossiblyEmptyDictionaryType())):
# Optional dictionaries and unions containing optional # Optional dictionaries and unions containing optional
@ -5263,12 +5255,16 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
"must have a default value", "must have a default value",
[argument.location]) [argument.location])
# An argument cannot be a Nullable Dictionary # An argument cannot be a nullable dictionary or a
if argument.type.nullable(): # nullable union containing a dictionary.
raise WebIDLError("An argument cannot be a nullable " if (argument.type.nullable() and
"dictionary or nullable union " (argument.type.isDictionary() or
"containing a dictionary", (argument.type.isUnion() and
[argument.location]) argument.type.unroll().hasDictionaryType()))):
raise WebIDLError("An argument cannot be a nullable "
"dictionary or nullable union "
"containing a dictionary",
[argument.location])
# Only the last argument can be variadic # Only the last argument can be variadic
if variadicArgument: if variadicArgument:
@ -5497,6 +5493,52 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
return deps return deps
class IDLConstructor(IDLMethod):
def __init__(self, location, args, name, htmlConstructor=False):
# We can't actually init our IDLMethod yet, because we do not know the
# return type yet. Just save the info we have for now and we will init
# it later.
self._initLocation = location
self._initArgs = args
self._initName = name
self._htmlConstructor = htmlConstructor
self._inited = False
self._initExtendedAttrs = []
def addExtendedAttributes(self, attrs):
if self._inited:
return IDLMethod.addExtendedAttributes(self, attrs)
self._initExtendedAttrs.extend(attrs)
def handleExtendedAttribute(self, attr):
identifier = attr.identifier()
if (identifier == "BinaryName" or
identifier == "ChromeOnly" or
identifier == "NewObject" or
identifier == "SecureContext" or
identifier == "Throws"):
IDLMethod.handleExtendedAttribute(self, attr)
else:
raise WebIDLError("Unknown extended attribute %s on method" % identifier,
[attr.location])
def reallyInit(self, parentInterface):
name = self._initName
location = self._initLocation
identifier = IDLUnresolvedIdentifier(location, name, allowForbidden=True)
retType = IDLWrapperType(parentInterface.location, parentInterface)
IDLMethod.__init__(self, location, identifier, retType, self._initArgs,
static=True, htmlConstructor=self._htmlConstructor)
self._inited = True;
# Propagate through whatever extended attributes we already had
self.addExtendedAttributes(self._initExtendedAttrs)
self._initExtendedAttrs = []
# Constructors are always NewObject. Whether they throw or not is
# indicated by [Throws] annotations in the usual way.
self.addExtendedAttributes(
[IDLExtendedAttribute(self.location, ("NewObject",))])
class IDLImplementsStatement(IDLObject): class IDLImplementsStatement(IDLObject):
def __init__(self, location, implementor, implementee): def __init__(self, location, implementor, implementee):
IDLObject.__init__(self, location) IDLObject.__init__(self, location)
@ -5712,6 +5754,7 @@ class Tokenizer(object):
"DOMString": "DOMSTRING", "DOMString": "DOMSTRING",
"ByteString": "BYTESTRING", "ByteString": "BYTESTRING",
"USVString": "USVSTRING", "USVString": "USVSTRING",
"JSString": "JSSTRING",
"any": "ANY", "any": "ANY",
"boolean": "BOOLEAN", "boolean": "BOOLEAN",
"byte": "BYTE", "byte": "BYTE",
@ -6076,7 +6119,7 @@ class Parser(Tokenizer):
def p_PartialInterfaceRest(self, p): def p_PartialInterfaceRest(self, p):
""" """
PartialInterfaceRest : IDENTIFIER LBRACE InterfaceMembers RBRACE SEMICOLON PartialInterfaceRest : IDENTIFIER LBRACE PartialInterfaceMembers RBRACE SEMICOLON
""" """
location = self.getLocation(p, 1) location = self.getLocation(p, 1)
identifier = IDLUnresolvedIdentifier(location, p[1]) identifier = IDLUnresolvedIdentifier(location, p[1])
@ -6157,12 +6200,42 @@ class Parser(Tokenizer):
def p_InterfaceMember(self, p): def p_InterfaceMember(self, p):
""" """
InterfaceMember : Const InterfaceMember : PartialInterfaceMember
| AttributeOrOperationOrMaplikeOrSetlikeOrIterable | Constructor
""" """
p[0] = p[1] p[0] = p[1]
def p_Constructor(self, p):
"""
Constructor : CONSTRUCTOR LPAREN ArgumentList RPAREN SEMICOLON
"""
p[0] = IDLConstructor(self.getLocation(p, 1), p[3], "constructor")
def p_PartialInterfaceMembers(self, p):
"""
PartialInterfaceMembers : ExtendedAttributeList PartialInterfaceMember PartialInterfaceMembers
"""
p[0] = [p[2]]
assert not p[1] or p[2]
p[2].addExtendedAttributes(p[1])
p[0].extend(p[3])
def p_PartialInterfaceMembersEmpty(self, p):
"""
PartialInterfaceMembers :
"""
p[0] = []
def p_PartialInterfaceMember(self, p):
"""
PartialInterfaceMember : Const
| AttributeOrOperationOrMaplikeOrSetlikeOrIterable
"""
p[0] = p[1]
def p_MixinMembersEmpty(self, p): def p_MixinMembersEmpty(self, p):
""" """
MixinMembers : MixinMembers :
@ -6778,7 +6851,9 @@ class Parser(Tokenizer):
""" """
t = p[2] t = p[2]
assert isinstance(t, IDLType) 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] defaultValue = p[4]
@ -6795,7 +6870,9 @@ class Parser(Tokenizer):
""" """
t = p[1] t = p[1]
assert isinstance(t, IDLType) 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] variadic = p[2]
@ -6934,6 +7011,7 @@ class Parser(Tokenizer):
| DOMSTRING | DOMSTRING
| BYTESTRING | BYTESTRING
| USVSTRING | USVSTRING
| JSSTRING
| ANY | ANY
| ATTRIBUTE | ATTRIBUTE
| BOOLEAN | BOOLEAN
@ -7216,6 +7294,12 @@ class Parser(Tokenizer):
""" """
p[0] = IDLBuiltinType.Types.usvstring p[0] = IDLBuiltinType.Types.usvstring
def p_BuiltinStringTypeJSString(self, p):
"""
BuiltinStringType : JSSTRING
"""
p[0] = IDLBuiltinType.Types.jsstring
def p_UnsignedIntegerTypeUnsigned(self, p): def p_UnsignedIntegerTypeUnsigned(self, p):
""" """
UnsignedIntegerType : UNSIGNED IntegerType UnsignedIntegerType : UNSIGNED IntegerType
@ -7443,23 +7527,9 @@ class Parser(Tokenizer):
for p in self._productions: for p in self._productions:
if isinstance(p, IDLInterface): if isinstance(p, IDLInterface):
interfaceStatements.append(p) interfaceStatements.append(p)
if p.identifier.name == "Navigator":
navigatorInterface = p
iterableIteratorIface = None iterableIteratorIface = None
for iface in interfaceStatements: for iface in interfaceStatements:
navigatorProperty = iface.getNavigatorProperty()
if navigatorProperty:
# We're generating a partial interface to add a readonly
# property to the Navigator interface for every interface
# annotated with NavigatorProperty.
partialInterface = IDLPartialInterfaceOrNamespace(
iface.location,
IDLUnresolvedIdentifier(iface.location, "Navigator"),
[ navigatorProperty ],
navigatorInterface)
self._productions.append(partialInterface)
iterable = None iterable = None
# We haven't run finish() on the interface yet, so we don't know # We haven't run finish() on the interface yet, so we don't know
# whether our interface is maplike/setlike/iterable or not. This # whether our interface is maplike/setlike/iterable or not. This

View file

@ -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'");

View file

@ -205,6 +205,18 @@ def WebIDLTest(parser, harness):
harness.ok(threw, "Should not allow [TreatNullAs] on long") harness.ok(threw, "Should not allow [TreatNullAs] on long")
parser = parser.reset()
threw = False
try:
parser.parse("""
typedef [TreatNullAs=EmptyString] JSString Foo;
""")
parser.finish()
except:
threw = True
harness.ok(threw, "Should not allow [TreatNullAs] on JSString")
parser = parser.reset() parser = parser.reset()
threw = False threw = False
try: try:

View file

@ -43,45 +43,55 @@ def WebIDLTest(parser, harness):
(QName, name, type, optional, variadic) = expectedArgs[i] (QName, name, type, optional, variadic) = expectedArgs[i]
checkArgument(gotArgs[i], QName, name, type, optional, variadic) checkArgument(gotArgs[i], QName, name, type, optional, variadic)
def checkResults(results):
harness.check(len(results), 3, "Should be three productions")
harness.ok(isinstance(results[0], WebIDL.IDLInterface),
"Should be an IDLInterface")
harness.ok(isinstance(results[1], WebIDL.IDLInterface),
"Should be an IDLInterface")
harness.ok(isinstance(results[2], WebIDL.IDLInterface),
"Should be an IDLInterface")
checkMethod(results[0].ctor(), "::TestConstructorNoArgs::constructor",
"constructor", [("TestConstructorNoArgs (Wrapper)", [])])
harness.check(len(results[0].members), 0,
"TestConstructorNoArgs should not have members")
checkMethod(results[1].ctor(), "::TestConstructorWithArgs::constructor",
"constructor",
[("TestConstructorWithArgs (Wrapper)",
[("::TestConstructorWithArgs::constructor::name", "name", "String", False, False)])])
harness.check(len(results[1].members), 0,
"TestConstructorWithArgs should not have members")
checkMethod(results[2].ctor(), "::TestConstructorOverloads::constructor",
"constructor",
[("TestConstructorOverloads (Wrapper)",
[("::TestConstructorOverloads::constructor::foo", "foo", "Object", False, False)]),
("TestConstructorOverloads (Wrapper)",
[("::TestConstructorOverloads::constructor::bar", "bar", "Boolean", False, False)])])
harness.check(len(results[2].members), 0,
"TestConstructorOverloads should not have members")
parser.parse(""" parser.parse("""
[Constructor]
interface TestConstructorNoArgs { interface TestConstructorNoArgs {
constructor();
}; };
[Constructor(DOMString name)]
interface TestConstructorWithArgs { interface TestConstructorWithArgs {
constructor(DOMString name);
}; };
[Constructor(object foo), Constructor(boolean bar)]
interface TestConstructorOverloads { interface TestConstructorOverloads {
constructor(object foo);
constructor(boolean bar);
}; };
""") """)
results = parser.finish() results = parser.finish()
harness.check(len(results), 3, "Should be three productions") checkResults(results)
harness.ok(isinstance(results[0], WebIDL.IDLInterface),
"Should be an IDLInterface")
harness.ok(isinstance(results[1], WebIDL.IDLInterface),
"Should be an IDLInterface")
harness.ok(isinstance(results[2], WebIDL.IDLInterface),
"Should be an IDLInterface")
checkMethod(results[0].ctor(), "::TestConstructorNoArgs::constructor",
"constructor", [("TestConstructorNoArgs (Wrapper)", [])])
checkMethod(results[1].ctor(), "::TestConstructorWithArgs::constructor",
"constructor",
[("TestConstructorWithArgs (Wrapper)",
[("::TestConstructorWithArgs::constructor::name", "name", "String", False, False)])])
checkMethod(results[2].ctor(), "::TestConstructorOverloads::constructor",
"constructor",
[("TestConstructorOverloads (Wrapper)",
[("::TestConstructorOverloads::constructor::foo", "foo", "Object", False, False)]),
("TestConstructorOverloads (Wrapper)",
[("::TestConstructorOverloads::constructor::bar", "bar", "Boolean", False, False)])])
parser = parser.reset() parser = parser.reset()
parser.parse(""" parser.parse("""
[ChromeConstructor()] interface TestChromeOnlyConstructor {
interface TestChromeConstructor { [ChromeOnly] constructor();
}; };
""") """)
results = parser.finish() results = parser.finish()
@ -89,8 +99,8 @@ def WebIDLTest(parser, harness):
harness.ok(isinstance(results[0], WebIDL.IDLInterface), harness.ok(isinstance(results[0], WebIDL.IDLInterface),
"Should be an IDLInterface") "Should be an IDLInterface")
checkMethod(results[0].ctor(), "::TestChromeConstructor::constructor", checkMethod(results[0].ctor(), "::TestChromeOnlyConstructor::constructor",
"constructor", [("TestChromeConstructor (Wrapper)", [])], "constructor", [("TestChromeOnlyConstructor (Wrapper)", [])],
chromeOnly=True) chromeOnly=True)
parser = parser.reset() parser = parser.reset()
@ -112,16 +122,16 @@ def WebIDLTest(parser, harness):
threw = False threw = False
try: try:
parser.parse(""" parser.parse("""
[Constructor(), interface TestChromeOnlyConstructor {
ChromeConstructor(DOMString a)] constructor()
interface TestChromeConstructor { [ChromeOnly] constructor(DOMString a);
}; };
""") """)
results = parser.finish() results = parser.finish()
except: except:
threw = True threw = True
harness.ok(threw, "Can't have both a Constructor and a ChromeConstructor") harness.ok(threw, "Can't have both a constructor and a ChromeOnly constructor")
# Test HTMLConstructor with argument # Test HTMLConstructor with argument
parser = parser.reset() parser = parser.reset()
@ -153,120 +163,197 @@ def WebIDLTest(parser, harness):
harness.ok(threw, "HTMLConstructor can't be used on a callback interface") harness.ok(threw, "HTMLConstructor can't be used on a callback interface")
# Test HTMLConstructor and Constructor # Test HTMLConstructor and constructor operation
parser = parser.reset() parser = parser.reset()
threw = False threw = False
try: try:
parser.parse(""" parser.parse("""
[Constructor, [HTMLConstructor]
HTMLConstructor]
interface TestHTMLConstructorAndConstructor { interface TestHTMLConstructorAndConstructor {
constructor();
}; };
""") """)
results = parser.finish() results = parser.finish()
except: except:
threw = True threw = True
harness.ok(threw, "Can't have both a Constructor and a HTMLConstructor") harness.ok(threw, "Can't have both a constructor and a HTMLConstructor")
parser = parser.reset() parser = parser.reset()
threw = False threw = False
try: try:
parser.parse(""" parser.parse("""
[HTMLConstructor, [HTMLConstructor]
Constructor]
interface TestHTMLConstructorAndConstructor { interface TestHTMLConstructorAndConstructor {
[Throws]
constructor();
}; };
""") """)
results = parser.finish() results = parser.finish()
except: except:
threw = True threw = True
harness.ok(threw, "Can't have both a HTMLConstructor and a Constructor") harness.ok(threw,
"Can't have both a throwing constructor and a HTMLConstructor")
parser = parser.reset() parser = parser.reset()
threw = False threw = False
try: try:
parser.parse(""" parser.parse("""
[HTMLConstructor, [HTMLConstructor]
Constructor(DOMString a)]
interface TestHTMLConstructorAndConstructor { interface TestHTMLConstructorAndConstructor {
constructor(DOMString a);
}; };
""") """)
results = parser.finish()
except: except:
threw = True threw = True
harness.ok(threw, "Can't have both a HTMLConstructor and a Constructor") harness.ok(threw,
"Can't have both a HTMLConstructor and a constructor operation")
parser = parser.reset() parser = parser.reset()
threw = False threw = False
try: try:
parser.parse(""" parser.parse("""
[Constructor(DOMString a), [HTMLConstructor]
HTMLConstructor]
interface TestHTMLConstructorAndConstructor { interface TestHTMLConstructorAndConstructor {
}; [Throws]
""") constructor(DOMString a);
except:
threw = True
harness.ok(threw, "Can't have both a HTMLConstructor and a Constructor")
# Test HTMLConstructor and ChromeConstructor
parser = parser.reset()
threw = False
try:
parser.parse("""
[ChromeConstructor,
HTMLConstructor]
interface TestHTMLConstructorAndChromeConstructor {
}; };
""") """)
results = parser.finish() results = parser.finish()
except: except:
threw = True threw = True
harness.ok(threw, "Can't have both a HTMLConstructor and a ChromeConstructor") harness.ok(threw,
"Can't have both a HTMLConstructor and a throwing constructor "
"operation")
# Test HTMLConstructor and [ChromeOnly] constructor operation
parser = parser.reset() parser = parser.reset()
threw = False threw = False
try: try:
parser.parse(""" parser.parse("""
[HTMLConstructor, [HTMLConstructor]
ChromeConstructor] interface TestHTMLConstructorAndConstructor {
interface TestHTMLConstructorAndChromeConstructor { [ChromeOnly]
constructor();
}; };
""") """)
results = parser.finish() results = parser.finish()
except: except:
threw = True threw = True
harness.ok(threw, "Can't have both a HTMLConstructor and a ChromeConstructor") harness.ok(threw,
"Can't have both a ChromeOnly constructor and a HTMLConstructor")
parser = parser.reset() parser = parser.reset()
threw = False threw = False
try: try:
parser.parse(""" parser.parse("""
[ChromeConstructor(DOMString a), [HTMLConstructor]
HTMLConstructor] interface TestHTMLConstructorAndConstructor {
interface TestHTMLConstructorAndChromeConstructor { [Throws, ChromeOnly]
constructor();
}; };
""") """)
results = parser.finish() results = parser.finish()
except: except:
threw = True threw = True
harness.ok(threw,
"Can't have both a throwing chromeonly constructor and a "
"HTMLConstructor")
parser = parser.reset() parser = parser.reset()
threw = False threw = False
try: try:
parser.parse(""" parser.parse("""
[HTMLConstructor, [HTMLConstructor]
ChromeConstructor(DOMString a)] interface TestHTMLConstructorAndConstructor {
interface TestHTMLConstructorAndChromeConstructor { [ChromeOnly]
constructor(DOMString a);
}; };
""") """)
results = parser.finish() results = parser.finish()
except: except:
threw = True threw = True
harness.ok(threw, "Can't have both a HTMLConstructor and a ChromeConstructor") harness.ok(threw,
"Can't have both a HTMLConstructor and a chromeonly constructor "
"operation")
parser = parser.reset()
threw = False
try:
parser.parse("""
[HTMLConstructor]
interface TestHTMLConstructorAndConstructor {
[Throws, ChromeOnly]
constructor(DOMString a);
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw,
"Can't have both a HTMLConstructor and a throwing chromeonly "
"constructor operation")
parser = parser.reset()
threw = False
try:
parser.parse("""
[NoInterfaceObject]
interface InterfaceWithoutInterfaceObject {
constructor();
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw,
"Can't have a constructor operation on a [NoInterfaceObject] "
"interface")
parser = parser.reset()
threw = False
try:
parser.parse("""
interface InterfaceWithPartial {
};
partial interface InterfaceWithPartial {
constructor();
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw,
"Can't have a constructor operation on a partial interface")
parser = parser.reset()
threw = False
try:
parser.parse("""
interface InterfaceWithMixin {
};
interface mixin Mixin {
constructor();
};
InterfaceWithMixin includes Mixin
""")
results = parser.finish()
except:
threw = True
harness.ok(threw,
"Can't have a constructor operation on a mixin")

View file

@ -2,23 +2,9 @@ def WebIDLTest(parser, harness):
threw = False threw = False
try: try:
parser.parse(""" parser.parse("""
[Constructor, Global] [Global]
interface TestConstructorGlobal {
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Should have thrown.")
parser = parser.reset()
threw = False
try:
parser.parse("""
[Global, Constructor]
interface TestConstructorGlobal { interface TestConstructorGlobal {
constructor();
}; };
""") """)

View file

@ -2,23 +2,9 @@ def WebIDLTest(parser, harness):
threw = False threw = False
try: try:
parser.parse(""" parser.parse("""
[Constructor, NoInterfaceObject] [NoInterfaceObject]
interface TestConstructorNoInterfaceObject {
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Should have thrown.")
parser = parser.reset()
threw = False
try:
parser.parse("""
[NoInterfaceObject, Constructor]
interface TestConstructorNoInterfaceObject { interface TestConstructorNoInterfaceObject {
constructor();
}; };
""") """)

View file

@ -320,14 +320,36 @@ def WebIDLTest(parser, harness):
dictionary A { dictionary A {
}; };
interface X { interface X {
void doFoo(optional A? arg1); void doFoo(optional A? arg1 = {});
}; };
""") """)
results = parser.finish() results = parser.finish()
except: except Exception as x:
threw = True threw = x
harness.ok(threw, "Dictionary arg must not be nullable") harness.ok(threw, "Optional dictionary arg must not be nullable")
harness.ok("nullable" in str(threw),
"Must have the expected exception for optional nullable dictionary arg")
parser = parser.reset()
threw = False
try:
parser.parse("""
dictionary A {
required long x;
};
interface X {
void doFoo(A? arg1);
};
""")
results = parser.finish()
except Exception as x:
threw = x
harness.ok(threw, "Required dictionary arg must not be nullable")
harness.ok("nullable" in str(threw),
"Must have the expected exception for required nullable "
"dictionary arg")
parser = parser.reset() parser = parser.reset()
threw = False threw = False
@ -336,14 +358,54 @@ def WebIDLTest(parser, harness):
dictionary A { dictionary A {
}; };
interface X { interface X {
void doFoo(optional (A or long)? arg1); void doFoo(optional (A or long)? arg1 = {});
};
""")
results = parser.finish()
except Exception as x:
threw = x
harness.ok(threw, "Dictionary arg must not be in an optional nullable union")
harness.ok("nullable" in str(threw),
"Must have the expected exception for optional nullable union "
"arg containing dictionary")
parser = parser.reset()
threw = False
try:
parser.parse("""
dictionary A {
required long x;
};
interface X {
void doFoo((A or long)? arg1);
};
""")
results = parser.finish()
except Exception as x:
threw = x
harness.ok(threw, "Dictionary arg must not be in a required nullable union")
harness.ok("nullable" in str(threw),
"Must have the expected exception for required nullable union "
"arg containing dictionary")
parser = parser.reset()
threw = False
try:
parser.parse("""
dictionary A {
};
interface X {
void doFoo(sequence<A?> arg1);
}; };
""") """)
results = parser.finish() results = parser.finish()
except: except:
threw = True threw = True
harness.ok(threw, "Dictionary arg must not be in a nullable union") harness.ok(not threw,
"Nullable union should be allowed in a sequence argument")
parser = parser.reset() parser = parser.reset()
threw = False threw = False

View file

@ -166,7 +166,7 @@ def WebIDLTest(parser, harness):
"record<ByteString, long>", "record<ByteString, long>",
"Date", "Date?", "any", "Date", "Date?", "any",
"Promise<any>", "Promise<any>?", "Promise<any>", "Promise<any>?",
"USVString", "ArrayBuffer", "ArrayBufferView", "SharedArrayBuffer", "USVString", "JSString", "ArrayBuffer", "ArrayBufferView", "SharedArrayBuffer",
"Uint8Array", "Uint16Array", "Uint8Array", "Uint16Array",
"(long or Callback)", "(long or Dict)", "(long or Callback)", "(long or Dict)",
] ]
@ -183,7 +183,7 @@ def WebIDLTest(parser, harness):
primitives = numerics + booleans primitives = numerics + booleans
nonNumerics = allBut(argTypes, numerics + unions) nonNumerics = allBut(argTypes, numerics + unions)
nonBooleans = allBut(argTypes, booleans) nonBooleans = allBut(argTypes, booleans)
strings = [ "DOMString", "ByteString", "Enum", "Enum2", "USVString" ] strings = [ "DOMString", "ByteString", "Enum", "Enum2", "USVString", "JSString" ]
nonStrings = allBut(argTypes, strings) nonStrings = allBut(argTypes, strings)
nonObjects = primitives + strings nonObjects = primitives + strings
objects = allBut(argTypes, nonObjects ) objects = allBut(argTypes, nonObjects )
@ -202,7 +202,7 @@ def WebIDLTest(parser, harness):
notRelatedInterfaces = (nonObjects + ["UnrelatedInterface"] + notRelatedInterfaces = (nonObjects + ["UnrelatedInterface"] +
otherObjects + dates + sequences + bufferSourceTypes + sharedBufferSourceTypes) otherObjects + dates + sequences + bufferSourceTypes + sharedBufferSourceTypes)
records = [ "record<DOMString, object>", "record<USVString, Dict>", records = [ "record<DOMString, object>", "record<USVString, Dict>",
"record<ByteString, long>" ] "record<ByteString, long>" ] # JSString not supported in records
# Build a representation of the distinguishability table as a dict # Build a representation of the distinguishability table as a dict
# of dicts, holding True values where needed, holes elsewhere. # of dicts, holding True values where needed, holes elsewhere.
@ -222,6 +222,7 @@ def WebIDLTest(parser, harness):
setDistinguishable("DOMString", nonStrings) setDistinguishable("DOMString", nonStrings)
setDistinguishable("ByteString", nonStrings) setDistinguishable("ByteString", nonStrings)
setDistinguishable("USVString", nonStrings) setDistinguishable("USVString", nonStrings)
setDistinguishable("JSString", nonStrings)
setDistinguishable("Enum", nonStrings) setDistinguishable("Enum", nonStrings)
setDistinguishable("Enum2", nonStrings) setDistinguishable("Enum2", nonStrings)
setDistinguishable("Interface", notRelatedInterfaces) setDistinguishable("Interface", notRelatedInterfaces)
@ -244,6 +245,7 @@ def WebIDLTest(parser, harness):
allBut(argTypes, sequences + ["object"])) allBut(argTypes, sequences + ["object"]))
setDistinguishable("record<DOMString, object>", nonUserObjects) setDistinguishable("record<DOMString, object>", nonUserObjects)
setDistinguishable("record<USVString, Dict>", nonUserObjects) setDistinguishable("record<USVString, Dict>", nonUserObjects)
# JSString not supported in records
setDistinguishable("record<ByteString, long>", nonUserObjects) setDistinguishable("record<ByteString, long>", nonUserObjects)
setDistinguishable("Date", allBut(argTypes, dates + ["object"])) setDistinguishable("Date", allBut(argTypes, dates + ["object"]))
setDistinguishable("Date?", allBut(argTypes, dates + nullables + ["object"])) setDistinguishable("Date?", allBut(argTypes, dates + nullables + ["object"]))

View file

@ -189,12 +189,12 @@ def WebIDLTest(parser, harness):
parser = parser.reset() parser = parser.reset()
parser.parse(""" parser.parse("""
[Constructor(long arg)]
interface A { interface A {
constructor();
constructor(long arg);
readonly attribute boolean x; readonly attribute boolean x;
void foo(); void foo();
}; };
[Constructor]
partial interface A { partial interface A {
readonly attribute boolean y; readonly attribute boolean y;
void foo(long arg); void foo(long arg);
@ -219,13 +219,13 @@ def WebIDLTest(parser, harness):
parser = parser.reset() parser = parser.reset()
parser.parse(""" parser.parse("""
[Constructor]
partial interface A { partial interface A {
readonly attribute boolean y; readonly attribute boolean y;
void foo(long arg); void foo(long arg);
}; };
[Constructor(long arg)]
interface A { interface A {
constructor();
constructor(long arg);
readonly attribute boolean x; readonly attribute boolean x;
void foo(); void foo();
}; };

View file

@ -264,18 +264,18 @@ def WebIDLTest(parser, harness):
shouldPass("JS Implemented maplike interface", shouldPass("JS Implemented maplike interface",
""" """
[JSImplementation="@mozilla.org/dom/test-interface-js-maplike;1", [JSImplementation="@mozilla.org/dom/test-interface-js-maplike;1"]
Constructor()]
interface Foo1 { interface Foo1 {
constructor();
setlike<long>; setlike<long>;
}; };
""", setRWChromeMembers) """, setRWChromeMembers)
shouldPass("JS Implemented maplike interface", shouldPass("JS Implemented maplike interface",
""" """
[JSImplementation="@mozilla.org/dom/test-interface-js-maplike;1", [JSImplementation="@mozilla.org/dom/test-interface-js-maplike;1"]
Constructor()]
interface Foo1 { interface Foo1 {
constructor();
maplike<long, long>; maplike<long, long>;
}; };
""", mapRWChromeMembers) """, mapRWChromeMembers)
@ -655,9 +655,9 @@ def WebIDLTest(parser, harness):
shouldPass("JS Implemented read-only interface with readonly allowable overrides", shouldPass("JS Implemented read-only interface with readonly allowable overrides",
""" """
[JSImplementation="@mozilla.org/dom/test-interface-js-maplike;1", [JSImplementation="@mozilla.org/dom/test-interface-js-maplike;1"]
Constructor()]
interface Foo1 { interface Foo1 {
constructor();
readonly setlike<long>; readonly setlike<long>;
readonly attribute boolean clear; readonly attribute boolean clear;
}; };
@ -665,9 +665,9 @@ def WebIDLTest(parser, harness):
shouldFail("JS Implemented read-write interface with non-readwrite allowable overrides", shouldFail("JS Implemented read-write interface with non-readwrite allowable overrides",
""" """
[JSImplementation="@mozilla.org/dom/test-interface-js-maplike;1", [JSImplementation="@mozilla.org/dom/test-interface-js-maplike;1"]
Constructor()]
interface Foo1 { interface Foo1 {
constructor();
setlike<long>; setlike<long>;
readonly attribute boolean clear; readonly attribute boolean clear;
}; };

View file

@ -1,11 +1,11 @@
wget https://hg.mozilla.org/mozilla-central/raw-file/tip/dom/bindings/parser/WebIDL.py -O WebIDL.py wget https://hg.mozilla.org/mozilla-central/raw-file/e447e3d69684cf04a95a35b9708174a6538eb042/dom/bindings/parser/WebIDL.py -O WebIDL.py
patch < abstract.patch patch < abstract.patch
patch < debug.patch patch < debug.patch
patch < callback-location.patch patch < callback-location.patch
patch < union-typedef.patch patch < union-typedef.patch
patch < inline.patch patch < inline.patch
wget https://hg.mozilla.org/mozilla-central/archive/tip.tar.gz/dom/bindings/parser/tests/ -O tests.tar.gz wget https://hg.mozilla.org/mozilla-central/archive/e447e3d69684cf04a95a35b9708174a6538eb042.tar.gz/dom/bindings/parser/tests/ -O tests.tar.gz
rm -r tests rm -r tests
mkdir tests mkdir tests
tar xvpf tests.tar.gz -C tests --strip-components=5 tar xvpf tests.tar.gz -C tests --strip-components=5

View file

@ -13,9 +13,9 @@ dictionary AnalyserOptions : AudioNodeOptions {
double smoothingTimeConstant = 0.8; double smoothingTimeConstant = 0.8;
}; };
[Exposed=Window, [Exposed=Window]
Constructor (BaseAudioContext context, optional AnalyserOptions options = {})]
interface AnalyserNode : AudioNode { interface AnalyserNode : AudioNode {
[Throws] constructor(BaseAudioContext context, optional AnalyserOptions options = {});
void getFloatFrequencyData (Float32Array array); void getFloatFrequencyData (Float32Array array);
void getByteFrequencyData (Uint8Array array); void getByteFrequencyData (Uint8Array array);
void getFloatTimeDomainData (Float32Array array); void getFloatTimeDomainData (Float32Array array);

View file

@ -12,9 +12,9 @@ dictionary AudioBufferOptions {
required float sampleRate; required float sampleRate;
}; };
[Exposed=Window, [Exposed=Window]
Constructor (AudioBufferOptions options)]
interface AudioBuffer { interface AudioBuffer {
[Throws] constructor(AudioBufferOptions options);
readonly attribute float sampleRate; readonly attribute float sampleRate;
readonly attribute unsigned long length; readonly attribute unsigned long length;
readonly attribute double duration; readonly attribute double duration;

View file

@ -15,9 +15,9 @@ dictionary AudioBufferSourceOptions {
float playbackRate = 1; float playbackRate = 1;
}; };
[Exposed=Window, [Exposed=Window]
Constructor (BaseAudioContext context, optional AudioBufferSourceOptions options = {})]
interface AudioBufferSourceNode : AudioScheduledSourceNode { interface AudioBufferSourceNode : AudioScheduledSourceNode {
[Throws] constructor(BaseAudioContext context, optional AudioBufferSourceOptions options = {});
[Throws] attribute AudioBuffer? buffer; [Throws] attribute AudioBuffer? buffer;
readonly attribute AudioParam playbackRate; readonly attribute AudioParam playbackRate;
readonly attribute AudioParam detune; readonly attribute AudioParam detune;

View file

@ -22,9 +22,9 @@ dictionary AudioTimestamp {
DOMHighResTimeStamp performanceTime; DOMHighResTimeStamp performanceTime;
}; };
[Exposed=Window, [Exposed=Window]
Constructor(optional AudioContextOptions contextOptions = {})]
interface AudioContext : BaseAudioContext { interface AudioContext : BaseAudioContext {
[Throws] constructor(optional AudioContextOptions contextOptions = {});
readonly attribute double baseLatency; readonly attribute double baseLatency;
readonly attribute double outputLatency; readonly attribute double outputLatency;

View file

@ -25,9 +25,9 @@ dictionary BiquadFilterOptions : AudioNodeOptions {
float gain = 0; float gain = 0;
}; };
[Exposed=Window, [Exposed=Window]
Constructor (BaseAudioContext context, optional BiquadFilterOptions options = {})]
interface BiquadFilterNode : AudioNode { interface BiquadFilterNode : AudioNode {
[Throws] constructor(BaseAudioContext context, optional BiquadFilterOptions options = {});
attribute BiquadFilterType type; attribute BiquadFilterType type;
readonly attribute AudioParam frequency; readonly attribute AudioParam frequency;
readonly attribute AudioParam detune; readonly attribute AudioParam detune;

View file

@ -4,10 +4,10 @@
// https://w3c.github.io/FileAPI/#blob // https://w3c.github.io/FileAPI/#blob
[Constructor(optional sequence<BlobPart> blobParts, [Exposed=(Window,Worker)]
optional BlobPropertyBag options = {}),
Exposed=(Window,Worker)]
interface Blob { interface Blob {
[Throws] constructor(optional sequence<BlobPart> blobParts,
optional BlobPropertyBag options = {});
readonly attribute unsigned long long size; readonly attribute unsigned long long size;
readonly attribute DOMString type; readonly attribute DOMString type;

View file

@ -10,8 +10,9 @@
interface BluetoothServiceDataMap { interface BluetoothServiceDataMap {
readonly maplike<UUID, DataView>; readonly maplike<UUID, DataView>;
};*/ };*/
[Pref="dom.bluetooth.enabled", Constructor(DOMString type, BluetoothAdvertisingEventInit init)] [Pref="dom.bluetooth.enabled"]
interface BluetoothAdvertisingEvent : Event { interface BluetoothAdvertisingEvent : Event {
[Throws] constructor(DOMString type, BluetoothAdvertisingEventInit init);
[SameObject] [SameObject]
readonly attribute BluetoothDevice device; readonly attribute BluetoothDevice device;
// readonly attribute FrozenArray<UUID> uuids; // readonly attribute FrozenArray<UUID> uuids;

View file

@ -10,7 +10,7 @@ dictionary ChannelMergerOptions : AudioNodeOptions {
unsigned long numberOfInputs = 6; unsigned long numberOfInputs = 6;
}; };
[Exposed=Window, [Exposed=Window]
Constructor (BaseAudioContext context, optional ChannelMergerOptions options = {})]
interface ChannelMergerNode : AudioNode { interface ChannelMergerNode : AudioNode {
[Throws] constructor(BaseAudioContext context, optional ChannelMergerOptions options = {});
}; };

View file

@ -10,7 +10,7 @@ dictionary ChannelSplitterOptions : AudioNodeOptions {
unsigned long numberOfOutputs = 6; unsigned long numberOfOutputs = 6;
}; };
[Exposed=Window, [Exposed=Window]
Constructor (BaseAudioContext context, optional ChannelSplitterOptions options = {})]
interface ChannelSplitterNode : AudioNode { interface ChannelSplitterNode : AudioNode {
[Throws] constructor(BaseAudioContext context, optional ChannelSplitterOptions options = {});
}; };

View file

@ -3,8 +3,9 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//https://html.spec.whatwg.org/multipage/#the-closeevent-interfaces //https://html.spec.whatwg.org/multipage/#the-closeevent-interfaces
[Constructor(DOMString type, optional CloseEventInit eventInitDict = {}), Exposed=(Window,Worker)] [Exposed=(Window,Worker)]
interface CloseEvent : Event { interface CloseEvent : Event {
[Throws] constructor(DOMString type, optional CloseEventInit eventInitDict = {});
readonly attribute boolean wasClean; readonly attribute boolean wasClean;
readonly attribute unsigned short code; readonly attribute unsigned short code;
readonly attribute DOMString reason; readonly attribute DOMString reason;

View file

@ -9,6 +9,6 @@
* liability, trademark and document use rules apply. * liability, trademark and document use rules apply.
*/ */
[Constructor(optional DOMString data = "")]
interface Comment : CharacterData { interface Comment : CharacterData {
[Throws] constructor(optional DOMString data = "");
}; };

View file

@ -8,8 +8,9 @@
*/ */
// https://w3c.github.io/uievents/#idl-compositionevent // https://w3c.github.io/uievents/#idl-compositionevent
[Pref="dom.compositionevent.enabled", Constructor(DOMString type, optional CompositionEventInit eventInitDict = {})] [Pref="dom.compositionevent.enabled"]
interface CompositionEvent : UIEvent { interface CompositionEvent : UIEvent {
[Throws] constructor(DOMString type, optional CompositionEventInit eventInitDict = {});
readonly attribute DOMString data; readonly attribute DOMString data;
}; };

View file

@ -10,8 +10,8 @@ dictionary ConstantSourceOptions: AudioNodeOptions {
float offset = 1; float offset = 1;
}; };
[Exposed=Window, [Exposed=Window]
Constructor (BaseAudioContext context, optional ConstantSourceOptions options = {})]
interface ConstantSourceNode : AudioScheduledSourceNode { interface ConstantSourceNode : AudioScheduledSourceNode {
[Throws] constructor(BaseAudioContext context, optional ConstantSourceOptions options = {});
readonly attribute AudioParam offset; readonly attribute AudioParam offset;
}; };

View file

@ -13,9 +13,9 @@
* http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0. * http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0.
*/ */
[Constructor(DOMString type, optional CustomEventInit eventInitDict = {}), [Exposed=(Window,Worker)]
Exposed=(Window,Worker)]
interface CustomEvent : Event { interface CustomEvent : Event {
[Throws] constructor(DOMString type, optional CustomEventInit eventInitDict = {});
readonly attribute any detail; readonly attribute any detail;
void initCustomEvent(DOMString type, boolean bubbles, boolean cancelable, any detail); void initCustomEvent(DOMString type, boolean bubbles, boolean cancelable, any detail);

View file

@ -9,10 +9,10 @@
[ [
ExceptionClass, ExceptionClass,
Exposed=(Window,Worker,Worklet,DissimilarOriginWindow), Exposed=(Window,Worker,Worklet,DissimilarOriginWindow)
Constructor(optional DOMString message="", optional DOMString name="Error")
] ]
interface DOMException { interface DOMException {
[Throws] constructor(optional DOMString message="", optional DOMString name="Error");
const unsigned short INDEX_SIZE_ERR = 1; const unsigned short INDEX_SIZE_ERR = 1;
const unsigned short DOMSTRING_SIZE_ERR = 2; // historical const unsigned short DOMSTRING_SIZE_ERR = 2; // historical
const unsigned short HIERARCHY_REQUEST_ERR = 3; const unsigned short HIERARCHY_REQUEST_ERR = 3;

View file

@ -10,9 +10,9 @@
* related or neighboring rights to this work. * related or neighboring rights to this work.
*/ */
[Constructor(optional (DOMString or sequence<unrestricted double>) init), [Exposed=(Window,Worker)]
Exposed=(Window,Worker)]
interface DOMMatrix : DOMMatrixReadOnly { interface DOMMatrix : DOMMatrixReadOnly {
[Throws] constructor(optional (DOMString or sequence<unrestricted double>) init);
[NewObject, Throws] static DOMMatrix fromMatrix(optional DOMMatrixInit other = {}); [NewObject, Throws] static DOMMatrix fromMatrix(optional DOMMatrixInit other = {});
[NewObject, Throws] static DOMMatrix fromFloat32Array(Float32Array array32); [NewObject, Throws] static DOMMatrix fromFloat32Array(Float32Array array32);

View file

@ -10,9 +10,9 @@
* related or neighboring rights to this work. * related or neighboring rights to this work.
*/ */
[Constructor(optional (DOMString or sequence<unrestricted double>) init), [Exposed=(Window,Worker)]
Exposed=(Window,Worker)]
interface DOMMatrixReadOnly { interface DOMMatrixReadOnly {
[Throws] constructor(optional (DOMString or sequence<unrestricted double>) init);
[NewObject, Throws] static DOMMatrixReadOnly fromMatrix(optional DOMMatrixInit other = {}); [NewObject, Throws] static DOMMatrixReadOnly fromMatrix(optional DOMMatrixInit other = {});
[NewObject, Throws] static DOMMatrixReadOnly fromFloat32Array(Float32Array array32); [NewObject, Throws] static DOMMatrixReadOnly fromFloat32Array(Float32Array array32);

View file

@ -14,8 +14,8 @@ enum SupportedType {
"image/svg+xml"*/ "image/svg+xml"*/
}; };
[Constructor]
interface DOMParser { interface DOMParser {
[Throws] constructor();
[Throws] [Throws]
Document parseFromString(DOMString str, SupportedType type); Document parseFromString(DOMString str, SupportedType type);
}; };

View file

@ -10,10 +10,10 @@
*/ */
// http://dev.w3.org/fxtf/geometry/Overview.html#dompoint // http://dev.w3.org/fxtf/geometry/Overview.html#dompoint
[Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0, [Exposed=(Window,Worker)]
optional unrestricted double z = 0, optional unrestricted double w = 1),
Exposed=(Window,Worker)]
interface DOMPoint : DOMPointReadOnly { interface DOMPoint : DOMPointReadOnly {
[Throws] constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
optional unrestricted double z = 0, optional unrestricted double w = 1);
[NewObject] static DOMPoint fromPoint(optional DOMPointInit other = {}); [NewObject] static DOMPoint fromPoint(optional DOMPointInit other = {});
inherit attribute unrestricted double x; inherit attribute unrestricted double x;

View file

@ -10,10 +10,10 @@
*/ */
// http://dev.w3.org/fxtf/geometry/Overview.html#dompointreadonly // http://dev.w3.org/fxtf/geometry/Overview.html#dompointreadonly
[Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0, [Exposed=(Window,Worker)]
optional unrestricted double z = 0, optional unrestricted double w = 1),
Exposed=(Window,Worker)]
interface DOMPointReadOnly { interface DOMPointReadOnly {
[Throws] constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
optional unrestricted double z = 0, optional unrestricted double w = 1);
[NewObject] static DOMPointReadOnly fromPoint(optional DOMPointInit other = {}); [NewObject] static DOMPointReadOnly fromPoint(optional DOMPointInit other = {});
readonly attribute unrestricted double x; readonly attribute unrestricted double x;

View file

@ -10,10 +10,10 @@
* related or neighboring rights to this work. * related or neighboring rights to this work.
*/ */
[Constructor(optional DOMPointInit p1 = {}, optional DOMPointInit p2 = {}, [Exposed=(Window,Worker)]
optional DOMPointInit p3 = {}, optional DOMPointInit p4 = {}),
Exposed=(Window,Worker)]
interface DOMQuad { interface DOMQuad {
[Throws] constructor(optional DOMPointInit p1 = {}, optional DOMPointInit p2 = {},
optional DOMPointInit p3 = {}, optional DOMPointInit p4 = {});
[NewObject] static DOMQuad fromRect(optional DOMRectInit other = {}); [NewObject] static DOMQuad fromRect(optional DOMRectInit other = {});
[NewObject] static DOMQuad fromQuad(optional DOMQuadInit other = {}); [NewObject] static DOMQuad fromQuad(optional DOMQuadInit other = {});

View file

@ -2,11 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
[Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0, [Exposed=(Window,Worker)]
optional unrestricted double width = 0, optional unrestricted double height = 0),
Exposed=(Window,Worker)]
// https://drafts.fxtf.org/geometry/#domrect // https://drafts.fxtf.org/geometry/#domrect
interface DOMRect : DOMRectReadOnly { interface DOMRect : DOMRectReadOnly {
[Throws] constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
optional unrestricted double width = 0, optional unrestricted double height = 0);
inherit attribute unrestricted double x; inherit attribute unrestricted double x;
inherit attribute unrestricted double y; inherit attribute unrestricted double y;
inherit attribute unrestricted double width; inherit attribute unrestricted double width;

View file

@ -2,11 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
[Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0, [Exposed=(Window,Worker)]
optional unrestricted double width = 0, optional unrestricted double height = 0),
Exposed=(Window,Worker)]
// https://drafts.fxtf.org/geometry/#domrect // https://drafts.fxtf.org/geometry/#domrect
interface DOMRectReadOnly { interface DOMRectReadOnly {
[Throws] constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
optional unrestricted double width = 0, optional unrestricted double height = 0);
// [NewObject] static DOMRectReadOnly fromRect(optional DOMRectInit other); // [NewObject] static DOMRectReadOnly fromRect(optional DOMRectInit other);
readonly attribute unrestricted double x; readonly attribute unrestricted double x;

View file

@ -8,8 +8,8 @@
*/ */
// https://dom.spec.whatwg.org/#interface-document // https://dom.spec.whatwg.org/#interface-document
[Constructor]
interface Document : Node { interface Document : Node {
[Throws] constructor();
[SameObject] [SameObject]
readonly attribute DOMImplementation implementation; readonly attribute DOMImplementation implementation;
[Constant] [Constant]

View file

@ -3,8 +3,8 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://dom.spec.whatwg.org/#interface-documentfragment // https://dom.spec.whatwg.org/#interface-documentfragment
[Constructor]
interface DocumentFragment : Node { interface DocumentFragment : Node {
[Throws] constructor();
}; };
DocumentFragment includes NonElementParentNode; DocumentFragment includes NonElementParentNode;

View file

@ -4,8 +4,9 @@
// https://html.spec.whatwg.org/multipage/#the-errorevent-interface // https://html.spec.whatwg.org/multipage/#the-errorevent-interface
[Constructor(DOMString type, optional ErrorEventInit eventInitDict = {}), Exposed=(Window,Worker)] [Exposed=(Window,Worker)]
interface ErrorEvent : Event { interface ErrorEvent : Event {
[Throws] constructor(DOMString type, optional ErrorEventInit eventInitDict = {});
readonly attribute DOMString message; readonly attribute DOMString message;
readonly attribute DOMString filename; readonly attribute DOMString filename;
readonly attribute unsigned long lineno; readonly attribute unsigned long lineno;

View file

@ -6,8 +6,9 @@
* https://dom.spec.whatwg.org/#event * https://dom.spec.whatwg.org/#event
*/ */
[Constructor(DOMString type, optional EventInit eventInitDict = {}), Exposed=(Window,Worker)] [Exposed=(Window,Worker)]
interface Event { interface Event {
[Throws] constructor(DOMString type, optional EventInit eventInitDict = {});
[Pure] [Pure]
readonly attribute DOMString type; readonly attribute DOMString type;
readonly attribute EventTarget? target; readonly attribute EventTarget? target;

View file

@ -6,9 +6,9 @@
* https://html.spec.whatwg.org/multipage/#eventsource * https://html.spec.whatwg.org/multipage/#eventsource
*/ */
[Constructor(DOMString url, optional EventSourceInit eventSourceInitDict = {}), [Exposed=(Window,Worker)]
Exposed=(Window,Worker)]
interface EventSource : EventTarget { interface EventSource : EventTarget {
[Throws] constructor(DOMString url, optional EventSourceInit eventSourceInitDict = {});
readonly attribute DOMString url; readonly attribute DOMString url;
readonly attribute boolean withCredentials; readonly attribute boolean withCredentials;

View file

@ -5,8 +5,9 @@
* https://dom.spec.whatwg.org/#interface-eventtarget * https://dom.spec.whatwg.org/#interface-eventtarget
*/ */
[Constructor, Exposed=(Window,Worker,Worklet,DissimilarOriginWindow)] [Exposed=(Window,Worker,Worklet,DissimilarOriginWindow)]
interface EventTarget { interface EventTarget {
[Throws] constructor();
void addEventListener( void addEventListener(
DOMString type, DOMString type,
EventListener? callback, EventListener? callback,

View file

@ -4,11 +4,11 @@
// https://w3c.github.io/ServiceWorker/#extendable-event // https://w3c.github.io/ServiceWorker/#extendable-event
[Constructor(DOMString type, [Exposed=ServiceWorker,
optional ExtendableEventInit eventInitDict = {}),
Exposed=ServiceWorker,
Pref="dom.serviceworker.enabled"] Pref="dom.serviceworker.enabled"]
interface ExtendableEvent : Event { interface ExtendableEvent : Event {
[Throws] constructor(DOMString type,
optional ExtendableEventInit eventInitDict = {});
[Throws] void waitUntil(/*Promise<*/any/*>*/ f); [Throws] void waitUntil(/*Promise<*/any/*>*/ f);
}; };

View file

@ -4,10 +4,10 @@
// https://w3c.github.io/ServiceWorker/#extendablemessage-event-section // https://w3c.github.io/ServiceWorker/#extendablemessage-event-section
[Constructor(DOMString type, optional ExtendableMessageEventInit eventInitDict = {}), [Exposed=ServiceWorker,
Exposed=ServiceWorker,
Pref="dom.serviceworker.enabled"] Pref="dom.serviceworker.enabled"]
interface ExtendableMessageEvent : ExtendableEvent { interface ExtendableMessageEvent : ExtendableEvent {
[Throws] constructor(DOMString type, optional ExtendableMessageEventInit eventInitDict = {});
readonly attribute any data; readonly attribute any data;
readonly attribute DOMString origin; readonly attribute DOMString origin;
readonly attribute DOMString lastEventId; readonly attribute DOMString lastEventId;

View file

@ -4,11 +4,11 @@
// https://w3c.github.io/FileAPI/#file // https://w3c.github.io/FileAPI/#file
[Constructor(sequence<BlobPart> fileBits, [Exposed=(Window,Worker)]
DOMString fileName,
optional FilePropertyBag options = {}),
Exposed=(Window,Worker)]
interface File : Blob { interface File : Blob {
[Throws] constructor(sequence<BlobPart> fileBits,
DOMString fileName,
optional FilePropertyBag options = {});
readonly attribute DOMString name; readonly attribute DOMString name;
readonly attribute long long lastModified; readonly attribute long long lastModified;
}; };

View file

@ -5,8 +5,9 @@
// http://dev.w3.org/2006/webapi/FileAPI/#APIASynch // http://dev.w3.org/2006/webapi/FileAPI/#APIASynch
typedef (DOMString or object) FileReaderResult; typedef (DOMString or object) FileReaderResult;
[Constructor, Exposed=(Window,Worker)] [Exposed=(Window,Worker)]
interface FileReader: EventTarget { interface FileReader: EventTarget {
[Throws] constructor();
// async read methods // async read methods
[Throws] [Throws]

View file

@ -4,8 +4,9 @@
// https://w3c.github.io/FileAPI/#FileReaderSync // https://w3c.github.io/FileAPI/#FileReaderSync
[Constructor, Exposed=Worker] [Exposed=Worker]
interface FileReaderSync { interface FileReaderSync {
[Throws] constructor();
// Synchronously return strings // Synchronously return strings
[Throws] [Throws]

View file

@ -3,9 +3,9 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://w3c.github.io/uievents/#interface-FocusEvent // https://w3c.github.io/uievents/#interface-FocusEvent
[Constructor(DOMString typeArg, optional FocusEventInit focusEventInitDict = {}), [Exposed=Window]
Exposed=Window]
interface FocusEvent : UIEvent { interface FocusEvent : UIEvent {
[Throws] constructor(DOMString typeArg, optional FocusEventInit focusEventInitDict = {});
readonly attribute EventTarget? relatedTarget; readonly attribute EventTarget? relatedTarget;
}; };

View file

@ -8,9 +8,9 @@
typedef (File or USVString) FormDataEntryValue; typedef (File or USVString) FormDataEntryValue;
[Constructor(optional HTMLFormElement form), [Exposed=(Window,Worker)]
Exposed=(Window,Worker)]
interface FormData { interface FormData {
[Throws] constructor(optional HTMLFormElement form);
void append(USVString name, USVString value); void append(USVString name, USVString value);
void append(USVString name, Blob value, optional USVString filename); void append(USVString name, Blob value, optional USVString filename);
void delete(USVString name); void delete(USVString name);

View file

@ -3,9 +3,9 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://html.spec.whatwg.org/multipage/#the-formdataevent-interface // https://html.spec.whatwg.org/multipage/#the-formdataevent-interface
[Exposed=Window, [Exposed=Window]
Constructor(DOMString type, optional FormDataEventInit eventInitDict = {})]
interface FormDataEvent : Event { interface FormDataEvent : Event {
[Throws] constructor(DOMString type, optional FormDataEventInit eventInitDict = {});
readonly attribute FormData formData; readonly attribute FormData formData;
}; };

View file

@ -10,8 +10,8 @@ dictionary GainOptions : AudioNodeOptions {
float gain = 1.0; float gain = 1.0;
}; };
[Exposed=Window, [Exposed=Window]
Constructor (BaseAudioContext context, optional GainOptions options = {})]
interface GainNode : AudioNode { interface GainNode : AudioNode {
[Throws] constructor(BaseAudioContext context, optional GainOptions options = {});
readonly attribute AudioParam gain; readonly attribute AudioParam gain;
}; };

View file

@ -3,8 +3,9 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://w3c.github.io/gamepad/#gamepadevent-interface // https://w3c.github.io/gamepad/#gamepadevent-interface
[Pref="dom.gamepad.enabled", Constructor(DOMString type, GamepadEventInit eventInitDict)] [Pref="dom.gamepad.enabled"]
interface GamepadEvent : Event { interface GamepadEvent : Event {
[Throws] constructor(DOMString type, GamepadEventInit eventInitDict);
readonly attribute Gamepad gamepad; readonly attribute Gamepad gamepad;
}; };

View file

@ -3,9 +3,9 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://html.spec.whatwg.org/multipage/#hashchangeevent // https://html.spec.whatwg.org/multipage/#hashchangeevent
[Constructor(DOMString type, optional HashChangeEventInit eventInitDict = {}), [Exposed=Window]
Exposed=Window]
interface HashChangeEvent : Event { interface HashChangeEvent : Event {
[Throws] constructor(DOMString type, optional HashChangeEventInit eventInitDict = {});
readonly attribute USVString oldURL; readonly attribute USVString oldURL;
readonly attribute USVString newURL; readonly attribute USVString newURL;
}; };

View file

@ -6,9 +6,9 @@
typedef (Headers or sequence<sequence<ByteString>> or record<DOMString, ByteString>) HeadersInit; typedef (Headers or sequence<sequence<ByteString>> or record<DOMString, ByteString>) HeadersInit;
[Constructor(optional HeadersInit init), [Exposed=(Window,Worker)]
Exposed=(Window,Worker)]
interface Headers { interface Headers {
[Throws] constructor(optional HeadersInit init);
[Throws] [Throws]
void append(ByteString name, ByteString value); void append(ByteString name, ByteString value);
[Throws] [Throws]

View file

@ -9,10 +9,10 @@
* You are granted a license to use, reproduce and create derivative works of this document. * You are granted a license to use, reproduce and create derivative works of this document.
*/ */
[Constructor(unsigned long sw, unsigned long sh), [Exposed=(Window,Worker)]
Constructor(/* Uint8ClampedArray */ object data, unsigned long sw, optional unsigned long sh),
Exposed=(Window,Worker)]
interface ImageData { interface ImageData {
[Throws] constructor(unsigned long sw, unsigned long sh);
[Throws] constructor(/* Uint8ClampedArray */ object data, unsigned long sw, optional unsigned long sh);
//[Constant] //[Constant]
readonly attribute unsigned long width; readonly attribute unsigned long width;
//[Constant] //[Constant]

View file

@ -8,8 +8,8 @@
*/ */
// https://w3c.github.io/uievents/#idl-inputevent // https://w3c.github.io/uievents/#idl-inputevent
[Constructor(DOMString type, optional InputEventInit eventInitDict = {})]
interface InputEvent : UIEvent { interface InputEvent : UIEvent {
[Throws] constructor(DOMString type, optional InputEventInit eventInitDict = {});
readonly attribute DOMString? data; readonly attribute DOMString? data;
readonly attribute boolean isComposing; readonly attribute boolean isComposing;
}; };

View file

@ -7,8 +7,8 @@
* *
*/ */
[Constructor(DOMString typeArg, optional KeyboardEventInit keyboardEventInitDict = {})]
interface KeyboardEvent : UIEvent { interface KeyboardEvent : UIEvent {
[Throws] constructor(DOMString typeArg, optional KeyboardEventInit keyboardEventInitDict = {});
// KeyLocationCode // KeyLocationCode
const unsigned long DOM_KEY_LOCATION_STANDARD = 0x00; const unsigned long DOM_KEY_LOCATION_STANDARD = 0x00;
const unsigned long DOM_KEY_LOCATION_LEFT = 0x01; const unsigned long DOM_KEY_LOCATION_LEFT = 0x01;

View file

@ -3,8 +3,9 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://drafts.csswg.org/cssom-view/#dom-mediaquerylistevent-mediaquerylistevent // https://drafts.csswg.org/cssom-view/#dom-mediaquerylistevent-mediaquerylistevent
[Constructor(DOMString type, optional MediaQueryListEventInit eventInitDict = {}), Exposed=(Window)] [Exposed=(Window)]
interface MediaQueryListEvent : Event { interface MediaQueryListEvent : Event {
[Throws] constructor(DOMString type, optional MediaQueryListEventInit eventInitDict = {});
readonly attribute DOMString media; readonly attribute DOMString media;
readonly attribute boolean matches; readonly attribute boolean matches;
}; };

View file

@ -5,11 +5,11 @@
// https://w3c.github.io/mediacapture-main/#dom-mediastream // https://w3c.github.io/mediacapture-main/#dom-mediastream
[Exposed=Window, [Exposed=Window,
Constructor, Pref="dom.webrtc.enabled"]
Constructor(MediaStream stream),
Constructor(sequence<MediaStreamTrack> tracks),
Pref="dom.webrtc.enabled"]
interface MediaStream : EventTarget { interface MediaStream : EventTarget {
[Throws] constructor();
[Throws] constructor(MediaStream stream);
[Throws] constructor(sequence<MediaStreamTrack> tracks);
// readonly attribute DOMString id; // readonly attribute DOMString id;
sequence<MediaStreamTrack> getAudioTracks(); sequence<MediaStreamTrack> getAudioTracks();
sequence<MediaStreamTrack> getVideoTracks(); sequence<MediaStreamTrack> getVideoTracks();

View file

@ -3,8 +3,9 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://html.spec.whatwg.org/multipage/#messageevent // https://html.spec.whatwg.org/multipage/#messageevent
[Constructor(DOMString type, optional MessageEventInit eventInitDict = {}), Exposed=(Window,Worker)] [Exposed=(Window,Worker)]
interface MessageEvent : Event { interface MessageEvent : Event {
[Throws] constructor(DOMString type, optional MessageEventInit eventInitDict = {});
readonly attribute any data; readonly attribute any data;
readonly attribute DOMString origin; readonly attribute DOMString origin;
readonly attribute DOMString lastEventId; readonly attribute DOMString lastEventId;

View file

@ -3,9 +3,9 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://w3c.github.io/uievents/#interface-mouseevent // https://w3c.github.io/uievents/#interface-mouseevent
[Constructor(DOMString typeArg, optional MouseEventInit mouseEventInitDict = {}), [Exposed=Window]
Exposed=Window]
interface MouseEvent : UIEvent { interface MouseEvent : UIEvent {
[Throws] constructor(DOMString typeArg, optional MouseEventInit mouseEventInitDict = {});
readonly attribute long screenX; readonly attribute long screenX;
readonly attribute long screenY; readonly attribute long screenY;
readonly attribute long clientX; readonly attribute long clientX;

View file

@ -7,8 +7,9 @@
*/ */
// https://dom.spec.whatwg.org/#mutationobserver // https://dom.spec.whatwg.org/#mutationobserver
[Pref="dom.mutation_observer.enabled", Constructor(MutationCallback callback)] [Pref="dom.mutation_observer.enabled"]
interface MutationObserver { interface MutationObserver {
[Throws] constructor(MutationCallback callback);
[Throws] [Throws]
void observe(Node target, optional MutationObserverInit options = {}); void observe(Node target, optional MutationObserverInit options = {});
void disconnect(); void disconnect();

View file

@ -10,8 +10,8 @@ dictionary OfflineAudioCompletionEventInit : EventInit {
required AudioBuffer renderedBuffer; required AudioBuffer renderedBuffer;
}; };
[Exposed=Window, [Exposed=Window]
Constructor(DOMString type, OfflineAudioCompletionEventInit eventInitDict)]
interface OfflineAudioCompletionEvent : Event { interface OfflineAudioCompletionEvent : Event {
[Throws] constructor(DOMString type, OfflineAudioCompletionEventInit eventInitDict);
readonly attribute AudioBuffer renderedBuffer; readonly attribute AudioBuffer renderedBuffer;
}; };

View file

@ -12,10 +12,10 @@ dictionary OfflineAudioContextOptions {
required float sampleRate; required float sampleRate;
}; };
[Exposed=Window, [Exposed=Window]
Constructor (OfflineAudioContextOptions contextOptions),
Constructor (unsigned long numberOfChannels, unsigned long length, float sampleRate)]
interface OfflineAudioContext : BaseAudioContext { interface OfflineAudioContext : BaseAudioContext {
[Throws] constructor(OfflineAudioContextOptions contextOptions);
[Throws] constructor(unsigned long numberOfChannels, unsigned long length, float sampleRate);
readonly attribute unsigned long length; readonly attribute unsigned long length;
attribute EventHandler oncomplete; attribute EventHandler oncomplete;

View file

@ -13,9 +13,9 @@ dictionary ImageEncodeOptions {
//enum OffscreenRenderingContextId { "2d", "webgl", "webgl2" }; //enum OffscreenRenderingContextId { "2d", "webgl", "webgl2" };
[Constructor([EnforceRange] unsigned long long width, [EnforceRange] unsigned long long height), [Exposed=(Window,Worker)/*, Transferable*/, Pref="dom.offscreen_canvas.enabled"]
Exposed=(Window,Worker)/*, Transferable*/, Pref="dom.offscreen_canvas.enabled"]
interface OffscreenCanvas : EventTarget { interface OffscreenCanvas : EventTarget {
[Throws] constructor([EnforceRange] unsigned long long width, [EnforceRange] unsigned long long height);
attribute /*[EnforceRange]*/ unsigned long long width; attribute /*[EnforceRange]*/ unsigned long long width;
attribute /*[EnforceRange]*/ unsigned long long height; attribute /*[EnforceRange]*/ unsigned long long height;

View file

@ -21,9 +21,9 @@ dictionary OscillatorOptions : AudioNodeOptions {
// PeriodicWave periodicWave; // PeriodicWave periodicWave;
}; };
[Exposed=Window, [Exposed=Window]
Constructor (BaseAudioContext context, optional OscillatorOptions options = {})]
interface OscillatorNode : AudioScheduledSourceNode { interface OscillatorNode : AudioScheduledSourceNode {
[Throws] constructor(BaseAudioContext context, optional OscillatorOptions options = {});
[SetterThrows] [SetterThrows]
attribute OscillatorType type; attribute OscillatorType type;

View file

@ -3,9 +3,9 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://html.spec.whatwg.org/multipage/#the-pagetransitionevent-interface // https://html.spec.whatwg.org/multipage/#the-pagetransitionevent-interface
[Constructor(DOMString type, optional PageTransitionEventInit eventInitDict = {}), [Exposed=Window]
Exposed=Window]
interface PageTransitionEvent : Event { interface PageTransitionEvent : Event {
[Throws] constructor(DOMString type, optional PageTransitionEventInit eventInitDict = {});
readonly attribute boolean persisted; readonly attribute boolean persisted;
}; };

View file

@ -34,9 +34,9 @@ enum PanningModelType {
"HRTF" "HRTF"
}; };
[Exposed=Window, [Exposed=Window]
Constructor (BaseAudioContext context, optional PannerOptions options = {})]
interface PannerNode : AudioNode { interface PannerNode : AudioNode {
[Throws] constructor(BaseAudioContext context, optional PannerOptions options = {});
attribute PanningModelType panningModel; attribute PanningModelType panningModel;
readonly attribute AudioParam positionX; readonly attribute AudioParam positionX;
readonly attribute AudioParam positionY; readonly attribute AudioParam positionY;

View file

@ -13,9 +13,9 @@ dictionary PerformanceObserverInit {
callback PerformanceObserverCallback = void (PerformanceObserverEntryList entries, PerformanceObserver observer); callback PerformanceObserverCallback = void (PerformanceObserverEntryList entries, PerformanceObserver observer);
[Constructor(PerformanceObserverCallback callback), [Exposed=(Window,Worker)]
Exposed=(Window,Worker)]
interface PerformanceObserver { interface PerformanceObserver {
[Throws] constructor(PerformanceObserverCallback callback);
[Throws] [Throws]
void observe(PerformanceObserverInit options); void observe(PerformanceObserverInit options);
void disconnect(); void disconnect();

View file

@ -3,9 +3,9 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://html.spec.whatwg.org/multipage/#the-popstateevent-interface // https://html.spec.whatwg.org/multipage/#the-popstateevent-interface
[Constructor(DOMString type, optional PopStateEventInit eventInitDict = {}), [Exposed=Window]
Exposed=Window]
interface PopStateEvent : Event { interface PopStateEvent : Event {
[Throws] constructor(DOMString type, optional PopStateEventInit eventInitDict = {});
readonly attribute any state; readonly attribute any state;
}; };

View file

@ -12,9 +12,9 @@
* http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0. * http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0.
*/ */
[Constructor(DOMString type, optional ProgressEventInit eventInitDict = {}), [Exposed=(Window,Worker)]
Exposed=(Window,Worker)]
interface ProgressEvent : Event { interface ProgressEvent : Event {
[Throws] constructor(DOMString type, optional ProgressEventInit eventInitDict = {});
readonly attribute boolean lengthComputable; readonly attribute boolean lengthComputable;
readonly attribute unsigned long long loaded; readonly attribute unsigned long long loaded;
readonly attribute unsigned long long total; readonly attribute unsigned long long total;

View file

@ -4,8 +4,9 @@
// https://html.spec.whatwg.org/multipage/#the-promiserejectionevent-interface // https://html.spec.whatwg.org/multipage/#the-promiserejectionevent-interface
[Constructor(DOMString type, optional PromiseRejectionEventInit eventInitDict = {}), Exposed=(Window,Worker)] [Exposed=(Window,Worker)]
interface PromiseRejectionEvent : Event { interface PromiseRejectionEvent : Event {
[Throws] constructor(DOMString type, optional PromiseRejectionEventInit eventInitDict = {});
readonly attribute Promise<any> promise; readonly attribute Promise<any> promise;
readonly attribute any reason; readonly attribute any reason;
}; };

View file

@ -5,9 +5,9 @@
// https://w3c.github.io/webrtc-pc/#rtcicecandidate-interface // https://w3c.github.io/webrtc-pc/#rtcicecandidate-interface
[Constructor(optional RTCIceCandidateInit candidateInitDict = {}), [Exposed=Window, Pref="dom.webrtc.enabled"]
Exposed=Window, Pref="dom.webrtc.enabled"]
interface RTCIceCandidate { interface RTCIceCandidate {
[Throws] constructor(optional RTCIceCandidateInit candidateInitDict = {});
readonly attribute DOMString candidate; readonly attribute DOMString candidate;
readonly attribute DOMString? sdpMid; readonly attribute DOMString? sdpMid;
readonly attribute unsigned short? sdpMLineIndex; readonly attribute unsigned short? sdpMLineIndex;

View file

@ -4,9 +4,9 @@
// https://w3c.github.io/webrtc-pc/#interface-definition // https://w3c.github.io/webrtc-pc/#interface-definition
[Constructor(optional RTCConfiguration configuration = {}), [Exposed=Window, Pref="dom.webrtc.enabled"]
Exposed=Window, Pref="dom.webrtc.enabled"]
interface RTCPeerConnection : EventTarget { interface RTCPeerConnection : EventTarget {
[Throws] constructor(optional RTCConfiguration configuration = {});
Promise<RTCSessionDescriptionInit> createOffer(optional RTCOfferOptions options = {}); Promise<RTCSessionDescriptionInit> createOffer(optional RTCOfferOptions options = {});
Promise<RTCSessionDescriptionInit> createAnswer(optional RTCAnswerOptions options = {}); Promise<RTCSessionDescriptionInit> createAnswer(optional RTCAnswerOptions options = {});
Promise<void> setLocalDescription(RTCSessionDescriptionInit description); Promise<void> setLocalDescription(RTCSessionDescriptionInit description);

View file

@ -4,9 +4,9 @@
// https://w3c.github.io/webrtc-pc/#rtcpeerconnectioniceevent // https://w3c.github.io/webrtc-pc/#rtcpeerconnectioniceevent
[Constructor(DOMString type, optional RTCPeerConnectionIceEventInit eventInitDict = {}), [Exposed=Window, Pref="dom.webrtc.enabled"]
Exposed=Window, Pref="dom.webrtc.enabled"]
interface RTCPeerConnectionIceEvent : Event { interface RTCPeerConnectionIceEvent : Event {
[Throws] constructor(DOMString type, optional RTCPeerConnectionIceEventInit eventInitDict = {});
readonly attribute RTCIceCandidate? candidate; readonly attribute RTCIceCandidate? candidate;
readonly attribute DOMString? url; readonly attribute DOMString? url;
}; };

View file

@ -4,9 +4,9 @@
// https://w3c.github.io/webrtc-pc/#rtcsessiondescription-class // https://w3c.github.io/webrtc-pc/#rtcsessiondescription-class
[Constructor(RTCSessionDescriptionInit descriptionInitDict), [Exposed=Window, Pref="dom.webrtc.enabled"]
Exposed=Window, Pref="dom.webrtc.enabled"]
interface RTCSessionDescription { interface RTCSessionDescription {
[Throws] constructor(RTCSessionDescriptionInit descriptionInitDict);
readonly attribute RTCSdpType type; readonly attribute RTCSdpType type;
readonly attribute DOMString sdp; readonly attribute DOMString sdp;
[Default] object toJSON(); [Default] object toJSON();

View file

@ -4,9 +4,9 @@
// https://w3c.github.io/webrtc-pc/#dom-rtctrackevent // https://w3c.github.io/webrtc-pc/#dom-rtctrackevent
[Constructor(DOMString type, RTCTrackEventInit eventInitDict), [Exposed=Window, Pref="dom.webrtc.enabled"]
Exposed=Window, Pref="dom.webrtc.enabled"]
interface RTCTrackEvent : Event { interface RTCTrackEvent : Event {
[Throws] constructor(DOMString type, RTCTrackEventInit eventInitDict);
// readonly attribute RTCRtpReceiver receiver; // readonly attribute RTCRtpReceiver receiver;
readonly attribute MediaStreamTrack track; readonly attribute MediaStreamTrack track;
// [SameObject] // [SameObject]

View file

@ -8,8 +8,8 @@
* http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom-view/Overview.html#extensions-to-the-range-interface * http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom-view/Overview.html#extensions-to-the-range-interface
*/ */
[Constructor]
interface Range { interface Range {
[Throws] constructor();
[Pure] [Pure]
readonly attribute Node startContainer; readonly attribute Node startContainer;
[Pure] [Pure]

View file

@ -6,10 +6,9 @@
typedef (Request or USVString) RequestInfo; typedef (Request or USVString) RequestInfo;
[Constructor(RequestInfo input, optional RequestInit init = {}), [Exposed=(Window,Worker)]
Exposed=(Window,Worker)]
interface Request { interface Request {
[Throws] constructor(RequestInfo input, optional RequestInit init = {});
readonly attribute ByteString method; readonly attribute ByteString method;
readonly attribute USVString url; readonly attribute USVString url;
[SameObject] readonly attribute Headers headers; [SameObject] readonly attribute Headers headers;

View file

@ -4,9 +4,9 @@
// https://fetch.spec.whatwg.org/#response-class // https://fetch.spec.whatwg.org/#response-class
[Constructor(optional BodyInit? body = null, optional ResponseInit init = {}), [Exposed=(Window,Worker)]
Exposed=(Window,Worker)]
interface Response { interface Response {
[Throws] constructor(optional BodyInit? body = null, optional ResponseInit init = {});
[NewObject] static Response error(); [NewObject] static Response error();
[NewObject, Throws] static Response redirect(USVString url, optional unsigned short status = 302); [NewObject, Throws] static Response redirect(USVString url, optional unsigned short status = 302);

View file

@ -10,8 +10,8 @@ dictionary StereoPannerOptions: AudioNodeOptions {
float pan = 0; float pan = 0;
}; };
[Exposed=Window, [Exposed=Window]
Constructor (BaseAudioContext context, optional StereoPannerOptions options = {})]
interface StereoPannerNode : AudioScheduledSourceNode { interface StereoPannerNode : AudioScheduledSourceNode {
[Throws] constructor(BaseAudioContext context, optional StereoPannerOptions options = {});
readonly attribute AudioParam pan; readonly attribute AudioParam pan;
}; };

View file

@ -9,8 +9,9 @@
* Event sent to a window when a storage area changes. * Event sent to a window when a storage area changes.
*/ */
[Constructor(DOMString type, optional StorageEventInit eventInitDict = {}), Exposed=Window] [Exposed=Window]
interface StorageEvent : Event { interface StorageEvent : Event {
[Throws] constructor(DOMString type, optional StorageEventInit eventInitDict = {});
readonly attribute DOMString? key; readonly attribute DOMString? key;
readonly attribute DOMString? oldValue; readonly attribute DOMString? oldValue;
readonly attribute DOMString? newValue; readonly attribute DOMString? newValue;

View file

@ -86,13 +86,13 @@ dictionary TestDictionaryDefaults {
object? nullableObjectValue = null; object? nullableObjectValue = null;
}; };
[Constructor, [Pref="dom.testbinding.enabled",
Constructor(sequence<unrestricted double> numberSequence),
Constructor(unrestricted double num),
Pref="dom.testbinding.enabled",
Exposed=(Window,Worker) Exposed=(Window,Worker)
] ]
interface TestBinding { interface TestBinding {
[Throws] constructor();
[Throws] constructor(sequence<unrestricted double> numberSequence);
[Throws] constructor(unrestricted double num);
attribute boolean booleanAttribute; attribute boolean booleanAttribute;
attribute byte byteAttribute; attribute byte byteAttribute;
attribute octet octetAttribute; attribute octet octetAttribute;

View file

@ -5,8 +5,9 @@
// This interface is entirely internal to Servo, and should not be accessible to // This interface is entirely internal to Servo, and should not be accessible to
// web pages. // web pages.
[Pref="dom.testbinding.enabled", Exposed=(Window,Worker), Constructor] [Pref="dom.testbinding.enabled", Exposed=(Window,Worker)]
interface TestBindingIterable { interface TestBindingIterable {
[Throws] constructor();
void add(DOMString arg); void add(DOMString arg);
readonly attribute unsigned long length; readonly attribute unsigned long length;
getter DOMString getItem(unsigned long index); getter DOMString getItem(unsigned long index);

View file

@ -5,8 +5,9 @@
// This interface is entirely internal to Servo, and should not be accessible to // This interface is entirely internal to Servo, and should not be accessible to
// web pages. // web pages.
[Pref="dom.testbinding.enabled", Exposed=(Window,Worker), Constructor] [Pref="dom.testbinding.enabled", Exposed=(Window,Worker)]
interface TestBindingPairIterable { interface TestBindingPairIterable {
[Throws] constructor();
void add(DOMString key, unsigned long value); void add(DOMString key, unsigned long value);
iterable<DOMString, unsigned long>; iterable<DOMString, unsigned long>;
}; };

View file

@ -5,8 +5,9 @@
// This interface is entirely internal to Servo, and should not be accessible to // This interface is entirely internal to Servo, and should not be accessible to
// web pages. // web pages.
[Pref="dom.worklet.testing.enabled", Exposed=(Window), Constructor] [Pref="dom.worklet.testing.enabled", Exposed=(Window)]
interface TestWorklet { interface TestWorklet {
[Throws] constructor();
[NewObject] Promise<void> addModule(USVString moduleURL, optional WorkletOptions options = {}); [NewObject] Promise<void> addModule(USVString moduleURL, optional WorkletOptions options = {});
DOMString? lookup(DOMString key); DOMString? lookup(DOMString key);
}; };

View file

@ -10,8 +10,8 @@
*/ */
// https://dom.spec.whatwg.org/#text // https://dom.spec.whatwg.org/#text
[Constructor(optional DOMString data = "")]
interface Text : CharacterData { interface Text : CharacterData {
[Throws] constructor(optional DOMString data = "");
[NewObject, Throws] [NewObject, Throws]
Text splitText(unsigned long offset); Text splitText(unsigned long offset);
[Pure] [Pure]

View file

@ -12,8 +12,9 @@ dictionary TextDecodeOptions {
boolean stream = false; boolean stream = false;
}; };
[Constructor(optional DOMString label = "utf-8", optional TextDecoderOptions options = {}), Exposed=(Window,Worker)] [Exposed=(Window,Worker)]
interface TextDecoder { interface TextDecoder {
[Throws] constructor(optional DOMString label = "utf-8", optional TextDecoderOptions options = {});
readonly attribute DOMString encoding; readonly attribute DOMString encoding;
readonly attribute boolean fatal; readonly attribute boolean fatal;
readonly attribute boolean ignoreBOM; readonly attribute boolean ignoreBOM;

View file

@ -3,8 +3,9 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/* https://encoding.spec.whatwg.org/#interface-textencoder */ /* https://encoding.spec.whatwg.org/#interface-textencoder */
[Constructor, Exposed=(Window,Worker)] [Exposed=(Window,Worker)]
interface TextEncoder { interface TextEncoder {
[Throws] constructor();
readonly attribute DOMString encoding; readonly attribute DOMString encoding;
[NewObject] [NewObject]
Uint8Array encode(optional USVString input = ""); Uint8Array encode(optional USVString input = "");

View file

@ -4,9 +4,9 @@
// https://html.spec.whatwg.org/multipage/#the-trackevent-interface // https://html.spec.whatwg.org/multipage/#the-trackevent-interface
[Exposed=Window, [Exposed=Window]
Constructor(DOMString type, optional TrackEventInit eventInitDict = {})]
interface TrackEvent : Event { interface TrackEvent : Event {
[Throws] constructor(DOMString type, optional TrackEventInit eventInitDict = {});
readonly attribute (VideoTrack or AudioTrack or TextTrack)? track; readonly attribute (VideoTrack or AudioTrack or TextTrack)? track;
}; };

View file

@ -6,9 +6,9 @@
* https://dom.spec.whatwg.org/#event * https://dom.spec.whatwg.org/#event
*/ */
[Constructor(DOMString type, optional TransitionEventInit transitionEventInitDict = {}), [Exposed=Window]
Exposed=Window]
interface TransitionEvent : Event { interface TransitionEvent : Event {
[Throws] constructor(DOMString type, optional TransitionEventInit transitionEventInitDict = {});
readonly attribute DOMString propertyName; readonly attribute DOMString propertyName;
readonly attribute float elapsedTime; readonly attribute float elapsedTime;
readonly attribute DOMString pseudoElement; readonly attribute DOMString pseudoElement;

View file

@ -3,8 +3,8 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://w3c.github.io/uievents/#interface-uievent // https://w3c.github.io/uievents/#interface-uievent
[Constructor(DOMString type, optional UIEventInit eventInitDict = {})]
interface UIEvent : Event { interface UIEvent : Event {
[Throws] constructor(DOMString type, optional UIEventInit eventInitDict = {});
// readonly attribute WindowProxy? view; // readonly attribute WindowProxy? view;
readonly attribute Window? view; readonly attribute Window? view;
readonly attribute long detail; readonly attribute long detail;

View file

@ -3,8 +3,9 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://url.spec.whatwg.org/#url // https://url.spec.whatwg.org/#url
[Constructor(USVString url, optional USVString base), Exposed=(Window,Worker)] [Exposed=(Window,Worker)]
interface URL { interface URL {
[Throws] constructor(USVString url, optional USVString base);
[SetterThrows] [SetterThrows]
/*stringifier*/ attribute USVString href; /*stringifier*/ attribute USVString href;
readonly attribute USVString origin; readonly attribute USVString origin;

View file

@ -6,10 +6,10 @@
* https://url.spec.whatwg.org/#interface-urlsearchparams * https://url.spec.whatwg.org/#interface-urlsearchparams
*/ */
[Constructor( [Exposed=(Window,Worker)]
optional (sequence<sequence<USVString>> or record<USVString, USVString> or USVString) init/* = ""*/
), Exposed=(Window,Worker)]
interface URLSearchParams { interface URLSearchParams {
[Throws] constructor(
optional (sequence<sequence<USVString>> or record<USVString, USVString> or USVString) init);
void append(USVString name, USVString value); void append(USVString name, USVString value);
void delete(USVString name); void delete(USVString name);
USVString? get(USVString name); USVString? get(USVString name);

View file

@ -11,8 +11,9 @@ enum VRDisplayEventReason {
"requested" "requested"
}; };
[Pref="dom.webvr.enabled", Constructor(DOMString type, VRDisplayEventInit eventInitDict)] [Pref="dom.webvr.enabled"]
interface VRDisplayEvent : Event { interface VRDisplayEvent : Event {
[Throws] constructor(DOMString type, VRDisplayEventInit eventInitDict);
readonly attribute VRDisplay display; readonly attribute VRDisplay display;
readonly attribute VRDisplayEventReason? reason; readonly attribute VRDisplayEventReason? reason;
}; };

View file

@ -4,8 +4,9 @@
// https://w3c.github.io/webvr/#interface-vrframedata // https://w3c.github.io/webvr/#interface-vrframedata
[Pref="dom.webvr.enabled", Constructor] [Pref="dom.webvr.enabled"]
interface VRFrameData { interface VRFrameData {
[Throws] constructor();
readonly attribute DOMHighResTimeStamp timestamp; readonly attribute DOMHighResTimeStamp timestamp;
readonly attribute Float32Array leftProjectionMatrix; readonly attribute Float32Array leftProjectionMatrix;
readonly attribute Float32Array leftViewMatrix; readonly attribute Float32Array leftViewMatrix;

View file

@ -3,9 +3,9 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15 // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15
[Constructor(DOMString type, optional WebGLContextEventInit eventInit = {}), [Exposed=Window]
Exposed=Window]
interface WebGLContextEvent : Event { interface WebGLContextEvent : Event {
[Throws] constructor(DOMString type, optional WebGLContextEventInit eventInit = {});
readonly attribute DOMString statusMessage; readonly attribute DOMString statusMessage;
}; };

View file

@ -6,8 +6,9 @@
enum BinaryType { "blob", "arraybuffer" }; enum BinaryType { "blob", "arraybuffer" };
[Constructor(DOMString url, optional (DOMString or sequence<DOMString>) protocols), Exposed=(Window,Worker)] [Exposed=(Window,Worker)]
interface WebSocket : EventTarget { interface WebSocket : EventTarget {
[Throws] constructor(DOMString url, optional (DOMString or sequence<DOMString>) protocols);
readonly attribute DOMString url; readonly attribute DOMString url;
//ready state //ready state
const unsigned short CONNECTING = 0; const unsigned short CONNECTING = 0;

View file

@ -3,9 +3,9 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://w3c.github.io/uievents/#interface-wheelevent // https://w3c.github.io/uievents/#interface-wheelevent
[Constructor(DOMString typeArg, optional WheelEventInit wheelEventInitDict = {}), [Exposed=Window]
Exposed=Window]
interface WheelEvent : MouseEvent { interface WheelEvent : MouseEvent {
[Throws] constructor(DOMString typeArg, optional WheelEventInit wheelEventInitDict = {});
const unsigned long DOM_DELTA_PIXEL = 0x00; const unsigned long DOM_DELTA_PIXEL = 0x00;
const unsigned long DOM_DELTA_LINE = 0x01; const unsigned long DOM_DELTA_LINE = 0x01;
const unsigned long DOM_DELTA_PAGE = 0x02; const unsigned long DOM_DELTA_PAGE = 0x02;

View file

@ -9,8 +9,9 @@ interface mixin AbstractWorker {
}; };
// https://html.spec.whatwg.org/multipage/#worker // https://html.spec.whatwg.org/multipage/#worker
[Constructor(USVString scriptURL, optional WorkerOptions options = {}), Exposed=(Window,Worker)] [Exposed=(Window,Worker)]
interface Worker : EventTarget { interface Worker : EventTarget {
[Throws] constructor(USVString scriptURL, optional WorkerOptions options = {});
void terminate(); void terminate();
[Throws] void postMessage(any message/*, sequence<object> transfer*/); [Throws] void postMessage(any message/*, sequence<object> transfer*/);

View file

@ -24,8 +24,9 @@ enum XMLHttpRequestResponseType {
"text" "text"
}; };
[Constructor, Exposed=(Window,Worker)] [Exposed=(Window,Worker)]
interface XMLHttpRequest : XMLHttpRequestEventTarget { interface XMLHttpRequest : XMLHttpRequestEventTarget {
[Throws] constructor();
// event handler // event handler
attribute EventHandler onreadystatechange; attribute EventHandler onreadystatechange;

View file

@ -6,8 +6,8 @@
* https://w3c.github.io/DOM-Parsing/#the-domparser-interface * https://w3c.github.io/DOM-Parsing/#the-domparser-interface
*/ */
[Constructor]
interface XMLSerializer { interface XMLSerializer {
[Throws] constructor();
[Throws] [Throws]
DOMString serializeToString(Node root); DOMString serializeToString(Node root);
}; };

Some files were not shown because too many files have changed in this diff Show more