Rename "MozMap" to "record" in our IDL parser and IDL files

This commit is contained in:
JustOff 2019-03-13 19:37:03 +02:00 • committed by Roy Tam
commit d9eeac26ef
8 changed files with 83 additions and 78 deletions

View file

@ -84,7 +84,7 @@ def idlTypeNeedsCycleCollection(type):
return True return True
elif type.isUnion(): elif type.isUnion():
return any(idlTypeNeedsCycleCollection(t) for t in type.flatMemberTypes) return any(idlTypeNeedsCycleCollection(t) for t in type.flatMemberTypes)
elif type.isMozMap(): elif type.isRecord():
if idlTypeNeedsCycleCollection(type.inner): if idlTypeNeedsCycleCollection(type.inner):
raise TypeError("Cycle collection for type %s is not supported" % type) raise TypeError("Cycle collection for type %s is not supported" % type)
return False return False
@ -1171,7 +1171,7 @@ class CGHeaders(CGWrapper):
declareIncludes.add(filename) declareIncludes.add(filename)
elif unrolled.isPrimitive(): elif unrolled.isPrimitive():
bindingHeaders.add("mozilla/dom/PrimitiveConversions.h") bindingHeaders.add("mozilla/dom/PrimitiveConversions.h")
elif unrolled.isMozMap(): elif unrolled.isRecord():
if dictionary or jsImplementedDescriptors: if dictionary or jsImplementedDescriptors:
declareIncludes.add("mozilla/dom/MozMap.h") declareIncludes.add("mozilla/dom/MozMap.h")
else: else:
@ -1388,7 +1388,7 @@ def UnionTypes(unionTypes, config):
# the right header to be able to Release() in our inlined # the right header to be able to Release() in our inlined
# code. # code.
headers.add(CGHeaders.getDeclarationFilename(f.callback)) headers.add(CGHeaders.getDeclarationFilename(f.callback))
elif f.isMozMap(): elif f.isRecord():
headers.add("mozilla/dom/MozMap.h") headers.add("mozilla/dom/MozMap.h")
# And add headers for the type we're parametrized over # And add headers for the type we're parametrized over
addHeadersForType(f.inner) addHeadersForType(f.inner)
@ -1448,7 +1448,7 @@ def UnionConversions(unionTypes, config):
headers.add(CGHeaders.getDeclarationFilename(f.inner)) headers.add(CGHeaders.getDeclarationFilename(f.inner))
elif f.isPrimitive(): elif f.isPrimitive():
headers.add("mozilla/dom/PrimitiveConversions.h") headers.add("mozilla/dom/PrimitiveConversions.h")
elif f.isMozMap(): elif f.isRecord():
headers.add("mozilla/dom/MozMap.h") headers.add("mozilla/dom/MozMap.h")
# And the internal type of the MozMap # And the internal type of the MozMap
addHeadersForType(f.inner) addHeadersForType(f.inner)
@ -4730,7 +4730,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
dealWithOptional=isOptional, dealWithOptional=isOptional,
holderArgs=holderArgs) holderArgs=holderArgs)
if type.isMozMap(): if type.isRecord():
assert not isEnforceRange and not isClamp assert not isEnforceRange and not isClamp
if failureCode is None: if failureCode is None:
notMozMap = ('ThrowErrorMessage(cx, MSG_NOT_OBJECT, "%s");\n' notMozMap = ('ThrowErrorMessage(cx, MSG_NOT_OBJECT, "%s");\n'
@ -4937,7 +4937,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
else: else:
setDictionary = None setDictionary = None
mozMapMemberTypes = filter(lambda t: t.isMozMap(), memberTypes) mozMapMemberTypes = filter(lambda t: t.isRecord(), memberTypes)
if len(mozMapMemberTypes) > 0: if len(mozMapMemberTypes) > 0:
assert len(mozMapMemberTypes) == 1 assert len(mozMapMemberTypes) == 1
name = getUnionMemberName(mozMapMemberTypes[0]) name = getUnionMemberName(mozMapMemberTypes[0])
@ -6385,7 +6385,7 @@ def getWrapTemplateForType(type, descriptorProvider, result, successCode,
if type is None or type.isVoid(): if type is None or type.isVoid():
return (setUndefined(), True) return (setUndefined(), True)
if (type.isSequence() or type.isMozMap()) and type.nullable(): if (type.isSequence() or type.isRecord()) and type.nullable():
# These are both wrapped in Nullable<> # These are both wrapped in Nullable<>
recTemplate, recInfall = getWrapTemplateForType(type.inner, descriptorProvider, recTemplate, recInfall = getWrapTemplateForType(type.inner, descriptorProvider,
"%s.Value()" % result, successCode, "%s.Value()" % result, successCode,
@ -6458,7 +6458,7 @@ def getWrapTemplateForType(type, descriptorProvider, result, successCode,
return (code, False) return (code, False)
if type.isMozMap(): if type.isRecord():
# Now do non-nullable MozMap. Our success code is just to break to # Now do non-nullable MozMap. Our success code is just to break to
# where we define the property on the object. Note that we bump the # where we define the property on the object. Note that we bump the
# mozMapWrapLevel around this call so that nested MozMap conversions # mozMapWrapLevel around this call so that nested MozMap conversions
@ -6793,7 +6793,7 @@ def typeMatchesLambda(type, func):
return False return False
if type.nullable(): if type.nullable():
return typeMatchesLambda(type.inner, func) return typeMatchesLambda(type.inner, func)
if type.isSequence() or type.isMozMap(): if type.isSequence() or type.isRecord():
return typeMatchesLambda(type.inner, func) return typeMatchesLambda(type.inner, func)
if type.isUnion(): if type.isUnion():
return any(typeMatchesLambda(t, func) for t in return any(typeMatchesLambda(t, func) for t in
@ -6889,7 +6889,7 @@ def getRetvalDeclarationForType(returnType, descriptorProvider,
if nullable: if nullable:
result = CGTemplatedType("Nullable", result) result = CGTemplatedType("Nullable", result)
return result, "ref", rooter, None, None return result, "ref", rooter, None, None
if returnType.isMozMap(): if returnType.isRecord():
nullable = returnType.nullable() nullable = returnType.nullable()
if nullable: if nullable:
returnType = returnType.inner returnType = returnType.inner
@ -6999,7 +6999,7 @@ class CGCallGenerator(CGThing):
return True return True
if a.type.isSequence(): if a.type.isSequence():
return True return True
if a.type.isMozMap(): if a.type.isRecord():
return True return True
# isObject() types are always a JS::Rooted, whether # isObject() types are always a JS::Rooted, whether
# nullable or not, and it turns out a const JS::Rooted # nullable or not, and it turns out a const JS::Rooted
@ -7222,7 +7222,7 @@ def wrapTypeIntoCurrentCompartment(type, value, isMember=True):
wrapCode = CGIfWrapper(wrapCode, "!%s.IsNull()" % origValue) wrapCode = CGIfWrapper(wrapCode, "!%s.IsNull()" % origValue)
return wrapCode return wrapCode
if type.isMozMap(): if type.isRecord():
origType = type origType = type
if type.nullable(): if type.nullable():
type = type.inner type = type.inner
@ -8135,7 +8135,7 @@ class CGMethodCall(CGThing):
genericObjectSigs = [ genericObjectSigs = [
s for s in possibleSignatures s for s in possibleSignatures
if (distinguishingType(s).isDictionary() or if (distinguishingType(s).isDictionary() or
distinguishingType(s).isMozMap() or distinguishingType(s).isRecord() or
distinguishingType(s).isCallbackInterface())] distinguishingType(s).isCallbackInterface())]
assert len(genericObjectSigs) <= 1 assert len(genericObjectSigs) <= 1
objectSigs.extend(genericObjectSigs) objectSigs.extend(genericObjectSigs)
@ -9429,7 +9429,7 @@ class CGMemberJITInfo(CGThing):
return "JSVAL_TYPE_UNDEFINED" return "JSVAL_TYPE_UNDEFINED"
if t.isSequence(): if t.isSequence():
return "JSVAL_TYPE_OBJECT" return "JSVAL_TYPE_OBJECT"
if t.isMozMap(): if t.isRecord():
return "JSVAL_TYPE_OBJECT" return "JSVAL_TYPE_OBJECT"
if t.isGeckoInterface(): if t.isGeckoInterface():
return "JSVAL_TYPE_OBJECT" return "JSVAL_TYPE_OBJECT"
@ -9690,7 +9690,7 @@ def getUnionAccessorSignatureType(type, descriptorProvider):
# Flat member types have already unwrapped nullables. # Flat member types have already unwrapped nullables.
assert not type.nullable() assert not type.nullable()
if type.isSequence() or type.isMozMap(): if type.isSequence() or type.isRecord():
if type.isSequence(): if type.isSequence():
wrapperType = "Sequence" wrapperType = "Sequence"
else: else:
@ -10061,7 +10061,7 @@ class CGUnionStruct(CGThing):
CGCase("e" + vars["name"], CGCase("e" + vars["name"],
CGGeneric("DoTraceSequence(trc, mValue.m%s.Value());\n" % CGGeneric("DoTraceSequence(trc, mValue.m%s.Value());\n" %
vars["name"]))) vars["name"])))
elif t.isMozMap(): elif t.isRecord():
traceCases.append( traceCases.append(
CGCase("e" + vars["name"], CGCase("e" + vars["name"],
CGGeneric("TraceMozMap(trc, mValue.m%s.Value());\n" % CGGeneric("TraceMozMap(trc, mValue.m%s.Value());\n" %
@ -13193,7 +13193,7 @@ class CGDictionary(CGThing):
trace = CGGeneric('%s.TraceSelf(trc);\n' % memberData) trace = CGGeneric('%s.TraceSelf(trc);\n' % memberData)
if type.nullable(): if type.nullable():
trace = CGIfWrapper(trace, "!%s.IsNull()" % memberNullable) trace = CGIfWrapper(trace, "!%s.IsNull()" % memberNullable)
elif type.isMozMap(): elif type.isRecord():
# If you implement this, add a MozMap<object> to # If you implement this, add a MozMap<object> to
# TestInterfaceJSDictionary and test it in test_bug1036214.html # TestInterfaceJSDictionary and test it in test_bug1036214.html
# to make sure we end up with the correct security properties. # to make sure we end up with the correct security properties.
@ -13604,7 +13604,7 @@ class ForwardDeclarationBuilder:
# since we don't know which one we might want # since we don't know which one we might want
self.addInMozillaDom(CGUnionStruct.unionTypeName(t, False)) self.addInMozillaDom(CGUnionStruct.unionTypeName(t, False))
self.addInMozillaDom(CGUnionStruct.unionTypeName(t, True)) self.addInMozillaDom(CGUnionStruct.unionTypeName(t, True))
elif t.isMozMap(): elif t.isRecord():
self.forwardDeclareForType(t.inner, config) self.forwardDeclareForType(t.inner, config)
# Don't need to do anything for void, primitive, string, any or object. # Don't need to do anything for void, primitive, string, any or object.
# There may be some other cases we are missing. # There may be some other cases we are missing.
@ -14110,7 +14110,7 @@ class CGNativeMember(ClassMethod):
else: else:
returnCode = "aRetVal.SwapElements(${declName});\n" returnCode = "aRetVal.SwapElements(${declName});\n"
return "void", "", returnCode return "void", "", returnCode
if type.isMozMap(): if type.isRecord():
# If we want to handle MozMap-of-MozMap return values, we're # If we want to handle MozMap-of-MozMap return values, we're
# going to need to fix example codegen to not produce MozMap<void> # going to need to fix example codegen to not produce MozMap<void>
# for the relevant argument... # for the relevant argument...
@ -14160,7 +14160,7 @@ class CGNativeMember(ClassMethod):
if nullable: if nullable:
type = CGTemplatedType("Nullable", type) type = CGTemplatedType("Nullable", type)
args.append(Argument("%s&" % type.define(), "aRetVal")) args.append(Argument("%s&" % type.define(), "aRetVal"))
elif returnType.isMozMap(): elif returnType.isRecord():
nullable = returnType.nullable() nullable = returnType.nullable()
if nullable: if nullable:
returnType = returnType.inner returnType = returnType.inner
@ -14238,7 +14238,7 @@ class CGNativeMember(ClassMethod):
decl = CGTemplatedType("Sequence", argType) decl = CGTemplatedType("Sequence", argType)
return decl.define(), True, True return decl.define(), True, True
if type.isMozMap(): if type.isRecord():
nullable = type.nullable() nullable = type.nullable()
if nullable: if nullable:
type = type.inner type = type.inner

View file

@ -115,7 +115,7 @@ class Configuration(DescriptorProvider):
for (t, _) in getAllTypes(self.descriptors, self.dictionaries, self.callbacks): for (t, _) in getAllTypes(self.descriptors, self.dictionaries, self.callbacks):
while True: while True:
if t.isMozMap(): if t.isRecord():
t = t.inner t = t.inner
elif t.unroll() != t: elif t.unroll() != t:
t = t.unroll() t = t.unroll()

View file

@ -1867,7 +1867,7 @@ class IDLDictionary(IDLObjectWithScope):
if (memberType.nullable() or if (memberType.nullable() or
memberType.isSequence() or memberType.isSequence() or
memberType.isMozMap()): memberType.isRecord()):
return typeContainsDictionary(memberType.inner, dictionary) return typeContainsDictionary(memberType.inner, dictionary)
if memberType.isDictionary(): if memberType.isDictionary():
@ -1988,7 +1988,7 @@ class IDLType(IDLObject):
'callback', 'callback',
'union', 'union',
'sequence', 'sequence',
'mozmap' 'record'
) )
def __init__(self, location, name): def __init__(self, location, name):
@ -2038,7 +2038,7 @@ class IDLType(IDLObject):
def isSequence(self): def isSequence(self):
return False return False
def isMozMap(self): def isRecord(self):
return False return False
def isArrayBuffer(self): def isArrayBuffer(self):
@ -2263,8 +2263,8 @@ class IDLNullableType(IDLParameterizedType):
def isSequence(self): def isSequence(self):
return self.inner.isSequence() return self.inner.isSequence()
def isMozMap(self): def isRecord(self):
return self.inner.isMozMap() return self.inner.isRecord()
def isArrayBuffer(self): def isArrayBuffer(self):
return self.inner.isArrayBuffer() return self.inner.isArrayBuffer()
@ -2399,34 +2399,38 @@ class IDLSequenceType(IDLParameterizedType):
return (other.isPrimitive() or other.isString() or other.isEnum() or return (other.isPrimitive() or other.isString() or other.isEnum() or
other.isDate() or other.isInterface() or other.isDate() or other.isInterface() or
other.isDictionary() or other.isDictionary() or
other.isCallback() or other.isMozMap()) other.isCallback() or other.isRecord())
class IDLMozMapType(IDLParameterizedType): class IDLRecordType(IDLParameterizedType):
def __init__(self, location, parameterType): def __init__(self, location, keyType, valueType):
assert not parameterType.isVoid() assert keyType.isString()
assert keyType.isComplete()
assert not valueType.isVoid()
IDLParameterizedType.__init__(self, location, valueType.name, valueType)
self.keyType = keyType
IDLParameterizedType.__init__(self, location, parameterType.name, parameterType)
# Need to set self.name up front if our inner type is already complete, # Need to set self.name up front if our inner type is already complete,
# since in that case our .complete() won't be called. # since in that case our .complete() won't be called.
if self.inner.isComplete(): if self.inner.isComplete():
self.name = self.inner.name + "MozMap" self.name = self.keyType.name + self.inner.name + "Record"
def __eq__(self, other): def __eq__(self, other):
return isinstance(other, IDLMozMapType) and self.inner == other.inner return isinstance(other, IDLRecordType) and self.inner == other.inner
def __str__(self): def __str__(self):
return self.inner.__str__() + "MozMap" return self.keyType.__str__() + self.inner.__str__() + "Record"
def isMozMap(self): def isRecord(self):
return True return True
def tag(self): def tag(self):
return IDLType.Tags.mozmap return IDLType.Tags.record
def complete(self, scope): def complete(self, scope):
self.inner = self.inner.complete(scope) self.inner = self.inner.complete(scope)
self.name = self.inner.name + "MozMap" self.name = self.keyType.name + self.inner.name + "Record"
return self return self
def unroll(self): def unroll(self):
@ -2616,8 +2620,8 @@ class IDLTypedefType(IDLType):
def isSequence(self): def isSequence(self):
return self.inner.isSequence() return self.inner.isSequence()
def isMozMap(self): def isRecord(self):
return self.inner.isMozMap() return self.inner.isRecord()
def isDictionary(self): def isDictionary(self):
return self.inner.isDictionary() return self.inner.isDictionary()
@ -2800,7 +2804,7 @@ class IDLWrapperType(IDLType):
if self.isEnum(): if self.isEnum():
return (other.isPrimitive() or other.isInterface() or other.isObject() or return (other.isPrimitive() or other.isInterface() or other.isObject() or
other.isCallback() or other.isDictionary() or other.isCallback() or other.isDictionary() or
other.isSequence() or other.isMozMap() or other.isDate()) other.isSequence() or other.isRecord() or other.isDate())
if self.isDictionary() and other.nullable(): if self.isDictionary() and other.nullable():
return False return False
if (other.isPrimitive() or other.isString() or other.isEnum() or if (other.isPrimitive() or other.isString() or other.isEnum() or
@ -2822,7 +2826,7 @@ class IDLWrapperType(IDLType):
(self.isNonCallbackInterface() or (self.isNonCallbackInterface() or
other.isNonCallbackInterface())) other.isNonCallbackInterface()))
if (other.isDictionary() or other.isCallback() or if (other.isDictionary() or other.isCallback() or
other.isMozMap()): other.isRecord()):
return self.isNonCallbackInterface() return self.isNonCallbackInterface()
# Not much else |other| can be # Not much else |other| can be
@ -3032,17 +3036,17 @@ class IDLBuiltinType(IDLType):
return (other.isNumeric() or other.isString() or other.isEnum() or return (other.isNumeric() or other.isString() or other.isEnum() or
other.isInterface() or other.isObject() or other.isInterface() or other.isObject() or
other.isCallback() or other.isDictionary() or other.isCallback() or other.isDictionary() or
other.isSequence() or other.isMozMap() or other.isDate()) other.isSequence() or other.isRecord() or other.isDate())
if self.isNumeric(): if self.isNumeric():
return (other.isBoolean() or other.isString() or other.isEnum() or return (other.isBoolean() or other.isString() or other.isEnum() or
other.isInterface() or other.isObject() or other.isInterface() or other.isObject() or
other.isCallback() or other.isDictionary() or other.isCallback() or other.isDictionary() or
other.isSequence() or other.isMozMap() or other.isDate()) other.isSequence() or other.isRecord() or other.isDate())
if self.isString(): if self.isString():
return (other.isPrimitive() or other.isInterface() or return (other.isPrimitive() or other.isInterface() or
other.isObject() or other.isObject() or
other.isCallback() or other.isDictionary() or other.isCallback() or other.isDictionary() or
other.isSequence() or other.isMozMap() or other.isDate()) other.isSequence() or other.isRecord() or other.isDate())
if self.isAny(): if self.isAny():
# Can't tell "any" apart from anything # Can't tell "any" apart from anything
return False return False
@ -3052,7 +3056,7 @@ class IDLBuiltinType(IDLType):
return (other.isPrimitive() or other.isString() or other.isEnum() or return (other.isPrimitive() or other.isString() or other.isEnum() or
other.isInterface() or other.isCallback() or other.isInterface() or other.isCallback() or
other.isDictionary() or other.isSequence() or other.isDictionary() or other.isSequence() or
other.isMozMap()) other.isRecord())
if self.isVoid(): if self.isVoid():
return not other.isVoid() return not other.isVoid()
# Not much else we could be! # Not much else we could be!
@ -3060,7 +3064,7 @@ class IDLBuiltinType(IDLType):
# Like interfaces, but we know we're not a callback # Like interfaces, but we know we're not a callback
return (other.isPrimitive() or other.isString() or other.isEnum() or return (other.isPrimitive() or other.isString() or other.isEnum() or
other.isCallback() or other.isDictionary() or other.isCallback() or other.isDictionary() or
other.isSequence() or other.isMozMap() or other.isDate() or other.isSequence() or other.isRecord() or other.isDate() or
(other.isInterface() and ( (other.isInterface() and (
# ArrayBuffer is distinguishable from everything # ArrayBuffer is distinguishable from everything
# that's not an ArrayBuffer or a callback interface # that's not an ArrayBuffer or a callback interface
@ -3845,8 +3849,8 @@ class IDLConst(IDLInterfaceMember):
if type.isDictionary(): if type.isDictionary():
raise WebIDLError("A constant cannot be of a dictionary type", raise WebIDLError("A constant cannot be of a dictionary type",
[self.location]) [self.location])
if type.isMozMap(): if type.isRecord():
raise WebIDLError("A constant cannot be of a MozMap type", raise WebIDLError("A constant cannot be of a record type",
[self.location]) [self.location])
self.type = type self.type = type
self.value = value self.value = value
@ -3959,8 +3963,8 @@ class IDLAttribute(IDLInterfaceMember):
if self.type.isSequence() and not self.getExtendedAttribute("Cached"): if self.type.isSequence() and not self.getExtendedAttribute("Cached"):
raise WebIDLError("A non-cached attribute cannot be of a sequence " raise WebIDLError("A non-cached attribute cannot be of a sequence "
"type", [self.location]) "type", [self.location])
if self.type.isMozMap() and not self.getExtendedAttribute("Cached"): if self.type.isRecord() and not self.getExtendedAttribute("Cached"):
raise WebIDLError("A non-cached attribute cannot be of a MozMap " raise WebIDLError("A non-cached attribute cannot be of a record "
"type", [self.location]) "type", [self.location])
if self.type.isUnion(): if self.type.isUnion():
for f in self.type.unroll().flatMemberTypes: for f in self.type.unroll().flatMemberTypes:
@ -3976,11 +3980,11 @@ class IDLAttribute(IDLInterfaceMember):
"one of its member types's member " "one of its member types's member "
"types, and so on) is a sequence " "types, and so on) is a sequence "
"type", [self.location, f.location]) "type", [self.location, f.location])
if f.isMozMap(): if f.isRecord():
raise WebIDLError("An attribute cannot be of a union " raise WebIDLError("An attribute cannot be of a union "
"type if one of its member types (or " "type if one of its member types (or "
"one of its member types's member " "one of its member types's member "
"types, and so on) is a MozMap " "types, and so on) is a record "
"type", [self.location, f.location]) "type", [self.location, f.location])
if not self.type.isInterface() and self.getExtendedAttribute("PutForwards"): if not self.type.isInterface() and self.getExtendedAttribute("PutForwards"):
raise WebIDLError("An attribute with [PutForwards] must have an " raise WebIDLError("An attribute with [PutForwards] must have an "
@ -3994,7 +3998,7 @@ class IDLAttribute(IDLInterfaceMember):
def typeContainsChromeOnlyDictionaryMember(type): def typeContainsChromeOnlyDictionaryMember(type):
if (type.nullable() or if (type.nullable() or
type.isSequence() or type.isSequence() or
type.isMozMap()): type.isRecord()):
return typeContainsChromeOnlyDictionaryMember(type.inner) return typeContainsChromeOnlyDictionaryMember(type.inner)
if type.isUnion(): if type.isUnion():
@ -4040,10 +4044,10 @@ class IDLAttribute(IDLInterfaceMember):
[self.location, location]) [self.location, location])
if self.getExtendedAttribute("Frozen"): if self.getExtendedAttribute("Frozen"):
if (not self.type.isSequence() and not self.type.isDictionary() and if (not self.type.isSequence() and not self.type.isDictionary() and
not self.type.isMozMap()): not self.type.isRecord()):
raise WebIDLError("[Frozen] is only allowed on " raise WebIDLError("[Frozen] is only allowed on "
"sequence-valued, dictionary-valued, and " "sequence-valued, dictionary-valued, and "
"MozMap-valued attributes", "record-valued attributes",
[self.location]) [self.location])
if not self.type.unroll().isExposedInAllOf(self.exposureSet): if not self.type.unroll().isExposedInAllOf(self.exposureSet):
raise WebIDLError("Attribute returns a type that is not exposed " raise WebIDLError("Attribute returns a type that is not exposed "
@ -5152,7 +5156,7 @@ class Tokenizer(object):
"Promise": "PROMISE", "Promise": "PROMISE",
"required": "REQUIRED", "required": "REQUIRED",
"sequence": "SEQUENCE", "sequence": "SEQUENCE",
"MozMap": "MOZMAP", "record": "RECORD",
"short": "SHORT", "short": "SHORT",
"unsigned": "UNSIGNED", "unsigned": "UNSIGNED",
"void": "VOID", "void": "VOID",
@ -6281,7 +6285,7 @@ class Parser(Tokenizer):
| OCTET | OCTET
| OPTIONAL | OPTIONAL
| SEQUENCE | SEQUENCE
| MOZMAP | RECORD
| SETTER | SETTER
| SHORT | SHORT
| STATIC | STATIC
@ -6402,13 +6406,14 @@ class Parser(Tokenizer):
type = IDLUnresolvedType(self.getLocation(p, 1), promiseIdent, p[3]) type = IDLUnresolvedType(self.getLocation(p, 1), promiseIdent, p[3])
p[0] = self.handleNullable(type, p[5]) p[0] = self.handleNullable(type, p[5])
def p_NonAnyTypeMozMapType(self, p): def p_NonAnyTypeRecordType(self, p):
""" """
NonAnyType : MOZMAP LT Type GT Null NonAnyType : RECORD LT StringType COMMA Type GT Null
""" """
innerType = p[3] keyType = p[3]
type = IDLMozMapType(self.getLocation(p, 1), innerType) valueType = p[5]
p[0] = self.handleNullable(type, p[5]) type = IDLRecordType(self.getLocation(p, 1), keyType, valueType)
p[0] = self.handleNullable(type, p[7])
def p_NonAnyTypeScopedName(self, p): def p_NonAnyTypeScopedName(self, p):
""" """

View file

@ -25,7 +25,7 @@ NS_INTERFACE_MAP_END
// static // static
already_AddRefed<Headers> already_AddRefed<Headers>
Headers::Constructor(const GlobalObject& aGlobal, Headers::Constructor(const GlobalObject& aGlobal,
const Optional<HeadersOrByteStringSequenceSequenceOrByteStringMozMap>& aInit, const Optional<HeadersOrByteStringSequenceSequenceOrByteStringByteStringRecord>& aInit,
ErrorResult& aRv) ErrorResult& aRv)
{ {
RefPtr<InternalHeaders> ih = new InternalHeaders(); RefPtr<InternalHeaders> ih = new InternalHeaders();
@ -39,8 +39,8 @@ Headers::Constructor(const GlobalObject& aGlobal,
ih->Fill(*aInit.Value().GetAsHeaders().mInternalHeaders, aRv); ih->Fill(*aInit.Value().GetAsHeaders().mInternalHeaders, aRv);
} else if (aInit.Value().IsByteStringSequenceSequence()) { } else if (aInit.Value().IsByteStringSequenceSequence()) {
ih->Fill(aInit.Value().GetAsByteStringSequenceSequence(), aRv); ih->Fill(aInit.Value().GetAsByteStringSequenceSequence(), aRv);
} else if (aInit.Value().IsByteStringMozMap()) { } else if (aInit.Value().IsByteStringByteStringRecord()) {
ih->Fill(aInit.Value().GetAsByteStringMozMap(), aRv); ih->Fill(aInit.Value().GetAsByteStringByteStringRecord(), aRv);
} }
if (aRv.Failed()) { if (aRv.Failed()) {
@ -53,7 +53,7 @@ Headers::Constructor(const GlobalObject& aGlobal,
// static // static
already_AddRefed<Headers> already_AddRefed<Headers>
Headers::Constructor(const GlobalObject& aGlobal, Headers::Constructor(const GlobalObject& aGlobal,
const OwningHeadersOrByteStringSequenceSequenceOrByteStringMozMap& aInit, const OwningHeadersOrByteStringSequenceSequenceOrByteStringByteStringRecord& aInit,
ErrorResult& aRv) ErrorResult& aRv)
{ {
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports()); nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
@ -62,7 +62,7 @@ Headers::Constructor(const GlobalObject& aGlobal,
/* static */ already_AddRefed<Headers> /* static */ already_AddRefed<Headers>
Headers::Create(nsIGlobalObject* aGlobal, Headers::Create(nsIGlobalObject* aGlobal,
const OwningHeadersOrByteStringSequenceSequenceOrByteStringMozMap& aInit, const OwningHeadersOrByteStringSequenceSequenceOrByteStringByteStringRecord& aInit,
ErrorResult& aRv) ErrorResult& aRv)
{ {
RefPtr<InternalHeaders> ih = new InternalHeaders(); RefPtr<InternalHeaders> ih = new InternalHeaders();
@ -72,8 +72,8 @@ Headers::Create(nsIGlobalObject* aGlobal,
ih->Fill(*(aInit.GetAsHeaders().get()->mInternalHeaders), aRv); ih->Fill(*(aInit.GetAsHeaders().get()->mInternalHeaders), aRv);
} else if (aInit.IsByteStringSequenceSequence()) { } else if (aInit.IsByteStringSequenceSequence()) {
ih->Fill(aInit.GetAsByteStringSequenceSequence(), aRv); ih->Fill(aInit.GetAsByteStringSequenceSequence(), aRv);
} else if (aInit.IsByteStringMozMap()) { } else if (aInit.IsByteStringByteStringRecord()) {
ih->Fill(aInit.GetAsByteStringMozMap(), aRv); ih->Fill(aInit.GetAsByteStringByteStringRecord(), aRv);
} }
if (NS_WARN_IF(aRv.Failed())) { if (NS_WARN_IF(aRv.Failed())) {

View file

@ -21,8 +21,8 @@ class ErrorResult;
namespace dom { namespace dom {
template<typename T> class MozMap; template<typename T> class MozMap;
class HeadersOrByteStringSequenceSequenceOrByteStringMozMap; class HeadersOrByteStringSequenceSequenceOrByteStringByteStringRecord;
class OwningHeadersOrByteStringSequenceSequenceOrByteStringMozMap; class OwningHeadersOrByteStringSequenceSequenceOrByteStringByteStringRecord;
/** /**
* This Headers class is only used to represent the content facing Headers * This Headers class is only used to represent the content facing Headers
@ -57,17 +57,17 @@ public:
static already_AddRefed<Headers> static already_AddRefed<Headers>
Constructor(const GlobalObject& aGlobal, Constructor(const GlobalObject& aGlobal,
const Optional<HeadersOrByteStringSequenceSequenceOrByteStringMozMap>& aInit, const Optional<HeadersOrByteStringSequenceSequenceOrByteStringByteStringRecord>& aInit,
ErrorResult& aRv); ErrorResult& aRv);
static already_AddRefed<Headers> static already_AddRefed<Headers>
Constructor(const GlobalObject& aGlobal, Constructor(const GlobalObject& aGlobal,
const OwningHeadersOrByteStringSequenceSequenceOrByteStringMozMap& aInit, const OwningHeadersOrByteStringSequenceSequenceOrByteStringByteStringRecord& aInit,
ErrorResult& aRv); ErrorResult& aRv);
static already_AddRefed<Headers> static already_AddRefed<Headers>
Create(nsIGlobalObject* aGlobalObject, Create(nsIGlobalObject* aGlobalObject,
const OwningHeadersOrByteStringSequenceSequenceOrByteStringMozMap& aInit, const OwningHeadersOrByteStringSequenceSequenceOrByteStringByteStringRecord& aInit,
ErrorResult& aRv); ErrorResult& aRv);
void Append(const nsACString& aName, const nsACString& aValue, void Append(const nsACString& aName, const nsACString& aValue,

View file

@ -8,7 +8,7 @@
* http://fetch.spec.whatwg.org/#headers-class * http://fetch.spec.whatwg.org/#headers-class
*/ */
typedef (Headers or sequence<sequence<ByteString>> or MozMap<ByteString>) HeadersInit; typedef (Headers or sequence<sequence<ByteString>> or record<ByteString, ByteString>) HeadersInit;
enum HeadersGuardEnum { enum HeadersGuardEnum {
"none", "none",

View file

@ -57,7 +57,7 @@ interface InstallTriggerImpl {
* A callback to call as each installation succeeds or fails * A callback to call as each installation succeeds or fails
* @return true if the installations were successfully started * @return true if the installations were successfully started
*/ */
boolean install(MozMap<(DOMString or InstallTriggerData)> installs, boolean install(record<DOMString, (DOMString or InstallTriggerData)> installs,
optional InstallTriggerCallback callback); optional InstallTriggerCallback callback);
/** /**

View file

@ -24,7 +24,7 @@ interface TestInterfaceJS : EventTarget {
any pingPongObjectOrString((object or DOMString) objOrString); any pingPongObjectOrString((object or DOMString) objOrString);
TestInterfaceJSDictionary pingPongDictionary(optional TestInterfaceJSDictionary dict); TestInterfaceJSDictionary pingPongDictionary(optional TestInterfaceJSDictionary dict);
long pingPongDictionaryOrLong(optional (TestInterfaceJSUnionableDictionary or long) dictOrLong); long pingPongDictionaryOrLong(optional (TestInterfaceJSUnionableDictionary or long) dictOrLong);
DOMString pingPongMap(MozMap<any> map); DOMString pingPongMap(record<DOMString, any> map);
long objectSequenceLength(sequence<object> seq); long objectSequenceLength(sequence<object> seq);
long anySequenceLength(sequence<any> seq); long anySequenceLength(sequence<any> seq);