aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/codegen/parser
diff options
context:
space:
mode:
authorMalisa Smith <malisa.tsmith@gmail.com>2016-08-09 17:51:17 -0700
committerMalisa Smith <malisa.tsmith@gmail.com>2016-08-10 10:50:36 -0700
commit7fd65affabd9ab49b254fefce968a9eafabf1fbf (patch)
tree36b40bf2690eec82b1ac9ce653e29438ef58a89d /components/script/dom/bindings/codegen/parser
parent8cd4b772e90224b344010cc6c38cebe47ce10c48 (diff)
downloadservo-7fd65affabd9ab49b254fefce968a9eafabf1fbf.tar.gz
servo-7fd65affabd9ab49b254fefce968a9eafabf1fbf.zip
bindings generator: support default ByteString values in dictionary
Diffstat (limited to 'components/script/dom/bindings/codegen/parser')
-rw-r--r--components/script/dom/bindings/codegen/parser/WebIDL.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/components/script/dom/bindings/codegen/parser/WebIDL.py b/components/script/dom/bindings/codegen/parser/WebIDL.py
index da32340dda6..54d510781a1 100644
--- a/components/script/dom/bindings/codegen/parser/WebIDL.py
+++ b/components/script/dom/bindings/codegen/parser/WebIDL.py
@@ -3391,6 +3391,11 @@ class IDLValue(IDLObject):
# extra normalization step.
assert self.type.isDOMString()
return self
+ elif self.type.isString() and type.isByteString():
+ # Allow ByteStrings to use default value just like
+ # DOMString. No coercion is required here.
+ assert self.type.isDOMString()
+ return self
raise WebIDLError("Cannot coerce type %s to type %s." %
(self.type, type), [location])
@@ -5759,6 +5764,14 @@ class Parser(Tokenizer):
booleanType = BuiltinTypes[IDLBuiltinType.Types.boolean]
p[0] = IDLValue(location, booleanType, p[1])
+ def p_ConstValueByteString(self, p):
+ """
+ ConstValue : BYTESTRING
+ """
+ location = self.getLocation(p, 1)
+ bytestringType = BuiltinTypes[IDLBuiltinType.Types.bytestring]
+ p[0] = IDLValue(location, bytestringType, p[1])
+
def p_ConstValueInteger(self, p):
"""
ConstValue : INTEGER