mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Auto merge of #23748 - saschanaz:default-dict, r=Manishearth
Sync WebIDL.py with gecko <!-- Please describe your changes on the following line: --> The new change requires default dictionary value for optional dictionary-type arguments. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #23703 <!-- Either: --> - [x] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23748) <!-- Reviewable:end -->
This commit is contained in:
commit
026e550d35
106 changed files with 832 additions and 319 deletions
6
Cargo.lock
generated
6
Cargo.lock
generated
|
@ -3969,7 +3969,7 @@ dependencies = [
|
|||
name = "script_plugins"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"weedle 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"weedle 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -5534,7 +5534,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "weedle"
|
||||
version = "0.9.0"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"nom 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -6180,7 +6180,7 @@ dependencies = [
|
|||
"checksum webrender_build 0.0.1 (git+https://github.com/jdm/webrender?branch=servo-hl)" = "<none>"
|
||||
"checksum webxr 0.0.1 (git+https://github.com/servo/webxr)" = "<none>"
|
||||
"checksum webxr-api 0.0.1 (git+https://github.com/servo/webxr)" = "<none>"
|
||||
"checksum weedle 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc44aa200daee8b1f3a004beaf16554369746f1b4486f0cf93b0caf8a3c2d1e"
|
||||
"checksum weedle 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3bb43f70885151e629e2a19ce9e50bd730fd436cfd4b666894c9ce4de9141164"
|
||||
"checksum which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b57acb10231b9493c8472b20cb57317d0679a49e0bdbee44b3b803a6473af164"
|
||||
"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770"
|
||||
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
|
|
@ -17,6 +17,7 @@ import functools
|
|||
from WebIDL import (
|
||||
BuiltinTypes,
|
||||
IDLBuiltinType,
|
||||
IDLDefaultDictionaryValue,
|
||||
IDLEmptySequenceValue,
|
||||
IDLInterfaceMember,
|
||||
IDLNullableType,
|
||||
|
@ -678,13 +679,16 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
|
|||
return None
|
||||
|
||||
if isinstance(defaultValue, IDLNullValue):
|
||||
assert type.nullable() or type.isDictionary()
|
||||
assert type.nullable()
|
||||
return nullValue
|
||||
elif isinstance(defaultValue, IDLDefaultDictionaryValue):
|
||||
assert type.isDictionary()
|
||||
return nullValue
|
||||
elif isinstance(defaultValue, IDLEmptySequenceValue):
|
||||
assert type.isSequence()
|
||||
return "Vec::new()"
|
||||
|
||||
raise TypeError("Can't handle non-null or non-empty sequence default value here")
|
||||
raise TypeError("Can't handle non-null, non-empty sequence or non-empty dictionary default value here")
|
||||
|
||||
# A helper function for wrapping up the template body for
|
||||
# possibly-nullable objecty stuff
|
||||
|
@ -747,17 +751,19 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
|
|||
for memberType in type.unroll().flatMemberTypes
|
||||
if memberType.isDictionary()
|
||||
]
|
||||
if defaultValue and not isinstance(defaultValue, IDLNullValue):
|
||||
if (defaultValue and
|
||||
not isinstance(defaultValue, IDLNullValue) and
|
||||
not isinstance(defaultValue, IDLDefaultDictionaryValue)):
|
||||
tag = defaultValue.type.tag()
|
||||
if tag is IDLType.Tags.bool:
|
||||
default = "%s::Boolean(%s)" % (
|
||||
union_native_type(type),
|
||||
"true" if defaultValue.value else "false")
|
||||
else:
|
||||
raise("We don't currently support default values that aren't null or boolean")
|
||||
raise("We don't currently support default values that aren't null, boolean or default dictionary")
|
||||
elif dictionaries:
|
||||
if defaultValue:
|
||||
assert isinstance(defaultValue, IDLNullValue)
|
||||
assert isinstance(defaultValue, IDLDefaultDictionaryValue)
|
||||
dictionary, = dictionaries
|
||||
default = "%s::%s(%s::%s::empty())" % (
|
||||
union_native_type(type),
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# 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 http://mozilla.org/MPL/2.0/.
|
||||
|
||||
""" A WebIDL parser. """
|
||||
|
||||
from __future__ import print_function
|
||||
from ply import lex, yacc
|
||||
import re
|
||||
import os
|
||||
import traceback
|
||||
import math
|
||||
import string
|
||||
from collections import defaultdict
|
||||
from collections import defaultdict, OrderedDict
|
||||
from itertools import chain
|
||||
|
||||
# Machinery
|
||||
|
||||
|
@ -40,32 +42,22 @@ def parseInt(literal):
|
|||
return value * sign
|
||||
|
||||
|
||||
# Magic for creating enums
|
||||
def M_add_class_attribs(attribs, start):
|
||||
def foo(name, bases, dict_):
|
||||
for v, k in enumerate(attribs):
|
||||
dict_[k] = start + v
|
||||
assert 'length' not in dict_
|
||||
dict_['length'] = start + len(attribs)
|
||||
return type(name, bases, dict_)
|
||||
return foo
|
||||
|
||||
|
||||
def enum(*names, **kw):
|
||||
if len(kw) == 1:
|
||||
base = kw['base'].__class__
|
||||
start = base.length
|
||||
else:
|
||||
assert len(kw) == 0
|
||||
base = object
|
||||
start = 0
|
||||
|
||||
class Foo(base):
|
||||
__metaclass__ = M_add_class_attribs(names, start)
|
||||
|
||||
class Foo(object):
|
||||
attrs = OrderedDict()
|
||||
def __init__(self, names):
|
||||
for v, k in enumerate(names):
|
||||
self.attrs[k] = v
|
||||
def __getattr__(self, attr):
|
||||
if attr in self.attrs:
|
||||
return self.attrs[attr]
|
||||
raise AttributeError
|
||||
def __setattr__(self, name, value): # this makes it read-only
|
||||
raise NotImplementedError
|
||||
return Foo()
|
||||
|
||||
if "base" not in kw:
|
||||
return Foo(names)
|
||||
return Foo(chain(kw["base"].attrs.keys(), names))
|
||||
|
||||
|
||||
class WebIDLError(Exception):
|
||||
|
@ -482,9 +474,6 @@ class IDLExposureMixins():
|
|||
def isExposedOnMainThread(self):
|
||||
return self.isExposedInWindow()
|
||||
|
||||
def isExposedOffMainThread(self):
|
||||
return len(self.exposureSet - {'Window', 'FakeTestPrimaryGlobal'}) > 0
|
||||
|
||||
def isExposedInAnyWorker(self):
|
||||
return len(self.getWorkerExposureSet()) > 0
|
||||
|
||||
|
@ -568,6 +557,9 @@ class IDLExternalInterface(IDLObjectWithIdentifier, IDLExposureMixins):
|
|||
def isNavigatorProperty(self):
|
||||
return False
|
||||
|
||||
def isSerializable(self):
|
||||
return False
|
||||
|
||||
def _getDependentObjects(self):
|
||||
return set()
|
||||
|
||||
|
@ -704,6 +696,7 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins):
|
|||
# outputs the constructs in the order that namedConstructors enumerates
|
||||
# them.
|
||||
self.namedConstructors = list()
|
||||
self.legacyWindowAliases = []
|
||||
self.implementedInterfaces = set()
|
||||
self._consequential = False
|
||||
self._isKnownNonPartial = False
|
||||
|
@ -774,6 +767,16 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins):
|
|||
|
||||
IDLExposureMixins.finish(self, scope)
|
||||
|
||||
if len(self.legacyWindowAliases) > 0:
|
||||
if not self.hasInterfaceObject():
|
||||
raise WebIDLError("Interface %s unexpectedly has [LegacyWindowAlias] "
|
||||
"and [NoInterfaceObject] together" % self.identifier.name,
|
||||
[self.location])
|
||||
if not self.isExposedInWindow():
|
||||
raise WebIDLError("Interface %s has [LegacyWindowAlias] "
|
||||
"but not exposed in Window" % self.identifier.name,
|
||||
[self.location])
|
||||
|
||||
# Now go ahead and merge in our partial interfaces.
|
||||
for partial in self._partialInterfaces:
|
||||
partial.finish(scope)
|
||||
|
@ -962,7 +965,6 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins):
|
|||
# self.members. Sort our consequential interfaces by name
|
||||
# just so we have a consistent order.
|
||||
for iface in sorted(self.getConsequentialInterfaces(),
|
||||
cmp=cmp,
|
||||
key=lambda x: x.identifier.name):
|
||||
# Flag the interface as being someone's consequential interface
|
||||
iface.setIsConsequentialInterfaceOf(self)
|
||||
|
@ -1325,6 +1327,7 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins):
|
|||
for bindingAlias in member.bindingAliases:
|
||||
checkDuplicateNames(member, bindingAlias, "BindingAlias")
|
||||
|
||||
|
||||
# Conditional exposure makes no sense for interfaces with no
|
||||
# interface object, unless they're navigator properties.
|
||||
# And SecureContext makes sense for interfaces with no interface object,
|
||||
|
@ -1640,6 +1643,11 @@ class IDLInterface(IDLInterfaceOrNamespace):
|
|||
raise WebIDLError(str(identifier) + " must take no arguments",
|
||||
[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 []
|
||||
|
||||
retType = IDLWrapperType(self.location, self)
|
||||
|
@ -1700,6 +1708,10 @@ class IDLInterface(IDLInterfaceOrNamespace):
|
|||
"an interface with inherited interfaces",
|
||||
[attr.location, self.location])
|
||||
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():
|
||||
self.globalNames = [attr.value()]
|
||||
elif attr.hasArgs():
|
||||
|
@ -1723,6 +1735,18 @@ class IDLInterface(IDLInterfaceOrNamespace):
|
|||
self.parentScope.addIfaceGlobalNames(self.identifier.name,
|
||||
[self.identifier.name])
|
||||
self._isOnGlobalProtoChain = True
|
||||
elif identifier == "LegacyWindowAlias":
|
||||
if attr.hasValue():
|
||||
self.legacyWindowAliases = [attr.value()]
|
||||
elif attr.hasArgs():
|
||||
self.legacyWindowAliases = attr.args()
|
||||
else:
|
||||
raise WebIDLError("[%s] must either take an identifier "
|
||||
"or take an identifier list" % identifier,
|
||||
[attr.location])
|
||||
for alias in self.legacyWindowAliases:
|
||||
unresolved = IDLUnresolvedIdentifier(attr.location, alias)
|
||||
IDLObjectWithIdentifier(attr.location, self.parentScope, unresolved)
|
||||
elif identifier == "SecureContext":
|
||||
if not attr.noArguments():
|
||||
raise WebIDLError("[%s] must take no arguments" % identifier,
|
||||
|
@ -1744,6 +1768,7 @@ class IDLInterface(IDLInterfaceOrNamespace):
|
|||
identifier == "LegacyUnenumerableNamedProperties" or
|
||||
identifier == "RunConstructorInCallerCompartment" or
|
||||
identifier == "WantsEventListenerHooks" or
|
||||
identifier == "Serializable" or
|
||||
identifier == "Abstract" or
|
||||
identifier == "Inline"):
|
||||
# Known extended attributes that do not take values
|
||||
|
@ -1770,6 +1795,19 @@ class IDLInterface(IDLInterfaceOrNamespace):
|
|||
attrlist = attr.listValue()
|
||||
self._extendedAttrDict[identifier] = attrlist if len(attrlist) else True
|
||||
|
||||
def validate(self):
|
||||
IDLInterfaceOrNamespace.validate(self)
|
||||
if self.parent and self.isSerializable() and not self.parent.isSerializable():
|
||||
raise WebIDLError(
|
||||
"Serializable interface inherits from non-serializable "
|
||||
"interface. Per spec, that means the object should not be "
|
||||
"serializable, so chances are someone made a mistake here "
|
||||
"somewhere.",
|
||||
[self.location, self.parent.location])
|
||||
|
||||
def isSerializable(self):
|
||||
return self.getExtendedAttribute("Serializable")
|
||||
|
||||
|
||||
class IDLNamespace(IDLInterfaceOrNamespace):
|
||||
def __init__(self, location, parentScope, name, members, isKnownNonPartial):
|
||||
|
@ -1805,7 +1843,9 @@ class IDLNamespace(IDLInterfaceOrNamespace):
|
|||
if not attr.noArguments():
|
||||
raise WebIDLError("[%s] must not have arguments" % identifier,
|
||||
[attr.location])
|
||||
elif identifier == "Pref" or identifier == "Func":
|
||||
elif (identifier == "Pref" or
|
||||
identifier == "HeaderFile" or
|
||||
identifier == "Func"):
|
||||
# Known extended attributes that take a string value
|
||||
if not attr.hasValue():
|
||||
raise WebIDLError("[%s] must have a value" % identifier,
|
||||
|
@ -1818,6 +1858,9 @@ class IDLNamespace(IDLInterfaceOrNamespace):
|
|||
attrlist = attr.listValue()
|
||||
self._extendedAttrDict[identifier] = attrlist if len(attrlist) else True
|
||||
|
||||
def isSerializable(self):
|
||||
return False
|
||||
|
||||
|
||||
class IDLDictionary(IDLObjectWithScope):
|
||||
def __init__(self, location, parentScope, name, parent, members):
|
||||
|
@ -1877,7 +1920,7 @@ class IDLDictionary(IDLObjectWithScope):
|
|||
assert member.type.isComplete()
|
||||
|
||||
# Members of a dictionary are sorted in lexicographic order
|
||||
self.members.sort(cmp=cmp, key=lambda x: x.identifier.name)
|
||||
self.members.sort(key=lambda x: x.identifier.name)
|
||||
|
||||
inheritedMembers = []
|
||||
ancestor = self.parent
|
||||
|
@ -2232,7 +2275,7 @@ class IDLUnresolvedType(IDLType):
|
|||
|
||||
assert obj
|
||||
if obj.isType():
|
||||
print obj
|
||||
print(obj)
|
||||
assert not obj.isType()
|
||||
if obj.isTypedef():
|
||||
assert self.name.name == obj.identifier.name
|
||||
|
@ -3562,8 +3605,6 @@ class IDLNullValue(IDLObject):
|
|||
def coerceToType(self, type, location):
|
||||
if (not isinstance(type, IDLNullableType) and
|
||||
not (type.isUnion() and type.hasNullableType) and
|
||||
not (type.isUnion() and type.hasDictionaryType()) and
|
||||
not type.isDictionary() and
|
||||
not type.isAny()):
|
||||
raise WebIDLError("Cannot coerce null value to type %s." % type,
|
||||
[location])
|
||||
|
@ -3612,6 +3653,35 @@ class IDLEmptySequenceValue(IDLObject):
|
|||
return set()
|
||||
|
||||
|
||||
class IDLDefaultDictionaryValue(IDLObject):
|
||||
def __init__(self, location):
|
||||
IDLObject.__init__(self, location)
|
||||
self.type = None
|
||||
self.value = None
|
||||
|
||||
def coerceToType(self, type, location):
|
||||
if type.isUnion():
|
||||
# We use the flat member types here, because if we have a nullable
|
||||
# member type, or a nested union, we want the type the value
|
||||
# actually coerces to, not the nullable or nested union type.
|
||||
for subtype in type.unroll().flatMemberTypes:
|
||||
try:
|
||||
return self.coerceToType(subtype, location)
|
||||
except:
|
||||
pass
|
||||
|
||||
if not type.isDictionary():
|
||||
raise WebIDLError("Cannot coerce default dictionary value to type %s." % type,
|
||||
[location])
|
||||
|
||||
defaultDictionaryValue = IDLDefaultDictionaryValue(self.location)
|
||||
defaultDictionaryValue.type = type
|
||||
return defaultDictionaryValue
|
||||
|
||||
def _getDependentObjects(self):
|
||||
return set()
|
||||
|
||||
|
||||
class IDLUndefinedValue(IDLObject):
|
||||
def __init__(self, location):
|
||||
IDLObject.__init__(self, location)
|
||||
|
@ -3689,7 +3759,7 @@ class IDLInterfaceMember(IDLObjectWithIdentifier, IDLExposureMixins):
|
|||
def finish(self, scope):
|
||||
# We better be exposed _somewhere_.
|
||||
if (len(self._exposureGlobalNames) == 0):
|
||||
print self.identifier.name
|
||||
print(self.identifier.name)
|
||||
assert len(self._exposureGlobalNames) != 0
|
||||
IDLExposureMixins.finish(self, scope)
|
||||
|
||||
|
@ -4577,7 +4647,9 @@ class IDLArgument(IDLObjectWithIdentifier):
|
|||
elif identifier == "TreatNonCallableAsNull":
|
||||
self._allowTreatNonCallableAsNull = True
|
||||
elif (self.dictionaryMember and
|
||||
(identifier == "ChromeOnly" or identifier == "Func")):
|
||||
(identifier == "ChromeOnly" or
|
||||
identifier == "Func" or
|
||||
identifier == "Pref")):
|
||||
if not self.optional:
|
||||
raise WebIDLError("[%s] must not be used on a required "
|
||||
"dictionary member" % identifier,
|
||||
|
@ -4609,14 +4681,7 @@ class IDLArgument(IDLObjectWithIdentifier):
|
|||
assert not isinstance(type.name, IDLUnresolvedIdentifier)
|
||||
self.type = type
|
||||
|
||||
if ((self.type.isDictionary() or
|
||||
self.type.isUnion() and self.type.unroll().hasDictionaryType()) and
|
||||
self.optional and not self.defaultValue and not self.variadic and
|
||||
not self.dictionaryMember):
|
||||
# Default optional non-variadic dictionary arguments to null,
|
||||
# for simplicity, so the codegen doesn't have to special-case this.
|
||||
self.defaultValue = IDLNullValue(self.location)
|
||||
elif self.type.isAny():
|
||||
if self.type.isAny():
|
||||
assert (self.defaultValue is None or
|
||||
isinstance(self.defaultValue, IDLNullValue))
|
||||
# optional 'any' values always have a default value
|
||||
|
@ -4648,7 +4713,7 @@ class IDLArgument(IDLObjectWithIdentifier):
|
|||
|
||||
|
||||
class IDLCallback(IDLObjectWithScope):
|
||||
def __init__(self, location, parentScope, identifier, returnType, arguments):
|
||||
def __init__(self, location, parentScope, identifier, returnType, arguments, isConstructor):
|
||||
assert isinstance(returnType, IDLType)
|
||||
|
||||
self._returnType = returnType
|
||||
|
@ -4663,10 +4728,15 @@ class IDLCallback(IDLObjectWithScope):
|
|||
|
||||
self._treatNonCallableAsNull = False
|
||||
self._treatNonObjectAsNull = False
|
||||
self._isRunScriptBoundary = False
|
||||
self._isConstructor = isConstructor
|
||||
|
||||
def isCallback(self):
|
||||
return True
|
||||
|
||||
def isConstructor(self):
|
||||
return self._isConstructor
|
||||
|
||||
def signatures(self):
|
||||
return [(self._returnType, self._arguments)]
|
||||
|
||||
|
@ -4699,7 +4769,16 @@ class IDLCallback(IDLObjectWithScope):
|
|||
if attr.identifier() == "TreatNonCallableAsNull":
|
||||
self._treatNonCallableAsNull = True
|
||||
elif attr.identifier() == "TreatNonObjectAsNull":
|
||||
if self._isConstructor:
|
||||
raise WebIDLError("[TreatNonObjectAsNull] is not supported "
|
||||
"on constructors", [self.location])
|
||||
self._treatNonObjectAsNull = True
|
||||
elif attr.identifier() == "MOZ_CAN_RUN_SCRIPT_BOUNDARY":
|
||||
if self._isConstructor:
|
||||
raise WebIDLError("[MOZ_CAN_RUN_SCRIPT_BOUNDARY] is not "
|
||||
"permitted on constructors",
|
||||
[self.location])
|
||||
self._isRunScriptBoundary = True
|
||||
else:
|
||||
unhandledAttrs.append(attr)
|
||||
if self._treatNonCallableAsNull and self._treatNonObjectAsNull:
|
||||
|
@ -4711,6 +4790,9 @@ class IDLCallback(IDLObjectWithScope):
|
|||
def _getDependentObjects(self):
|
||||
return set([self._returnType] + self._arguments)
|
||||
|
||||
def isRunScriptBoundary(self):
|
||||
return self._isRunScriptBoundary;
|
||||
|
||||
|
||||
class IDLCallbackType(IDLType):
|
||||
def __init__(self, location, callback):
|
||||
|
@ -4757,6 +4839,9 @@ class IDLMethodOverload:
|
|||
deps.add(self.returnType)
|
||||
return deps
|
||||
|
||||
def includesRestrictedFloatArgument(self):
|
||||
return any(arg.type.includesRestrictedFloat() for arg in self.arguments)
|
||||
|
||||
|
||||
class IDLMethod(IDLInterfaceMember, IDLScope):
|
||||
|
||||
|
@ -4929,6 +5014,21 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
|||
assert len(method._overloads) == 1
|
||||
|
||||
if self._extendedAttrDict != method._extendedAttrDict:
|
||||
extendedAttrDiff = set(self._extendedAttrDict.keys()) ^ set(method._extendedAttrDict.keys())
|
||||
|
||||
if extendedAttrDiff == { "LenientFloat" }:
|
||||
if "LenientFloat" not in self._extendedAttrDict:
|
||||
for overload in self._overloads:
|
||||
if overload.includesRestrictedFloatArgument():
|
||||
raise WebIDLError("Restricted float behavior differs on different "
|
||||
"overloads of %s" % method.identifier,
|
||||
[overload.location, method.location])
|
||||
self._extendedAttrDict["LenientFloat"] = method._extendedAttrDict["LenientFloat"]
|
||||
elif method._overloads[0].includesRestrictedFloatArgument():
|
||||
raise WebIDLError("Restricted float behavior differs on different "
|
||||
"overloads of %s" % method.identifier,
|
||||
[self.location, method.location])
|
||||
else:
|
||||
raise WebIDLError("Extended attributes differ on different "
|
||||
"overloads of %s" % method.identifier,
|
||||
[self.location, method.location])
|
||||
|
@ -5039,6 +5139,15 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
|||
"must be optional",
|
||||
[argument.location])
|
||||
|
||||
if (not argument.defaultValue and
|
||||
all(arg.optional for arg in arguments[idx+1:])):
|
||||
raise WebIDLError("Dictionary argument without any "
|
||||
"required fields or union argument "
|
||||
"containing such dictionary not "
|
||||
"followed by a required argument "
|
||||
"must have a default value",
|
||||
[argument.location])
|
||||
|
||||
# An argument cannot be a Nullable Dictionary
|
||||
if argument.type.nullable():
|
||||
raise WebIDLError("An argument cannot be a nullable "
|
||||
|
@ -5162,12 +5271,12 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
|||
[attr.location, self.location])
|
||||
elif identifier == "LenientFloat":
|
||||
# This is called before we've done overload resolution
|
||||
assert len(self.signatures()) == 1
|
||||
sig = self.signatures()[0]
|
||||
if not sig[0].isVoid():
|
||||
overloads = self._overloads
|
||||
assert len(overloads) == 1
|
||||
if not overloads[0].returnType.isVoid():
|
||||
raise WebIDLError("[LenientFloat] used on a non-void method",
|
||||
[attr.location, self.location])
|
||||
if not any(arg.type.includesRestrictedFloat() for arg in sig[1]):
|
||||
if not overloads[0].includesRestrictedFloatArgument():
|
||||
raise WebIDLError("[LenientFloat] used on an operation with no "
|
||||
"restricted float type arguments",
|
||||
[attr.location, self.location])
|
||||
|
@ -5238,7 +5347,7 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
|||
if self.signatures()[0][0] != BuiltinTypes[IDLBuiltinType.Types.object]:
|
||||
raise WebIDLError("The return type of the default toJSON "
|
||||
"operation must be 'object'",
|
||||
[attr.location, self.location]);
|
||||
[attr.location, self.location])
|
||||
elif (identifier == "Throws" or
|
||||
identifier == "CanOOM" or
|
||||
identifier == "NewObject" or
|
||||
|
@ -5251,7 +5360,8 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
|||
identifier == "NeedsSubjectPrincipal" or
|
||||
identifier == "NeedsCallerType" or
|
||||
identifier == "StaticClassOverride" or
|
||||
identifier == "NonEnumerable"):
|
||||
identifier == "NonEnumerable" or
|
||||
identifier == "Unexposed"):
|
||||
# Known attributes that we don't need to do anything with here
|
||||
pass
|
||||
else:
|
||||
|
@ -5478,6 +5588,7 @@ class Tokenizer(object):
|
|||
"iterable": "ITERABLE",
|
||||
"namespace": "NAMESPACE",
|
||||
"ReadableStream": "READABLESTREAM",
|
||||
"constructor": "CONSTRUCTOR",
|
||||
}
|
||||
|
||||
tokens.extend(keywords.values())
|
||||
|
@ -5604,6 +5715,7 @@ class Parser(Tokenizer):
|
|||
def p_CallbackRestOrInterface(self, p):
|
||||
"""
|
||||
CallbackRestOrInterface : CallbackRest
|
||||
| CallbackConstructorRest
|
||||
| Interface
|
||||
"""
|
||||
assert p[1]
|
||||
|
@ -5637,7 +5749,7 @@ class Parser(Tokenizer):
|
|||
[location, existingObj.location])
|
||||
existingObj.setNonPartial(*nonPartialArgs)
|
||||
return existingObj
|
||||
except Exception, ex:
|
||||
except Exception as ex:
|
||||
if isinstance(ex, WebIDLError):
|
||||
raise ex
|
||||
pass
|
||||
|
@ -5675,7 +5787,7 @@ class Parser(Tokenizer):
|
|||
"%s and %s" % (identifier.name, p[0]),
|
||||
[location, p[0].location])
|
||||
return
|
||||
except Exception, ex:
|
||||
except Exception as ex:
|
||||
if isinstance(ex, WebIDLError):
|
||||
raise ex
|
||||
pass
|
||||
|
@ -5739,7 +5851,7 @@ class Parser(Tokenizer):
|
|||
"non-%s object" %
|
||||
(prettyname, prettyname),
|
||||
[location, nonPartialObject.location])
|
||||
except Exception, ex:
|
||||
except Exception as ex:
|
||||
if isinstance(ex, WebIDLError):
|
||||
raise ex
|
||||
pass
|
||||
|
@ -5905,12 +6017,23 @@ class Parser(Tokenizer):
|
|||
"""
|
||||
DefaultValue : ConstValue
|
||||
| LBRACKET RBRACKET
|
||||
| LBRACE RBRACE
|
||||
"""
|
||||
if len(p) == 2:
|
||||
p[0] = p[1]
|
||||
else:
|
||||
assert len(p) == 3 # Must be []
|
||||
assert len(p) == 3 # Must be [] or {}
|
||||
if p[1] == "[":
|
||||
p[0] = IDLEmptySequenceValue(self.getLocation(p, 1))
|
||||
else:
|
||||
assert p[1] == "{"
|
||||
p[0] = IDLDefaultDictionaryValue(self.getLocation(p, 1))
|
||||
|
||||
def p_DefaultValueNull(self, p):
|
||||
"""
|
||||
DefaultValue : NULL
|
||||
"""
|
||||
p[0] = IDLNullValue(self.getLocation(p, 1))
|
||||
|
||||
def p_Exception(self, p):
|
||||
"""
|
||||
|
@ -5967,7 +6090,15 @@ class Parser(Tokenizer):
|
|||
"""
|
||||
identifier = IDLUnresolvedIdentifier(self.getLocation(p, 1), p[1])
|
||||
p[0] = IDLCallback(self.getLocation(p, 1), self.globalScope(),
|
||||
identifier, p[3], p[5])
|
||||
identifier, p[3], p[5], isConstructor=False)
|
||||
|
||||
def p_CallbackConstructorRest(self, p):
|
||||
"""
|
||||
CallbackConstructorRest : CONSTRUCTOR IDENTIFIER EQUALS ReturnType LPAREN ArgumentList RPAREN SEMICOLON
|
||||
"""
|
||||
identifier = IDLUnresolvedIdentifier(self.getLocation(p, 2), p[2])
|
||||
p[0] = IDLCallback(self.getLocation(p, 2), self.globalScope(),
|
||||
identifier, p[4], p[6], isConstructor=True)
|
||||
|
||||
def p_ExceptionMembers(self, p):
|
||||
"""
|
||||
|
@ -6041,12 +6172,6 @@ class Parser(Tokenizer):
|
|||
stringType = BuiltinTypes[IDLBuiltinType.Types.domstring]
|
||||
p[0] = IDLValue(location, stringType, p[1])
|
||||
|
||||
def p_ConstValueNull(self, p):
|
||||
"""
|
||||
ConstValue : NULL
|
||||
"""
|
||||
p[0] = IDLNullValue(self.getLocation(p, 1))
|
||||
|
||||
def p_BooleanLiteralTrue(self, p):
|
||||
"""
|
||||
BooleanLiteral : TRUE
|
||||
|
@ -6442,6 +6567,7 @@ class Parser(Tokenizer):
|
|||
| ATTRIBUTE
|
||||
| CALLBACK
|
||||
| CONST
|
||||
| CONSTRUCTOR
|
||||
| DELETER
|
||||
| DICTIONARY
|
||||
| ENUM
|
||||
|
@ -6566,6 +6692,7 @@ class Parser(Tokenizer):
|
|||
| BYTE
|
||||
| LEGACYCALLER
|
||||
| CONST
|
||||
| CONSTRUCTOR
|
||||
| DELETER
|
||||
| DOUBLE
|
||||
| EXCEPTION
|
||||
|
@ -6619,9 +6746,9 @@ class Parser(Tokenizer):
|
|||
"""
|
||||
p[0] = p[2].withExtendedAttributes(p[1])
|
||||
|
||||
def p_SingleTypeNonAnyType(self, p):
|
||||
def p_SingleTypeDistinguishableType(self, p):
|
||||
"""
|
||||
SingleType : NonAnyType
|
||||
SingleType : DistinguishableType
|
||||
"""
|
||||
p[0] = p[1]
|
||||
|
||||
|
@ -6631,6 +6758,14 @@ class Parser(Tokenizer):
|
|||
"""
|
||||
p[0] = BuiltinTypes[IDLBuiltinType.Types.any]
|
||||
|
||||
# Note: Promise<void> is allowed, so we want to parametrize on ReturnType,
|
||||
# not Type. Promise types can't be null, hence no "Null" in there.
|
||||
def p_SingleTypePromiseType(self, p):
|
||||
"""
|
||||
SingleType : PROMISE LT ReturnType GT
|
||||
"""
|
||||
p[0] = IDLPromiseType(self.getLocation(p, 1), p[3])
|
||||
|
||||
def p_UnionType(self, p):
|
||||
"""
|
||||
UnionType : LPAREN UnionMemberType OR UnionMemberType UnionMemberTypes RPAREN
|
||||
|
@ -6639,9 +6774,9 @@ class Parser(Tokenizer):
|
|||
types.extend(p[5])
|
||||
p[0] = IDLUnionType(self.getLocation(p, 1), types)
|
||||
|
||||
def p_UnionMemberTypeNonAnyType(self, p):
|
||||
def p_UnionMemberTypeDistinguishableType(self, p):
|
||||
"""
|
||||
UnionMemberType : ExtendedAttributeList NonAnyType
|
||||
UnionMemberType : ExtendedAttributeList DistinguishableType
|
||||
"""
|
||||
p[0] = p[2].withExtendedAttributes(p[1])
|
||||
|
||||
|
@ -6664,9 +6799,9 @@ class Parser(Tokenizer):
|
|||
"""
|
||||
p[0] = []
|
||||
|
||||
def p_NonAnyType(self, p):
|
||||
def p_DistinguishableType(self, p):
|
||||
"""
|
||||
NonAnyType : PrimitiveType Null
|
||||
DistinguishableType : PrimitiveType Null
|
||||
| ARRAYBUFFER Null
|
||||
| SHAREDARRAYBUFFER Null
|
||||
| READABLESTREAM Null
|
||||
|
@ -6685,40 +6820,32 @@ class Parser(Tokenizer):
|
|||
|
||||
p[0] = self.handleNullable(type, p[2])
|
||||
|
||||
def p_NonAnyTypeStringType(self, p):
|
||||
def p_DistinguishableTypeStringType(self, p):
|
||||
"""
|
||||
NonAnyType : StringType Null
|
||||
DistinguishableType : StringType Null
|
||||
"""
|
||||
p[0] = self.handleNullable(p[1], p[2])
|
||||
|
||||
def p_NonAnyTypeSequenceType(self, p):
|
||||
def p_DistinguishableTypeSequenceType(self, p):
|
||||
"""
|
||||
NonAnyType : SEQUENCE LT TypeWithExtendedAttributes GT Null
|
||||
DistinguishableType : SEQUENCE LT TypeWithExtendedAttributes GT Null
|
||||
"""
|
||||
innerType = p[3]
|
||||
type = IDLSequenceType(self.getLocation(p, 1), innerType)
|
||||
p[0] = self.handleNullable(type, p[5])
|
||||
|
||||
# Note: Promise<void> is allowed, so we want to parametrize on ReturnType,
|
||||
# not Type. Promise types can't be null, hence no "Null" in there.
|
||||
def p_NonAnyTypePromiseType(self, p):
|
||||
def p_DistinguishableTypeRecordType(self, p):
|
||||
"""
|
||||
NonAnyType : PROMISE LT ReturnType GT
|
||||
"""
|
||||
p[0] = IDLPromiseType(self.getLocation(p, 1), p[3])
|
||||
|
||||
def p_NonAnyTypeRecordType(self, p):
|
||||
"""
|
||||
NonAnyType : RECORD LT StringType COMMA TypeWithExtendedAttributes GT Null
|
||||
DistinguishableType : RECORD LT StringType COMMA TypeWithExtendedAttributes GT Null
|
||||
"""
|
||||
keyType = p[3]
|
||||
valueType = p[5]
|
||||
type = IDLRecordType(self.getLocation(p, 1), keyType, valueType)
|
||||
p[0] = self.handleNullable(type, p[7])
|
||||
|
||||
def p_NonAnyTypeScopedName(self, p):
|
||||
def p_DistinguishableTypeScopedName(self, p):
|
||||
"""
|
||||
NonAnyType : ScopedName Null
|
||||
DistinguishableType : ScopedName Null
|
||||
"""
|
||||
assert isinstance(p[1], IDLUnresolvedIdentifier)
|
||||
|
||||
|
@ -6748,28 +6875,26 @@ class Parser(Tokenizer):
|
|||
type = IDLUnresolvedType(self.getLocation(p, 1), p[1])
|
||||
p[0] = self.handleNullable(type, p[2])
|
||||
|
||||
def p_NonAnyTypeDate(self, p):
|
||||
def p_DistinguishableTypeDate(self, p):
|
||||
"""
|
||||
NonAnyType : DATE Null
|
||||
DistinguishableType : DATE Null
|
||||
"""
|
||||
p[0] = self.handleNullable(BuiltinTypes[IDLBuiltinType.Types.date],
|
||||
p[2])
|
||||
|
||||
def p_ConstType(self, p):
|
||||
"""
|
||||
ConstType : PrimitiveType Null
|
||||
ConstType : PrimitiveType
|
||||
"""
|
||||
type = BuiltinTypes[p[1]]
|
||||
p[0] = self.handleNullable(type, p[2])
|
||||
p[0] = BuiltinTypes[p[1]]
|
||||
|
||||
def p_ConstTypeIdentifier(self, p):
|
||||
"""
|
||||
ConstType : IDENTIFIER Null
|
||||
ConstType : IDENTIFIER
|
||||
"""
|
||||
identifier = IDLUnresolvedIdentifier(self.getLocation(p, 1), p[1])
|
||||
|
||||
type = IDLUnresolvedType(self.getLocation(p, 1), identifier)
|
||||
p[0] = self.handleNullable(type, p[2])
|
||||
p[0] = IDLUnresolvedType(self.getLocation(p, 1), identifier)
|
||||
|
||||
def p_PrimitiveTypeUint(self, p):
|
||||
"""
|
||||
|
@ -7040,8 +7165,8 @@ class Parser(Tokenizer):
|
|||
def _installBuiltins(self, scope):
|
||||
assert isinstance(scope, IDLScope)
|
||||
|
||||
# xrange omits the last value.
|
||||
for x in xrange(IDLBuiltinType.Types.ArrayBuffer, IDLBuiltinType.Types.Float64Array + 1):
|
||||
# range omits the last value.
|
||||
for x in range(IDLBuiltinType.Types.ArrayBuffer, IDLBuiltinType.Types.Float64Array + 1):
|
||||
builtin = BuiltinTypes[x]
|
||||
name = builtin.name
|
||||
typedef = IDLTypedef(BuiltinLocation("<builtin type>"), scope, builtin, name)
|
||||
|
@ -7185,14 +7310,14 @@ def main():
|
|||
f = open(fullPath, 'rb')
|
||||
lines = f.readlines()
|
||||
f.close()
|
||||
print fullPath
|
||||
print(fullPath)
|
||||
parser.parse(''.join(lines), fullPath)
|
||||
parser.finish()
|
||||
except WebIDLError, e:
|
||||
except WebIDLError as e:
|
||||
if options.verbose_errors:
|
||||
traceback.print_exc()
|
||||
else:
|
||||
print e
|
||||
print(e)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
--- WebIDL.py
|
||||
+++ WebIDL.py
|
||||
@@ -1786,7 +1786,8 @@ class IDLInterface(IDLInterfaceOrNamespace):
|
||||
identifier == "ProbablyShortLivingWrapper" or
|
||||
@@ -1768,7 +1768,8 @@ class IDLInterface(IDLInterfaceOrNamespace):
|
||||
identifier == "LegacyUnenumerableNamedProperties" or
|
||||
identifier == "RunConstructorInCallerCompartment" or
|
||||
- identifier == "WantsEventListenerHooks"):
|
||||
+ identifier == "WantsEventListenerHooks" or
|
||||
identifier == "WantsEventListenerHooks" or
|
||||
- identifier == "Serializable"):
|
||||
+ identifier == "Serializable" or
|
||||
+ identifier == "Abstract"):
|
||||
# Known extended attributes that do not take values
|
||||
if not attr.noArguments():
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--- WebIDL.py
|
||||
+++ WebIDL.py
|
||||
@@ -2275,7 +2275,7 @@ class IDLUnresolvedType(IDLType):
|
||||
return typedefType.complete(scope)
|
||||
@@ -2283,7 +2283,7 @@ class IDLUnresolvedType(IDLType):
|
||||
return typedefType.complete(scope).withExtendedAttributes(self.extraTypeAttributes)
|
||||
elif obj.isCallback() and not obj.isInterface():
|
||||
assert self.name.name == obj.identifier.name
|
||||
- return IDLCallbackType(self.location, obj)
|
||||
|
@ -9,7 +9,7 @@
|
|||
|
||||
name = self.name.resolve(scope, None)
|
||||
return IDLWrapperType(self.location, obj)
|
||||
@@ -6688,7 +6688,7 @@ class Parser(Tokenizer):
|
||||
@@ -6854,7 +6854,7 @@ class Parser(Tokenizer):
|
||||
type = IDLTypedefType(self.getLocation(p, 1), obj.innerType,
|
||||
obj.identifier.name)
|
||||
elif obj.isCallback() and not obj.isInterface():
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- WebIDL.py
|
||||
+++ WebIDL.py
|
||||
@@ -6959,7 +6959,8 @@ class Parser(Tokenizer):
|
||||
@@ -7123,7 +7123,8 @@ class Parser(Tokenizer):
|
||||
self.parser = yacc.yacc(module=self,
|
||||
outputdir=outputdir,
|
||||
tabmodule='webidlyacc',
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
--- WebIDL.py
|
||||
+++ WebIDL.py
|
||||
@@ -1787,7 +1787,8 @@ class IDLInterface(IDLInterfaceOrNamespace):
|
||||
identifier == "LegacyUnenumerableNamedProperties" or
|
||||
@@ -1769,7 +1769,8 @@ class IDLInterface(IDLInterfaceOrNamespace):
|
||||
identifier == "RunConstructorInCallerCompartment" or
|
||||
identifier == "WantsEventListenerHooks" or
|
||||
identifier == "Serializable" or
|
||||
- identifier == "Abstract"):
|
||||
+ identifier == "Abstract" or
|
||||
+ identifier == "Inline"):
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
--- WebIDL.py
|
||||
+++ WebIDL.py
|
||||
@@ -1362,12 +1362,6 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins):
|
||||
for bindingAlias in member.bindingAliases:
|
||||
checkDuplicateNames(member, bindingAlias, "BindingAlias")
|
||||
|
||||
-
|
||||
- if self.getExtendedAttribute("Pref") and self.isExposedOffMainThread():
|
||||
- raise WebIDLError("[Pref] used on an interface that is not "
|
||||
- "main-thread-only",
|
||||
- [self.location])
|
||||
-
|
||||
# Conditional exposure makes no sense for interfaces with no
|
||||
# interface object, unless they're navigator properties.
|
||||
# And SecureContext makes sense for interfaces with no interface object,
|
||||
@@ -3619,11 +3613,6 @@ class IDLInterfaceMember(IDLObjectWithIdentifier, IDLExposureMixins):
|
||||
IDLExposureMixins.finish(self, scope)
|
||||
|
||||
def validate(self):
|
||||
- if self.getExtendedAttribute("Pref") and self.isExposedOffMainThread():
|
||||
- raise WebIDLError("[Pref] used on an interface member that is not "
|
||||
- "main-thread-only",
|
||||
- [self.location])
|
||||
-
|
||||
if self.isAttr() or self.isMethod():
|
||||
if self.affects == "Everything" and self.dependsOn != "Everything":
|
||||
raise WebIDLError("Interface member is flagged as affecting "
|
|
@ -62,7 +62,7 @@ def run_tests(tests, verbose):
|
|||
harness.start()
|
||||
try:
|
||||
_test.WebIDLTest.__call__(WebIDL.Parser(), harness)
|
||||
except Exception, ex:
|
||||
except Exception as ex:
|
||||
print("TEST-UNEXPECTED-FAIL | Unhandled exception in test %s: %s" % (testpath, ex))
|
||||
traceback.print_exc()
|
||||
finally:
|
||||
|
|
|
@ -133,7 +133,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except Exception, x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow [SetterThrows] on readonly attributes")
|
||||
|
||||
|
@ -146,7 +146,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except Exception, x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "Should spell [Throws] correctly")
|
||||
|
||||
|
@ -159,7 +159,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except Exception, x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow [SameObject] on attributes not of interface type")
|
||||
|
||||
|
@ -172,6 +172,6 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except Exception, x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(not threw, "Should allow [SameObject] on attributes of interface type")
|
||||
|
|
|
@ -32,3 +32,6 @@ def WebIDLTest(parser, harness):
|
|||
harness.ok(not isinstance(t, WebIDL.IDLWrapperType), "Attr has the right type")
|
||||
harness.ok(isinstance(t, WebIDL.IDLNullableType), "Attr has the right type")
|
||||
harness.ok(t.isCallback(), "Attr has the right type")
|
||||
|
||||
callback = results[1]
|
||||
harness.ok(not callback.isConstructor(), "callback is not constructor")
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
import WebIDL
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
parser.parse("""
|
||||
interface TestCallbackConstructor {
|
||||
attribute CallbackConstructorType? constructorAttribute;
|
||||
};
|
||||
|
||||
callback constructor CallbackConstructorType = TestCallbackConstructor (unsigned long arg);
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
|
||||
harness.ok(True, "TestCallbackConstructor interface parsed without error.")
|
||||
harness.check(len(results), 2, "Should be two productions.")
|
||||
iface = results[0]
|
||||
harness.ok(isinstance(iface, WebIDL.IDLInterface),
|
||||
"Should be an IDLInterface")
|
||||
harness.check(iface.identifier.QName(), "::TestCallbackConstructor", "Interface has the right QName")
|
||||
harness.check(iface.identifier.name, "TestCallbackConstructor", "Interface has the right name")
|
||||
harness.check(len(iface.members), 1, "Expect %s members" % 1)
|
||||
|
||||
attr = iface.members[0]
|
||||
harness.ok(isinstance(attr, WebIDL.IDLAttribute),
|
||||
"Should be an IDLAttribute")
|
||||
harness.ok(attr.isAttr(), "Should be an attribute")
|
||||
harness.ok(not attr.isMethod(), "Attr is not an method")
|
||||
harness.ok(not attr.isConst(), "Attr is not a const")
|
||||
harness.check(attr.identifier.QName(), "::TestCallbackConstructor::constructorAttribute", "Attr has the right QName")
|
||||
harness.check(attr.identifier.name, "constructorAttribute", "Attr has the right name")
|
||||
t = attr.type
|
||||
harness.ok(not isinstance(t, WebIDL.IDLWrapperType), "Attr has the right type")
|
||||
harness.ok(isinstance(t, WebIDL.IDLNullableType), "Attr has the right type")
|
||||
harness.ok(t.isCallback(), "Attr has the right type")
|
||||
|
||||
callback = results[1]
|
||||
harness.ok(callback.isConstructor(), "Callback is constructor")
|
||||
|
||||
parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
[TreatNonObjectAsNull]
|
||||
callback constructor CallbackConstructorType = object ();
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should throw on TreatNonObjectAsNull callback constructors")
|
||||
|
||||
parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
[MOZ_CAN_RUN_SCRIPT_BOUNDARY]
|
||||
callback constructor CallbackConstructorType = object ();
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should not permit MOZ_CAN_RUN_SCRIPT_BOUNDARY callback constructors")
|
|
@ -38,7 +38,7 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
harness.ok(False, "Shouldn't have thrown for [CEReactions] used on writable attribute. %s" % e)
|
||||
threw = True
|
||||
|
||||
|
@ -52,7 +52,7 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
harness.ok(False, "Shouldn't have thrown for [CEReactions] used on regular operations. %s" % e)
|
||||
threw = True
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except Exception, exception:
|
||||
except Exception as exception:
|
||||
pass
|
||||
|
||||
harness.ok(exception, "Should have thrown.")
|
||||
|
@ -70,7 +70,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except Exception, exception:
|
||||
except Exception as exception:
|
||||
pass
|
||||
|
||||
harness.ok(exception, "Should have thrown (2).")
|
||||
|
@ -100,7 +100,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except Exception, exception:
|
||||
except Exception as exception:
|
||||
pass
|
||||
|
||||
harness.ok(exception, "Should have thrown (3).")
|
||||
|
|
|
@ -12,9 +12,6 @@ expected = [
|
|||
("::TestConsts::ll", "ll", "LongLong", -8),
|
||||
("::TestConsts::t", "t", "Boolean", True),
|
||||
("::TestConsts::f", "f", "Boolean", False),
|
||||
("::TestConsts::n", "n", "BooleanOrNull", None),
|
||||
("::TestConsts::nt", "nt", "BooleanOrNull", True),
|
||||
("::TestConsts::nf", "nf", "BooleanOrNull", False),
|
||||
("::TestConsts::fl", "fl", "Float", 0.2),
|
||||
("::TestConsts::db", "db", "Double", 0.2),
|
||||
("::TestConsts::ufl", "ufl", "UnrestrictedFloat", 0.2),
|
||||
|
@ -39,9 +36,6 @@ def WebIDLTest(parser, harness):
|
|||
const long long ll = -010;
|
||||
const boolean t = true;
|
||||
const boolean f = false;
|
||||
const boolean? n = null;
|
||||
const boolean? nt = true;
|
||||
const boolean? nf = false;
|
||||
const float fl = 0.2;
|
||||
const double db = 0.2;
|
||||
const unrestricted float ufl = 0.2;
|
||||
|
@ -78,3 +72,16 @@ def WebIDLTest(parser, harness):
|
|||
"Const's value has the same type as the type")
|
||||
harness.check(const.value.value, value, "Const value has the right value.")
|
||||
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface TestConsts {
|
||||
const boolean? zero = 0;
|
||||
};
|
||||
""")
|
||||
parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
harness.ok(threw, "Nullable types are not allowed for consts.")
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
[Constructor, 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 {
|
||||
};
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
[Global, NamedConstructor=FooBar]
|
||||
interface TestNamedConstructorGlobal {
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
[NamedConstructor=FooBar, Global]
|
||||
interface TestNamedConstructorGlobal {
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
[Global, HTMLConstructor]
|
||||
interface TestHTMLConstructorGlobal {
|
||||
};
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
[HTMLConstructor, Global]
|
||||
interface TestHTMLConstructorGlobal {
|
||||
};
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
|
@ -13,6 +13,7 @@ def WebIDLTest(parser, harness):
|
|||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
|
|
|
@ -167,6 +167,22 @@ def WebIDLTest(parser, harness):
|
|||
|
||||
harness.ok(threw, "Trailing dictionary arg must be optional")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
dictionary A {
|
||||
};
|
||||
interface X {
|
||||
void doFoo(optional A arg);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Trailing dictionary arg must have a default value")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
|
@ -184,6 +200,23 @@ def WebIDLTest(parser, harness):
|
|||
harness.ok(threw,
|
||||
"Trailing union arg containing a dictionary must be optional")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
dictionary A {
|
||||
};
|
||||
interface X {
|
||||
void doFoo(optional (A or DOMString) arg);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw,
|
||||
"Trailing union arg containing a dictionary must have a default value")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
|
@ -200,6 +233,22 @@ def WebIDLTest(parser, harness):
|
|||
|
||||
harness.ok(threw, "Dictionary arg followed by optional arg must be optional")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
dictionary A {
|
||||
};
|
||||
interface X {
|
||||
void doFoo(optional A arg1, optional long arg2);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Dictionary arg followed by optional arg must have default value")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
|
@ -235,6 +284,24 @@ def WebIDLTest(parser, harness):
|
|||
"Union arg containing dictionary followed by optional arg must "
|
||||
"be optional")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
dictionary A {
|
||||
};
|
||||
interface X {
|
||||
void doFoo(optional (A or DOMString) arg1, optional long arg2);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw,
|
||||
"Union arg containing dictionary followed by optional arg must "
|
||||
"have a default value")
|
||||
|
||||
parser = parser.reset()
|
||||
parser.parse("""
|
||||
dictionary A {
|
||||
|
@ -326,7 +393,7 @@ def WebIDLTest(parser, harness):
|
|||
dictionary A {
|
||||
};
|
||||
interface X {
|
||||
void doFoo(optional A arg);
|
||||
void doFoo(optional A arg = {});
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
|
@ -337,12 +404,23 @@ def WebIDLTest(parser, harness):
|
|||
dictionary A {
|
||||
};
|
||||
interface X {
|
||||
void doFoo(optional (A or DOMString) arg);
|
||||
void doFoo(optional (A or DOMString) arg = {});
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
harness.ok(True, "Union arg containing a dictionary should actually parse")
|
||||
|
||||
parser = parser.reset()
|
||||
parser.parse("""
|
||||
dictionary A {
|
||||
};
|
||||
interface X {
|
||||
void doFoo(optional (A or DOMString) arg = "abc");
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
harness.ok(True, "Union arg containing a dictionary with string default should actually parse")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
|
|
|
@ -3,13 +3,16 @@ def firstArgType(method):
|
|||
|
||||
def WebIDLTest(parser, harness):
|
||||
parser.parse("""
|
||||
// Give our dictionary a required member so we don't need to
|
||||
// mess with optional and default values.
|
||||
dictionary Dict {
|
||||
required long member;
|
||||
};
|
||||
callback interface Foo {
|
||||
};
|
||||
interface Bar {
|
||||
// Bit of a pain to get things that have dictionary types
|
||||
void passDict(optional Dict arg);
|
||||
void passDict(Dict arg);
|
||||
void passFoo(Foo arg);
|
||||
void passNullableUnion((object? or DOMString) arg);
|
||||
void passNullable(Foo? arg);
|
||||
|
@ -156,8 +159,8 @@ def WebIDLTest(parser, harness):
|
|||
"AncestorInterface", "UnrelatedInterface",
|
||||
"ImplementedInterface", "CallbackInterface",
|
||||
"CallbackInterface?", "CallbackInterface2",
|
||||
"object", "Callback", "Callback2", "optional Dict",
|
||||
"optional Dict2", "sequence<long>", "sequence<short>",
|
||||
"object", "Callback", "Callback2", "Dict",
|
||||
"Dict2", "sequence<long>", "sequence<short>",
|
||||
"record<DOMString, object>",
|
||||
"record<USVString, Dict>",
|
||||
"record<ByteString, long>",
|
||||
|
@ -165,7 +168,7 @@ def WebIDLTest(parser, harness):
|
|||
"Promise<any>", "Promise<any>?",
|
||||
"USVString", "ArrayBuffer", "ArrayBufferView", "SharedArrayBuffer",
|
||||
"Uint8Array", "Uint16Array",
|
||||
"(long or Callback)", "optional (long or Dict)",
|
||||
"(long or Callback)", "(long or Dict)",
|
||||
]
|
||||
# When we can parse Date, we need to add it here.
|
||||
# XXXbz we can, and should really do that...
|
||||
|
@ -174,7 +177,7 @@ def WebIDLTest(parser, harness):
|
|||
def allBut(list1, list2):
|
||||
return [a for a in list1 if a not in list2 and
|
||||
(a != "any" and a != "Promise<any>" and a != "Promise<any>?")]
|
||||
unions = [ "(long or Callback)", "optional (long or Dict)" ]
|
||||
unions = [ "(long or Callback)", "(long or Dict)" ]
|
||||
numerics = [ "long", "short", "long?", "short?" ]
|
||||
booleans = [ "boolean", "boolean?" ]
|
||||
primitives = numerics + booleans
|
||||
|
@ -189,7 +192,7 @@ def WebIDLTest(parser, harness):
|
|||
interfaces = [ "Interface", "Interface?", "AncestorInterface",
|
||||
"UnrelatedInterface", "ImplementedInterface" ] + bufferSourceTypes + sharedBufferSourceTypes
|
||||
nullables = (["long?", "short?", "boolean?", "Interface?",
|
||||
"CallbackInterface?", "optional Dict", "optional Dict2",
|
||||
"CallbackInterface?", "Dict", "Dict2",
|
||||
"Date?", "any", "Promise<any>?"] +
|
||||
allBut(unions, [ "(long or Callback)" ]))
|
||||
dates = [ "Date", "Date?" ]
|
||||
|
@ -233,8 +236,8 @@ def WebIDLTest(parser, harness):
|
|||
setDistinguishable("object", nonObjects)
|
||||
setDistinguishable("Callback", nonUserObjects)
|
||||
setDistinguishable("Callback2", nonUserObjects)
|
||||
setDistinguishable("optional Dict", allBut(nonUserObjects, nullables))
|
||||
setDistinguishable("optional Dict2", allBut(nonUserObjects, nullables))
|
||||
setDistinguishable("Dict", allBut(nonUserObjects, nullables))
|
||||
setDistinguishable("Dict2", allBut(nonUserObjects, nullables))
|
||||
setDistinguishable("sequence<long>",
|
||||
allBut(argTypes, sequences + ["object"]))
|
||||
setDistinguishable("sequence<short>",
|
||||
|
@ -254,7 +257,7 @@ def WebIDLTest(parser, harness):
|
|||
setDistinguishable("SharedArrayBuffer", allBut(argTypes, ["SharedArrayBuffer", "object"]))
|
||||
setDistinguishable("(long or Callback)",
|
||||
allBut(nonUserObjects, numerics))
|
||||
setDistinguishable("optional (long or Dict)",
|
||||
setDistinguishable("(long or Dict)",
|
||||
allBut(nonUserObjects, numerics + nullables))
|
||||
|
||||
def areDistinguishable(type1, type2):
|
||||
|
@ -273,8 +276,10 @@ def WebIDLTest(parser, harness):
|
|||
callback interface CallbackInterface2 {};
|
||||
callback Callback = any();
|
||||
callback Callback2 = long(short arg);
|
||||
dictionary Dict {};
|
||||
dictionary Dict2 {};
|
||||
// Give our dictionaries required members so we don't need to
|
||||
// mess with optional and default values.
|
||||
dictionary Dict { required long member; };
|
||||
dictionary Dict2 { required long member; };
|
||||
interface TestInterface {%s
|
||||
};
|
||||
"""
|
||||
|
|
|
@ -10,7 +10,7 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception,x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Constant cannot have [] as a default value")
|
||||
|
|
|
@ -8,7 +8,7 @@ def WebIDLTest(parser, harness):
|
|||
try:
|
||||
parser.parse(input)
|
||||
results = parser.finish()
|
||||
except WebIDL.WebIDLError, e:
|
||||
except WebIDL.WebIDLError as e:
|
||||
threw = True
|
||||
lines = str(e).split('\n')
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ interface ?"""
|
|||
try:
|
||||
parser.parse(input)
|
||||
results = parser.finish()
|
||||
except WebIDL.WebIDLError, e:
|
||||
except WebIDL.WebIDLError as e:
|
||||
threw = True
|
||||
lines = str(e).split('\n')
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception,x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown on invalid Exposed value on interface.")
|
||||
|
@ -140,7 +140,7 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception,x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown on invalid Exposed value on attribute.")
|
||||
|
@ -156,7 +156,7 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception,x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown on invalid Exposed value on operation.")
|
||||
|
@ -172,7 +172,7 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception,x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown on invalid Exposed value on constant.")
|
||||
|
@ -192,7 +192,7 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception,x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown on member exposed where its interface is not.")
|
||||
|
@ -216,7 +216,7 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception,x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown on LHS of implements being exposed where RHS is not.")
|
||||
|
|
|
@ -68,7 +68,7 @@ def WebIDLTest(parser, harness):
|
|||
long m(float arg);
|
||||
};
|
||||
""")
|
||||
except Exception, x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "[LenientFloat] only allowed on void methods")
|
||||
|
||||
|
@ -81,7 +81,7 @@ def WebIDLTest(parser, harness):
|
|||
void m(unrestricted float arg);
|
||||
};
|
||||
""")
|
||||
except Exception, x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "[LenientFloat] only allowed on methods with unrestricted float args")
|
||||
|
||||
|
@ -94,7 +94,7 @@ def WebIDLTest(parser, harness):
|
|||
void m(sequence<unrestricted float> arg);
|
||||
};
|
||||
""")
|
||||
except Exception, x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "[LenientFloat] only allowed on methods with unrestricted float args (2)")
|
||||
|
||||
|
@ -107,7 +107,7 @@ def WebIDLTest(parser, harness):
|
|||
void m((unrestricted float or FloatTypes) arg);
|
||||
};
|
||||
""")
|
||||
except Exception, x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "[LenientFloat] only allowed on methods with unrestricted float args (3)")
|
||||
|
||||
|
@ -120,6 +120,6 @@ def WebIDLTest(parser, harness):
|
|||
readonly attribute float foo;
|
||||
};
|
||||
""")
|
||||
except Exception, x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "[LenientFloat] only allowed on writable attributes")
|
||||
|
|
|
@ -9,7 +9,7 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
results = parser.finish()
|
||||
harness.ok(False, "Should fail to parse")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
harness.ok("Name collision" in e.message,
|
||||
"Should have name collision for interface")
|
||||
|
||||
|
@ -21,7 +21,7 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
results = parser.finish()
|
||||
harness.ok(False, "Should fail to parse")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
harness.ok("Name collision" in e.message,
|
||||
"Should have name collision for dictionary")
|
||||
|
||||
|
@ -33,7 +33,7 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
results = parser.finish()
|
||||
harness.ok(False, "Should fail to parse")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
harness.ok("Multiple unresolvable definitions" in e.message,
|
||||
"Should have name collision for dictionary")
|
||||
|
||||
|
|
|
@ -374,3 +374,89 @@ def WebIDLTest(parser, harness):
|
|||
threw = True
|
||||
harness.ok(threw,
|
||||
"Should not allow unknown extended attributes on interfaces")
|
||||
|
||||
parser = parser.reset()
|
||||
parser.parse("""
|
||||
[Global] interface Window {};
|
||||
[Exposed=Window, LegacyWindowAlias=A]
|
||||
interface B {};
|
||||
[Exposed=Window, LegacyWindowAlias=(C, D)]
|
||||
interface E {};
|
||||
""");
|
||||
results = parser.finish();
|
||||
harness.check(results[1].legacyWindowAliases, ["A"],
|
||||
"Should support a single identifier")
|
||||
harness.check(results[2].legacyWindowAliases, ["C", "D"],
|
||||
"Should support an identifier list")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
[LegacyWindowAlias]
|
||||
interface A {};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
harness.ok(threw,
|
||||
"Should not allow [LegacyWindowAlias] with no value")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
[Exposed=Worker, LegacyWindowAlias=B]
|
||||
interface A {};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
harness.ok(threw,
|
||||
"Should not allow [LegacyWindowAlias] without Window exposure")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
[Global] interface Window {};
|
||||
interface A {};
|
||||
[Exposed=Window, LegacyWindowAlias=A]
|
||||
interface B {};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
harness.ok(threw,
|
||||
"Should not allow [LegacyWindowAlias] to conflict with other identifiers")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
[Global] interface Window {};
|
||||
[Exposed=Window, LegacyWindowAlias=A]
|
||||
interface B {};
|
||||
interface A {};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
harness.ok(threw,
|
||||
"Should not allow [LegacyWindowAlias] to conflict with other identifiers")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
[Global] interface Window {};
|
||||
[Exposed=Window, LegacyWindowAlias=A]
|
||||
interface B {};
|
||||
[Exposed=Window, LegacyWindowAlias=A]
|
||||
interface C {};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
harness.ok(threw,
|
||||
"Should not allow [LegacyWindowAlias] to conflict with other identifiers")
|
||||
|
|
|
@ -37,10 +37,10 @@ def WebIDLTest(parser, harness):
|
|||
p.finish()
|
||||
harness.ok(False,
|
||||
prefix + " - Interface passed when should've failed")
|
||||
except WebIDL.WebIDLError, e:
|
||||
except WebIDL.WebIDLError as e:
|
||||
harness.ok(True,
|
||||
prefix + " - Interface failed as expected")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
harness.ok(False,
|
||||
prefix + " - Interface failed but not as a WebIDLError exception: %s" % e)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# 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 http://mozilla.org/MPL/2.0/.
|
||||
|
||||
def should_throw(parser, harness, message, code):
|
||||
parser = parser.reset();
|
||||
|
|
|
@ -120,7 +120,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except Exception, x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(not threw, "Should allow integer to float type corecion")
|
||||
|
||||
|
@ -133,7 +133,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except Exception, x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow [GetterThrows] on methods")
|
||||
|
||||
|
@ -146,7 +146,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except Exception, x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow [SetterThrows] on methods")
|
||||
|
||||
|
@ -159,7 +159,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except Exception, x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "Should spell [Throws] correctly on methods")
|
||||
|
||||
|
@ -172,6 +172,85 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except Exception, x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow __noSuchMethod__ methods")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface A {
|
||||
[Throws, LenientFloat]
|
||||
void foo(float myFloat);
|
||||
[Throws]
|
||||
void foo();
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(not threw, "Should allow LenientFloat to be only in a specific overload")
|
||||
|
||||
parser = parser.reset()
|
||||
parser.parse("""
|
||||
interface A {
|
||||
[Throws]
|
||||
void foo();
|
||||
[Throws, LenientFloat]
|
||||
void foo(float myFloat);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
iface = results[0]
|
||||
methods = iface.members
|
||||
lenientFloat = methods[0].getExtendedAttribute("LenientFloat")
|
||||
harness.ok(lenientFloat is not None, "LenientFloat in overloads must be added to the method")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface A {
|
||||
[Throws, LenientFloat]
|
||||
void foo(float myFloat);
|
||||
[Throws]
|
||||
void foo(float myFloat, float yourFloat);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "Should prevent overloads from getting different restricted float behavior")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface A {
|
||||
[Throws]
|
||||
void foo(float myFloat, float yourFloat);
|
||||
[Throws, LenientFloat]
|
||||
void foo(float myFloat);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "Should prevent overloads from getting different restricted float behavior (2)")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface A {
|
||||
[Throws, LenientFloat]
|
||||
void foo(float myFloat);
|
||||
[Throws, LenientFloat]
|
||||
void foo(short myShort);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "Should prevent overloads from getting redundant [LenientFloat]")
|
||||
|
|
|
@ -70,7 +70,7 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception, x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
|
@ -85,7 +85,7 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception, x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
|
@ -104,7 +104,7 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception, x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
|
@ -123,7 +123,7 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception, x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
|
@ -142,7 +142,7 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception, x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
|
@ -161,7 +161,7 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception, x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
|
@ -180,7 +180,7 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception, x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
|
@ -199,7 +199,7 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception, x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
|
@ -218,6 +218,6 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception, x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
|
|
@ -33,7 +33,7 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception,x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "Should have thrown because record can't have void as value type.")
|
||||
|
||||
|
@ -47,7 +47,7 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception,x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw,
|
||||
"Should have thrown on dictionary containing itself via record.")
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# 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 http://mozilla.org/MPL/2.0/.
|
||||
|
||||
def should_throw(parser, harness, message, code):
|
||||
parser = parser.reset();
|
||||
|
|
|
@ -4,15 +4,15 @@ def WebIDLTest(parser, harness):
|
|||
typedef long? mynullablelong;
|
||||
interface Foo {
|
||||
const mylong X = 5;
|
||||
const mynullablelong Y = 7;
|
||||
const mynullablelong Z = null;
|
||||
void foo(mylong arg);
|
||||
void foo(optional mynullablelong arg = 7);
|
||||
void bar(optional mynullablelong arg = null);
|
||||
void baz(mylong arg);
|
||||
};
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
|
||||
harness.check(results[2].members[1].type.name, "LongOrNull",
|
||||
harness.check(results[2].members[1].signatures()[0][1][0].type.name, "LongOrNull",
|
||||
"Should expand typedefs")
|
||||
|
||||
parser = parser.reset()
|
||||
|
|
|
@ -24,7 +24,7 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception, x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
|
@ -39,7 +39,7 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception, x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
|
@ -59,6 +59,6 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception, x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
|
|
@ -111,7 +111,7 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception,x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw,
|
||||
"Should have thrown when shadowing unforgeable attribute on "
|
||||
|
@ -130,7 +130,7 @@ def WebIDLTest(parser, harness):
|
|||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except Exception,x:
|
||||
except Exception as x:
|
||||
threw = True
|
||||
harness.ok(threw,
|
||||
"Should have thrown when shadowing unforgeable operation on "
|
||||
|
|
|
@ -17,7 +17,7 @@ def combinations(iterable, r):
|
|||
n = len(pool)
|
||||
if r > n:
|
||||
return
|
||||
indices = range(r)
|
||||
indices = list(range(r))
|
||||
yield tuple(pool[i] for i in indices)
|
||||
while True:
|
||||
for i in reversed(range(r)):
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
wget https://hg.mozilla.org/mozilla-central/raw-file/tip/dom/bindings/parser/WebIDL.py -O WebIDL.py
|
||||
patch < abstract.patch
|
||||
patch < debug.patch
|
||||
patch < pref-main-thread.patch
|
||||
patch < callback-location.patch
|
||||
patch < union-typedef.patch
|
||||
patch < inline.patch
|
||||
|
|
|
@ -14,7 +14,7 @@ dictionary AnalyserOptions : AudioNodeOptions {
|
|||
};
|
||||
|
||||
[Exposed=Window,
|
||||
Constructor (BaseAudioContext context, optional AnalyserOptions options)]
|
||||
Constructor (BaseAudioContext context, optional AnalyserOptions options = {})]
|
||||
interface AnalyserNode : AudioNode {
|
||||
void getFloatFrequencyData (Float32Array array);
|
||||
void getByteFrequencyData (Uint8Array array);
|
||||
|
|
|
@ -16,7 +16,7 @@ dictionary AudioBufferSourceOptions {
|
|||
};
|
||||
|
||||
[Exposed=Window,
|
||||
Constructor (BaseAudioContext context, optional AudioBufferSourceOptions options)]
|
||||
Constructor (BaseAudioContext context, optional AudioBufferSourceOptions options = {})]
|
||||
interface AudioBufferSourceNode : AudioScheduledSourceNode {
|
||||
[Throws] attribute AudioBuffer? buffer;
|
||||
readonly attribute AudioParam playbackRate;
|
||||
|
|
|
@ -23,7 +23,7 @@ dictionary AudioTimestamp {
|
|||
};
|
||||
|
||||
[Exposed=Window,
|
||||
Constructor(optional AudioContextOptions contextOptions)]
|
||||
Constructor(optional AudioContextOptions contextOptions = {})]
|
||||
interface AudioContext : BaseAudioContext {
|
||||
readonly attribute double baseLatency;
|
||||
readonly attribute double outputLatency;
|
||||
|
|
|
@ -26,7 +26,7 @@ dictionary BiquadFilterOptions : AudioNodeOptions {
|
|||
};
|
||||
|
||||
[Exposed=Window,
|
||||
Constructor (BaseAudioContext context, optional BiquadFilterOptions options)]
|
||||
Constructor (BaseAudioContext context, optional BiquadFilterOptions options = {})]
|
||||
interface BiquadFilterNode : AudioNode {
|
||||
attribute BiquadFilterType type;
|
||||
readonly attribute AudioParam frequency;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// https://w3c.github.io/FileAPI/#blob
|
||||
|
||||
[Constructor(optional sequence<BlobPart> blobParts,
|
||||
optional BlobPropertyBag options),
|
||||
optional BlobPropertyBag options = {}),
|
||||
Exposed=(Window,Worker)]
|
||||
interface Blob {
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ interface Bluetooth : EventTarget {
|
|||
// [SecureContext, SameObject]
|
||||
// readonly attribute BluetoothDevice? referringDevice;
|
||||
[SecureContext]
|
||||
Promise<BluetoothDevice> requestDevice(optional RequestDeviceOptions options);
|
||||
Promise<BluetoothDevice> requestDevice(optional RequestDeviceOptions options = {});
|
||||
};
|
||||
|
||||
// Bluetooth implements BluetoothDeviceEventHandlers;
|
||||
|
|
|
@ -11,6 +11,6 @@ dictionary ChannelMergerOptions : AudioNodeOptions {
|
|||
};
|
||||
|
||||
[Exposed=Window,
|
||||
Constructor (BaseAudioContext context, optional ChannelMergerOptions options)]
|
||||
Constructor (BaseAudioContext context, optional ChannelMergerOptions options = {})]
|
||||
interface ChannelMergerNode : AudioNode {
|
||||
};
|
||||
|
|
|
@ -11,6 +11,6 @@ dictionary ChannelSplitterOptions : AudioNodeOptions {
|
|||
};
|
||||
|
||||
[Exposed=Window,
|
||||
Constructor (BaseAudioContext context, optional ChannelSplitterOptions options)]
|
||||
Constructor (BaseAudioContext context, optional ChannelSplitterOptions options = {})]
|
||||
interface ChannelSplitterNode : AudioNode {
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
//https://html.spec.whatwg.org/multipage/#the-closeevent-interfaces
|
||||
[Constructor(DOMString type, optional CloseEventInit eventInitDict), Exposed=(Window,Worker)]
|
||||
[Constructor(DOMString type, optional CloseEventInit eventInitDict = {}), Exposed=(Window,Worker)]
|
||||
interface CloseEvent : Event {
|
||||
readonly attribute boolean wasClean;
|
||||
readonly attribute unsigned short code;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
|
||||
// https://w3c.github.io/uievents/#idl-compositionevent
|
||||
[Pref="dom.compositionevent.enabled", Constructor(DOMString type, optional CompositionEventInit eventInitDict)]
|
||||
[Pref="dom.compositionevent.enabled", Constructor(DOMString type, optional CompositionEventInit eventInitDict = {})]
|
||||
interface CompositionEvent : UIEvent {
|
||||
readonly attribute DOMString data;
|
||||
};
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
[Pref="dom.customelements.enabled"]
|
||||
interface CustomElementRegistry {
|
||||
[Throws, CEReactions]
|
||||
void define(DOMString name, CustomElementConstructor constructor_, optional ElementDefinitionOptions options);
|
||||
void define(DOMString name, CustomElementConstructor constructor_, optional ElementDefinitionOptions options = {});
|
||||
|
||||
any get(DOMString name);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
* http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0.
|
||||
*/
|
||||
|
||||
[Constructor(DOMString type, optional CustomEventInit eventInitDict),
|
||||
[Constructor(DOMString type, optional CustomEventInit eventInitDict = {}),
|
||||
Exposed=(Window,Worker)]
|
||||
interface CustomEvent : Event {
|
||||
readonly attribute any detail;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
Exposed=(Window,Worker)]
|
||||
interface DOMMatrix : DOMMatrixReadOnly {
|
||||
|
||||
[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 fromFloat64Array(Float64Array array64);
|
||||
|
||||
|
@ -44,8 +44,8 @@ interface DOMMatrix : DOMMatrixReadOnly {
|
|||
inherit attribute unrestricted double m44;
|
||||
|
||||
// Mutable transform methods
|
||||
[Throws] DOMMatrix multiplySelf(optional DOMMatrixInit other);
|
||||
[Throws] DOMMatrix preMultiplySelf(optional DOMMatrixInit other);
|
||||
[Throws] DOMMatrix multiplySelf(optional DOMMatrixInit other = {});
|
||||
[Throws] DOMMatrix preMultiplySelf(optional DOMMatrixInit other = {});
|
||||
DOMMatrix translateSelf(optional unrestricted double tx = 0,
|
||||
optional unrestricted double ty = 0,
|
||||
optional unrestricted double tz = 0);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
Exposed=(Window,Worker)]
|
||||
interface DOMMatrixReadOnly {
|
||||
|
||||
[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 fromFloat64Array(Float64Array array64);
|
||||
|
||||
|
@ -73,12 +73,12 @@ interface DOMMatrixReadOnly {
|
|||
optional unrestricted double angle = 0);
|
||||
DOMMatrix skewX(optional unrestricted double sx = 0);
|
||||
DOMMatrix skewY(optional unrestricted double sy = 0);
|
||||
[Throws] DOMMatrix multiply(optional DOMMatrixInit other);
|
||||
[Throws] DOMMatrix multiply(optional DOMMatrixInit other = {});
|
||||
DOMMatrix flipX();
|
||||
DOMMatrix flipY();
|
||||
DOMMatrix inverse();
|
||||
|
||||
DOMPoint transformPoint(optional DOMPointInit point);
|
||||
DOMPoint transformPoint(optional DOMPointInit point = {});
|
||||
Float32Array toFloat32Array();
|
||||
Float64Array toFloat64Array();
|
||||
// stringifier;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
optional unrestricted double z = 0, optional unrestricted double w = 1),
|
||||
Exposed=(Window,Worker)]
|
||||
interface DOMPoint : DOMPointReadOnly {
|
||||
[NewObject] static DOMPoint fromPoint(optional DOMPointInit other = null);
|
||||
[NewObject] static DOMPoint fromPoint(optional DOMPointInit other = {});
|
||||
|
||||
inherit attribute unrestricted double x;
|
||||
inherit attribute unrestricted double y;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
optional unrestricted double z = 0, optional unrestricted double w = 1),
|
||||
Exposed=(Window,Worker)]
|
||||
interface DOMPointReadOnly {
|
||||
[NewObject] static DOMPointReadOnly fromPoint(optional DOMPointInit other = null);
|
||||
[NewObject] static DOMPointReadOnly fromPoint(optional DOMPointInit other = {});
|
||||
|
||||
readonly attribute unrestricted double x;
|
||||
readonly attribute unrestricted double y;
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
* related or neighboring rights to this work.
|
||||
*/
|
||||
|
||||
[Constructor(optional DOMPointInit p1, optional DOMPointInit p2,
|
||||
optional DOMPointInit p3, optional DOMPointInit p4),
|
||||
[Constructor(optional DOMPointInit p1 = {}, optional DOMPointInit p2 = {},
|
||||
optional DOMPointInit p3 = {}, optional DOMPointInit p4 = {}),
|
||||
Exposed=(Window,Worker)]
|
||||
interface DOMQuad {
|
||||
[NewObject] static DOMQuad fromRect(optional DOMRectInit other);
|
||||
[NewObject] static DOMQuad fromQuad(optional DOMQuadInit other);
|
||||
[NewObject] static DOMQuad fromRect(optional DOMRectInit other = {});
|
||||
[NewObject] static DOMQuad fromQuad(optional DOMQuadInit other = {});
|
||||
|
||||
[SameObject] readonly attribute DOMPoint p1;
|
||||
[SameObject] readonly attribute DOMPoint p2;
|
||||
|
@ -25,8 +25,8 @@ interface DOMQuad {
|
|||
};
|
||||
|
||||
dictionary DOMQuadInit {
|
||||
DOMPointInit p1 = null;
|
||||
DOMPointInit p2 = null;
|
||||
DOMPointInit p3 = null;
|
||||
DOMPointInit p4 = null;
|
||||
DOMPointInit p1 = {};
|
||||
DOMPointInit p2 = {};
|
||||
DOMPointInit p3 = {};
|
||||
DOMPointInit p4 = {};
|
||||
};
|
||||
|
|
|
@ -33,9 +33,9 @@ interface Document : Node {
|
|||
HTMLCollection getElementsByClassName(DOMString classNames);
|
||||
|
||||
[CEReactions, NewObject, Throws]
|
||||
Element createElement(DOMString localName, optional ElementCreationOptions options);
|
||||
Element createElement(DOMString localName, optional ElementCreationOptions options = {});
|
||||
[CEReactions, NewObject, Throws]
|
||||
Element createElementNS(DOMString? namespace, DOMString qualifiedName, optional ElementCreationOptions options);
|
||||
Element createElementNS(DOMString? namespace, DOMString qualifiedName, optional ElementCreationOptions options = {});
|
||||
[NewObject]
|
||||
DocumentFragment createDocumentFragment();
|
||||
[NewObject]
|
||||
|
|
|
@ -91,12 +91,12 @@ partial interface Element {
|
|||
[NewObject]
|
||||
DOMRect getBoundingClientRect();
|
||||
|
||||
void scroll(optional ScrollToOptions options);
|
||||
void scroll(optional ScrollToOptions options = {});
|
||||
void scroll(unrestricted double x, unrestricted double y);
|
||||
|
||||
void scrollTo(optional ScrollToOptions options);
|
||||
void scrollTo(optional ScrollToOptions options = {});
|
||||
void scrollTo(unrestricted double x, unrestricted double y);
|
||||
void scrollBy(optional ScrollToOptions options);
|
||||
void scrollBy(optional ScrollToOptions options = {});
|
||||
void scrollBy(unrestricted double x, unrestricted double y);
|
||||
attribute unrestricted double scrollTop;
|
||||
attribute unrestricted double scrollLeft;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#the-errorevent-interface
|
||||
|
||||
[Constructor(DOMString type, optional ErrorEventInit eventInitDict), Exposed=(Window,Worker)]
|
||||
[Constructor(DOMString type, optional ErrorEventInit eventInitDict = {}), Exposed=(Window,Worker)]
|
||||
interface ErrorEvent : Event {
|
||||
readonly attribute DOMString message;
|
||||
readonly attribute DOMString filename;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* https://dom.spec.whatwg.org/#event
|
||||
*/
|
||||
|
||||
[Constructor(DOMString type, optional EventInit eventInitDict), Exposed=(Window,Worker)]
|
||||
[Constructor(DOMString type, optional EventInit eventInitDict = {}), Exposed=(Window,Worker)]
|
||||
interface Event {
|
||||
[Pure]
|
||||
readonly attribute DOMString type;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* https://html.spec.whatwg.org/multipage/#eventsource
|
||||
*/
|
||||
|
||||
[Constructor(DOMString url, optional EventSourceInit eventSourceInitDict),
|
||||
[Constructor(DOMString url, optional EventSourceInit eventSourceInitDict = {}),
|
||||
Exposed=(Window,Worker)]
|
||||
interface EventSource : EventTarget {
|
||||
readonly attribute DOMString url;
|
||||
|
|
|
@ -10,13 +10,13 @@ interface EventTarget {
|
|||
void addEventListener(
|
||||
DOMString type,
|
||||
EventListener? callback,
|
||||
optional (AddEventListenerOptions or boolean) options
|
||||
optional (AddEventListenerOptions or boolean) options = {}
|
||||
);
|
||||
|
||||
void removeEventListener(
|
||||
DOMString type,
|
||||
EventListener? callback,
|
||||
optional (EventListenerOptions or boolean) options
|
||||
optional (EventListenerOptions or boolean) options = {}
|
||||
);
|
||||
|
||||
[Throws]
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// https://w3c.github.io/ServiceWorker/#extendable-event
|
||||
|
||||
[Constructor(DOMString type,
|
||||
optional ExtendableEventInit eventInitDict),
|
||||
optional ExtendableEventInit eventInitDict = {}),
|
||||
Exposed=ServiceWorker,
|
||||
Pref="dom.serviceworker.enabled"]
|
||||
interface ExtendableEvent : Event {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// https://w3c.github.io/ServiceWorker/#extendablemessage-event-section
|
||||
|
||||
[Constructor(DOMString type, optional ExtendableMessageEventInit eventInitDict),
|
||||
[Constructor(DOMString type, optional ExtendableMessageEventInit eventInitDict = {}),
|
||||
Exposed=ServiceWorker,
|
||||
Pref="dom.serviceworker.enabled"]
|
||||
interface ExtendableMessageEvent : ExtendableEvent {
|
||||
|
|
|
@ -7,5 +7,5 @@
|
|||
[Exposed=(Window,Worker)]
|
||||
|
||||
partial interface WindowOrWorkerGlobalScope {
|
||||
[NewObject] Promise<Response> fetch(RequestInfo input, optional RequestInit init);
|
||||
[NewObject] Promise<Response> fetch(RequestInfo input, optional RequestInit init = {});
|
||||
};
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
[Constructor(sequence<BlobPart> fileBits,
|
||||
DOMString fileName,
|
||||
optional FilePropertyBag options),
|
||||
optional FilePropertyBag options = {}),
|
||||
Exposed=(Window,Worker)]
|
||||
interface File : Blob {
|
||||
readonly attribute DOMString name;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://w3c.github.io/uievents/#interface-FocusEvent
|
||||
[Constructor(DOMString typeArg, optional FocusEventInit focusEventInitDict),
|
||||
[Constructor(DOMString typeArg, optional FocusEventInit focusEventInitDict = {}),
|
||||
Exposed=Window]
|
||||
interface FocusEvent : UIEvent {
|
||||
readonly attribute EventTarget? relatedTarget;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#the-formdataevent-interface
|
||||
[Exposed=Window,
|
||||
Constructor(DOMString type, optional FormDataEventInit eventInitDict)]
|
||||
Constructor(DOMString type, optional FormDataEventInit eventInitDict = {})]
|
||||
interface FormDataEvent : Event {
|
||||
readonly attribute FormData formData;
|
||||
};
|
||||
|
|
|
@ -11,7 +11,7 @@ dictionary GainOptions : AudioNodeOptions {
|
|||
};
|
||||
|
||||
[Exposed=Window,
|
||||
Constructor (BaseAudioContext context, optional GainOptions options)]
|
||||
Constructor (BaseAudioContext context, optional GainOptions options = {})]
|
||||
interface GainNode : AudioNode {
|
||||
readonly attribute AudioParam gain;
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#hashchangeevent
|
||||
[Constructor(DOMString type, optional HashChangeEventInit eventInitDict),
|
||||
[Constructor(DOMString type, optional HashChangeEventInit eventInitDict = {}),
|
||||
Exposed=Window]
|
||||
interface HashChangeEvent : Event {
|
||||
readonly attribute USVString oldURL;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
|
||||
// https://w3c.github.io/uievents/#idl-inputevent
|
||||
[Constructor(DOMString type, optional InputEventInit eventInitDict)]
|
||||
[Constructor(DOMString type, optional InputEventInit eventInitDict = {})]
|
||||
interface InputEvent : UIEvent {
|
||||
readonly attribute DOMString? data;
|
||||
readonly attribute boolean isComposing;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
[Constructor(DOMString typeArg, optional KeyboardEventInit keyboardEventInitDict)]
|
||||
[Constructor(DOMString typeArg, optional KeyboardEventInit keyboardEventInitDict = {})]
|
||||
interface KeyboardEvent : UIEvent {
|
||||
// KeyLocationCode
|
||||
const unsigned long DOM_KEY_LOCATION_STANDARD = 0x00;
|
||||
|
|
|
@ -18,7 +18,7 @@ partial interface Navigator {
|
|||
|
||||
partial interface MediaDevices {
|
||||
// MediaTrackSupportedConstraints getSupportedConstraints();
|
||||
Promise<MediaStream> getUserMedia(optional MediaStreamConstraints constraints);
|
||||
Promise<MediaStream> getUserMedia(optional MediaStreamConstraints constraints = {});
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://drafts.csswg.org/cssom-view/#dom-mediaquerylistevent-mediaquerylistevent
|
||||
[Constructor(DOMString type, optional MediaQueryListEventInit eventInitDict), Exposed=(Window)]
|
||||
[Constructor(DOMString type, optional MediaQueryListEventInit eventInitDict = {}), Exposed=(Window)]
|
||||
interface MediaQueryListEvent : Event {
|
||||
readonly attribute DOMString media;
|
||||
readonly attribute boolean matches;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#messageevent
|
||||
[Constructor(DOMString type, optional MessageEventInit eventInitDict), Exposed=(Window,Worker)]
|
||||
[Constructor(DOMString type, optional MessageEventInit eventInitDict = {}), Exposed=(Window,Worker)]
|
||||
interface MessageEvent : Event {
|
||||
readonly attribute any data;
|
||||
readonly attribute DOMString origin;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://w3c.github.io/uievents/#interface-mouseevent
|
||||
[Constructor(DOMString typeArg, optional MouseEventInit mouseEventInitDict),
|
||||
[Constructor(DOMString typeArg, optional MouseEventInit mouseEventInitDict = {}),
|
||||
Exposed=Window]
|
||||
interface MouseEvent : UIEvent {
|
||||
readonly attribute long screenX;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
[Pref="dom.mutation_observer.enabled", Constructor(MutationCallback callback)]
|
||||
interface MutationObserver {
|
||||
[Throws]
|
||||
void observe(Node target, optional MutationObserverInit options);
|
||||
void observe(Node target, optional MutationObserverInit options = {});
|
||||
void disconnect();
|
||||
sequence<MutationRecord> takeRecords();
|
||||
};
|
||||
|
|
|
@ -32,7 +32,7 @@ interface Node : EventTarget {
|
|||
readonly attribute Document? ownerDocument;
|
||||
|
||||
[Pure]
|
||||
Node getRootNode(optional GetRootNodeOptions options);
|
||||
Node getRootNode(optional GetRootNodeOptions options = {});
|
||||
|
||||
[Pure]
|
||||
readonly attribute Node? parentNode;
|
||||
|
|
|
@ -22,7 +22,7 @@ dictionary OscillatorOptions : AudioNodeOptions {
|
|||
};
|
||||
|
||||
[Exposed=Window,
|
||||
Constructor (BaseAudioContext context, optional OscillatorOptions options)]
|
||||
Constructor (BaseAudioContext context, optional OscillatorOptions options = {})]
|
||||
interface OscillatorNode : AudioScheduledSourceNode {
|
||||
[SetterThrows]
|
||||
attribute OscillatorType type;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#the-pagetransitionevent-interface
|
||||
[Constructor(DOMString type, optional PageTransitionEventInit eventInitDict),
|
||||
[Constructor(DOMString type, optional PageTransitionEventInit eventInitDict = {}),
|
||||
Exposed=Window]
|
||||
interface PageTransitionEvent : Event {
|
||||
readonly attribute boolean persisted;
|
||||
|
|
|
@ -35,7 +35,7 @@ enum PanningModelType {
|
|||
};
|
||||
|
||||
[Exposed=Window,
|
||||
Constructor (BaseAudioContext context, optional PannerOptions options)]
|
||||
Constructor (BaseAudioContext context, optional PannerOptions options = {})]
|
||||
interface PannerNode : AudioNode {
|
||||
attribute PanningModelType panningModel;
|
||||
readonly attribute AudioParam positionX;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#the-popstateevent-interface
|
||||
[Constructor(DOMString type, optional PopStateEventInit eventInitDict),
|
||||
[Constructor(DOMString type, optional PopStateEventInit eventInitDict = {}),
|
||||
Exposed=Window]
|
||||
interface PopStateEvent : Event {
|
||||
readonly attribute any state;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
* http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0.
|
||||
*/
|
||||
|
||||
[Constructor(DOMString type, optional ProgressEventInit eventInitDict),
|
||||
[Constructor(DOMString type, optional ProgressEventInit eventInitDict = {}),
|
||||
Exposed=(Window,Worker)]
|
||||
interface ProgressEvent : Event {
|
||||
readonly attribute boolean lengthComputable;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#the-promiserejectionevent-interface
|
||||
|
||||
[Constructor(DOMString type, optional PromiseRejectionEventInit eventInitDict), Exposed=(Window,Worker)]
|
||||
[Constructor(DOMString type, optional PromiseRejectionEventInit eventInitDict = {}), Exposed=(Window,Worker)]
|
||||
interface PromiseRejectionEvent : Event {
|
||||
readonly attribute Promise<any> promise;
|
||||
readonly attribute any reason;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// https://w3c.github.io/webrtc-pc/#rtcicecandidate-interface
|
||||
|
||||
|
||||
[Constructor(optional RTCIceCandidateInit candidateInitDict),
|
||||
[Constructor(optional RTCIceCandidateInit candidateInitDict = {}),
|
||||
Exposed=Window, Pref="dom.webrtc.enabled"]
|
||||
interface RTCIceCandidate {
|
||||
readonly attribute DOMString candidate;
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
// https://w3c.github.io/webrtc-pc/#interface-definition
|
||||
|
||||
[Constructor(optional RTCConfiguration configuration),
|
||||
[Constructor(optional RTCConfiguration configuration = {}),
|
||||
Exposed=Window, Pref="dom.webrtc.enabled"]
|
||||
interface RTCPeerConnection : EventTarget {
|
||||
Promise<RTCSessionDescriptionInit> createOffer(optional RTCOfferOptions options);
|
||||
Promise<RTCSessionDescriptionInit> createAnswer(optional RTCAnswerOptions options);
|
||||
Promise<RTCSessionDescriptionInit> createOffer(optional RTCOfferOptions options = {});
|
||||
Promise<RTCSessionDescriptionInit> createAnswer(optional RTCAnswerOptions options = {});
|
||||
Promise<void> setLocalDescription(RTCSessionDescriptionInit description);
|
||||
readonly attribute RTCSessionDescription? localDescription;
|
||||
// readonly attribute RTCSessionDescription? currentLocalDescription;
|
||||
|
@ -17,7 +17,7 @@ interface RTCPeerConnection : EventTarget {
|
|||
readonly attribute RTCSessionDescription? remoteDescription;
|
||||
// readonly attribute RTCSessionDescription? currentRemoteDescription;
|
||||
// readonly attribute RTCSessionDescription? pendingRemoteDescription;
|
||||
Promise<void> addIceCandidate(optional RTCIceCandidateInit candidate);
|
||||
Promise<void> addIceCandidate(optional RTCIceCandidateInit candidate = {});
|
||||
readonly attribute RTCSignalingState signalingState;
|
||||
readonly attribute RTCIceGatheringState iceGatheringState;
|
||||
readonly attribute RTCIceConnectionState iceConnectionState;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// https://w3c.github.io/webrtc-pc/#rtcpeerconnectioniceevent
|
||||
|
||||
[Constructor(DOMString type, optional RTCPeerConnectionIceEventInit eventInitDict),
|
||||
[Constructor(DOMString type, optional RTCPeerConnectionIceEventInit eventInitDict = {}),
|
||||
Exposed=Window, Pref="dom.webrtc.enabled"]
|
||||
interface RTCPeerConnectionIceEvent : Event {
|
||||
readonly attribute RTCIceCandidate? candidate;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
typedef (Request or USVString) RequestInfo;
|
||||
|
||||
[Constructor(RequestInfo input, optional RequestInit init),
|
||||
[Constructor(RequestInfo input, optional RequestInit init = {}),
|
||||
Exposed=(Window,Worker)]
|
||||
|
||||
interface Request {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// https://fetch.spec.whatwg.org/#response-class
|
||||
|
||||
[Constructor(optional BodyInit? body = null, optional ResponseInit init),
|
||||
[Constructor(optional BodyInit? body = null, optional ResponseInit init = {}),
|
||||
Exposed=(Window,Worker)]
|
||||
interface Response {
|
||||
[NewObject] static Response error();
|
||||
|
|
|
@ -8,7 +8,8 @@ interface ServiceWorkerContainer : EventTarget {
|
|||
readonly attribute ServiceWorker? controller;
|
||||
//readonly attribute Promise<ServiceWorkerRegistration> ready;
|
||||
|
||||
[NewObject] Promise<ServiceWorkerRegistration> register(USVString scriptURL, optional RegistrationOptions options);
|
||||
[NewObject] Promise<ServiceWorkerRegistration> register(USVString scriptURL,
|
||||
optional RegistrationOptions options = {});
|
||||
|
||||
//[NewObject] Promise<any> getRegistration(optional USVString clientURL = "");
|
||||
//[NewObject] Promise<FrozenArray<ServiceWorkerRegistration>> getRegistrations();
|
||||
|
|
|
@ -11,7 +11,7 @@ dictionary StereoPannerOptions: AudioNodeOptions {
|
|||
};
|
||||
|
||||
[Exposed=Window,
|
||||
Constructor (BaseAudioContext context, optional StereoPannerOptions options)]
|
||||
Constructor (BaseAudioContext context, optional StereoPannerOptions options = {})]
|
||||
interface StereoPannerNode : AudioScheduledSourceNode {
|
||||
readonly attribute AudioParam pan;
|
||||
};
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* Event sent to a window when a storage area changes.
|
||||
*/
|
||||
|
||||
[Constructor(DOMString type, optional StorageEventInit eventInitDict), Exposed=Window]
|
||||
[Constructor(DOMString type, optional StorageEventInit eventInitDict = {}), Exposed=Window]
|
||||
interface StorageEvent : Event {
|
||||
readonly attribute DOMString? key;
|
||||
readonly attribute DOMString? oldValue;
|
||||
|
|
|
@ -32,7 +32,7 @@ dictionary TestDictionary {
|
|||
Blob interfaceValue;
|
||||
any anyValue;
|
||||
object objectValue;
|
||||
TestDictionaryDefaults dict = null;
|
||||
TestDictionaryDefaults dict = {};
|
||||
sequence<TestDictionaryDefaults> seqDict;
|
||||
// Testing codegen to import Element correctly, ensure no other code references Element directly
|
||||
sequence<Element> elementSequence;
|
||||
|
|
|
@ -7,6 +7,6 @@
|
|||
|
||||
[Pref="dom.worklet.testing.enabled", Exposed=(Window), Constructor]
|
||||
interface TestWorklet {
|
||||
[NewObject] Promise<void> addModule(USVString moduleURL, optional WorkletOptions options);
|
||||
[NewObject] Promise<void> addModule(USVString moduleURL, optional WorkletOptions options = {});
|
||||
DOMString? lookup(DOMString key);
|
||||
};
|
||||
|
|
|
@ -12,11 +12,11 @@ dictionary TextDecodeOptions {
|
|||
boolean stream = false;
|
||||
};
|
||||
|
||||
[Constructor(optional DOMString label = "utf-8", optional TextDecoderOptions options), Exposed=(Window,Worker)]
|
||||
[Constructor(optional DOMString label = "utf-8", optional TextDecoderOptions options = {}), Exposed=(Window,Worker)]
|
||||
interface TextDecoder {
|
||||
readonly attribute DOMString encoding;
|
||||
readonly attribute boolean fatal;
|
||||
readonly attribute boolean ignoreBOM;
|
||||
[Throws]
|
||||
USVString decode(optional BufferSource input, optional TextDecodeOptions options);
|
||||
USVString decode(optional BufferSource input, optional TextDecodeOptions options = {});
|
||||
};
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// https://html.spec.whatwg.org/multipage/#the-trackevent-interface
|
||||
|
||||
[Exposed=Window,
|
||||
Constructor(DOMString type, optional TrackEventInit eventInitDict)]
|
||||
Constructor(DOMString type, optional TrackEventInit eventInitDict = {})]
|
||||
interface TrackEvent : Event {
|
||||
readonly attribute (VideoTrack or AudioTrack or TextTrack)? track;
|
||||
};
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* https://dom.spec.whatwg.org/#event
|
||||
*/
|
||||
|
||||
[Constructor(DOMString type, optional TransitionEventInit transitionEventInitDict),
|
||||
[Constructor(DOMString type, optional TransitionEventInit transitionEventInitDict = {}),
|
||||
Exposed=Window]
|
||||
interface TransitionEvent : Event {
|
||||
readonly attribute DOMString propertyName;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://w3c.github.io/uievents/#interface-uievent
|
||||
[Constructor(DOMString type, optional UIEventInit eventInitDict)]
|
||||
[Constructor(DOMString type, optional UIEventInit eventInitDict = {})]
|
||||
interface UIEvent : Event {
|
||||
// readonly attribute WindowProxy? view;
|
||||
readonly attribute Window? view;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15
|
||||
[Constructor(DOMString type, optional WebGLContextEventInit eventInit),
|
||||
[Constructor(DOMString type, optional WebGLContextEventInit eventInit = {}),
|
||||
Exposed=Window]
|
||||
interface WebGLContextEvent : Event {
|
||||
readonly attribute DOMString statusMessage;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://w3c.github.io/uievents/#interface-wheelevent
|
||||
[Constructor(DOMString typeArg, optional WheelEventInit wheelEventInitDict),
|
||||
[Constructor(DOMString typeArg, optional WheelEventInit wheelEventInitDict = {}),
|
||||
Exposed=Window]
|
||||
interface WheelEvent : MouseEvent {
|
||||
const unsigned long DOM_DELTA_PIXEL = 0x00;
|
||||
|
|
|
@ -118,11 +118,11 @@ partial interface Window {
|
|||
[Replaceable] readonly attribute long pageXOffset;
|
||||
[Replaceable] readonly attribute long scrollY;
|
||||
[Replaceable] readonly attribute long pageYOffset;
|
||||
void scroll(optional ScrollToOptions options);
|
||||
void scroll(optional ScrollToOptions options = {});
|
||||
void scroll(unrestricted double x, unrestricted double y);
|
||||
void scrollTo(optional ScrollToOptions options);
|
||||
void scrollTo(optional ScrollToOptions options = {});
|
||||
void scrollTo(unrestricted double x, unrestricted double y);
|
||||
void scrollBy(optional ScrollToOptions options);
|
||||
void scrollBy(optional ScrollToOptions options = {});
|
||||
void scrollBy(unrestricted double x, unrestricted double y);
|
||||
|
||||
// client
|
||||
|
|
|
@ -9,7 +9,7 @@ interface AbstractWorker {
|
|||
};
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#worker
|
||||
[Constructor(USVString scriptURL, optional WorkerOptions options), Exposed=(Window,Worker)]
|
||||
[Constructor(USVString scriptURL, optional WorkerOptions options = {}), Exposed=(Window,Worker)]
|
||||
interface Worker : EventTarget {
|
||||
void terminate();
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue