Sync WebIDL.py with gecko

This commit is contained in:
Kagami Sascha Rosylight
2019-07-11 13:16:10 +09:00
parent 5fdc7c0d2c
commit 56f31c85ef
35 changed files with 727 additions and 221 deletions

View File

@@ -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: