mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update WebIDL.py (#32495)
* Update WebIDL.py * Update WebIDL.py * Add builtin-array.patch * Fix CodegenRust.py and Configuration.py * Fix missing downcasts * mach fmt * Update check and comment to explain why we need this check * Update Global of DissimilarOriginWindow.webidl
This commit is contained in:
parent
19067366df
commit
8eed3b442b
77 changed files with 1658 additions and 793 deletions
155
third_party/WebIDL/tests/test_dictionary.py
vendored
155
third_party/WebIDL/tests/test_dictionary.py
vendored
|
@ -1,3 +1,6 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
parser.parse(
|
||||
"""
|
||||
|
@ -67,8 +70,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should not allow name duplication in a dictionary")
|
||||
|
@ -87,8 +90,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -112,8 +115,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -132,8 +135,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should not allow non-dictionary parents for dictionaries")
|
||||
|
@ -148,8 +151,8 @@ def WebIDLTest(parser, harness):
|
|||
dictionary B : A {};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should not allow cycles in dictionary inheritance chains")
|
||||
|
@ -164,8 +167,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -184,8 +187,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Trailing dictionary arg must be optional")
|
||||
|
@ -202,8 +205,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Trailing dictionary arg must have a default value")
|
||||
|
@ -220,8 +223,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Trailing union arg containing a dictionary must be optional")
|
||||
|
@ -238,8 +241,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -258,8 +261,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Dictionary arg followed by optional arg must be optional")
|
||||
|
@ -276,8 +279,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Dictionary arg followed by optional arg must have default value")
|
||||
|
@ -294,8 +297,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -315,8 +318,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -336,8 +339,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -356,7 +359,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
harness.ok(True, "Dictionary arg followed by required arg can be required")
|
||||
|
||||
parser = parser.reset()
|
||||
|
@ -371,7 +374,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
except Exception as x:
|
||||
threw = x
|
||||
|
||||
|
@ -394,7 +397,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
except Exception as x:
|
||||
threw = x
|
||||
|
||||
|
@ -416,7 +419,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
except Exception as x:
|
||||
threw = x
|
||||
|
||||
|
@ -440,7 +443,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
except Exception as x:
|
||||
threw = x
|
||||
|
||||
|
@ -463,8 +466,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(not threw, "Nullable union should be allowed in a sequence argument")
|
||||
|
@ -481,8 +484,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Dictionary must not be in a union with a nullable type")
|
||||
|
||||
|
@ -498,8 +501,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "A nullable type must not be in a union with a dictionary")
|
||||
|
||||
|
@ -513,7 +516,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
harness.ok(True, "Dictionary return value can be nullable")
|
||||
|
||||
parser = parser.reset()
|
||||
|
@ -526,7 +529,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
harness.ok(True, "Dictionary arg should actually parse")
|
||||
|
||||
parser = parser.reset()
|
||||
|
@ -539,7 +542,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
harness.ok(True, "Union arg containing a dictionary should actually parse")
|
||||
|
||||
parser = parser.reset()
|
||||
|
@ -552,7 +555,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
harness.ok(
|
||||
True,
|
||||
"Union arg containing a dictionary with string default should actually parse",
|
||||
|
@ -568,8 +571,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Member type must not be its Dictionary.")
|
||||
|
@ -596,8 +599,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -615,8 +618,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -635,8 +638,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -655,8 +658,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -675,8 +678,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -707,8 +710,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -731,8 +734,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Member type must not be a nullable dictionary")
|
||||
|
@ -759,7 +762,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
harness.ok(True, "Parsing default values for unrestricted types succeeded.")
|
||||
|
||||
parser = parser.reset()
|
||||
|
@ -772,8 +775,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Only unrestricted values can be initialized to Infinity")
|
||||
|
@ -788,8 +791,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Only unrestricted values can be initialized to -Infinity")
|
||||
|
@ -804,8 +807,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Only unrestricted values can be initialized to NaN")
|
||||
|
@ -820,8 +823,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Only unrestricted values can be initialized to Infinity")
|
||||
|
@ -836,8 +839,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Only unrestricted values can be initialized to -Infinity")
|
||||
|
@ -852,8 +855,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Only unrestricted values can be initialized to NaN")
|
||||
|
@ -868,8 +871,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(not threw, "Should be able to use 'module' as a dictionary member name")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue