From 40a355a42d4a9444dc753c04c6608dade2f06a23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:27 +0200 Subject: Adding upstream version 125.0.1. Signed-off-by: Daniel Baumann --- .../parser/tests/test_distinguishability.py | 97 +++++++++++++++------- 1 file changed, 69 insertions(+), 28 deletions(-) (limited to 'dom/bindings/parser/tests/test_distinguishability.py') diff --git a/dom/bindings/parser/tests/test_distinguishability.py b/dom/bindings/parser/tests/test_distinguishability.py index 8497490b1f..caf726c16b 100644 --- a/dom/bindings/parser/tests/test_distinguishability.py +++ b/dom/bindings/parser/tests/test_distinguishability.py @@ -228,7 +228,9 @@ def WebIDLTest(parser, harness): and (a != "any" and a != "Promise" and a != "Promise?") ] - unions = ["(long or Callback)", "(long or Dict)"] + unionsWithCallback = ["(long or Callback)"] + unionsNoCallback = ["(long or Dict)"] + unions = unionsWithCallback + unionsNoCallback numerics = ["long", "short", "long?", "short?"] booleans = ["boolean", "boolean?"] undefineds = ["undefined", "undefined?"] @@ -265,7 +267,7 @@ def WebIDLTest(parser, harness): "Date?", "any", "Promise?", - ] + allBut(unions, ["(long or Callback)"]) + ] + unionsNoCallback sequences = ["sequence", "sequence"] nonUserObjects = nonObjects + interfaces + sequences otherObjects = allBut(argTypes, nonUserObjects + ["object"]) @@ -282,17 +284,14 @@ def WebIDLTest(parser, harness): "record", "record", ] # JSString not supported in records - dictionaryLike = ( - [ - "Dict", - "Dict2", - "CallbackInterface", - "CallbackInterface?", - "CallbackInterface2", - ] - + records - + allBut(unions, ["(long or Callback)"]) - ) + dicts = ["Dict", "Dict2"] + callbacks = ["Callback", "Callback2"] + callbackInterfaces = [ + "CallbackInterface", + "CallbackInterface?", + "CallbackInterface2", + ] + dictionaryLike = dicts + callbackInterfaces + records + unionsNoCallback # Build a representation of the distinguishability table as a dict # of dicts, holding True values where needed, holes elsewhere. @@ -327,23 +326,60 @@ def WebIDLTest(parser, harness): setDistinguishable( "UnrelatedInterface", allBut(argTypes, ["object", "UnrelatedInterface"]) ) - setDistinguishable("CallbackInterface", allBut(nonUserObjects, undefineds)) setDistinguishable( - "CallbackInterface?", allBut(nonUserObjects, nullables + undefineds) + "CallbackInterface", + allBut(nonUserObjects + callbacks + unionsWithCallback, undefineds), + ) + setDistinguishable( + "CallbackInterface?", + allBut(nonUserObjects + callbacks + unionsWithCallback, nullables + undefineds), + ) + setDistinguishable( + "CallbackInterface2", + allBut(nonUserObjects + callbacks + unionsWithCallback, undefineds), ) - setDistinguishable("CallbackInterface2", allBut(nonUserObjects, undefineds)) setDistinguishable("object", nonObjects) - setDistinguishable("Callback", nonUserObjects) - setDistinguishable("Callback2", nonUserObjects) - setDistinguishable("Dict", allBut(nonUserObjects, nullables + undefineds)) - setDistinguishable("Dict2", allBut(nonUserObjects, nullables + undefineds)) - setDistinguishable("sequence", allBut(argTypes, sequences + ["object"])) - setDistinguishable("sequence", allBut(argTypes, sequences + ["object"])) - setDistinguishable("record", allBut(nonUserObjects, undefineds)) - setDistinguishable("record", allBut(nonUserObjects, undefineds)) + setDistinguishable( + "Callback", + nonUserObjects + unionsNoCallback + dicts + records + callbackInterfaces, + ) + setDistinguishable( + "Callback2", + nonUserObjects + unionsNoCallback + dicts + records + callbackInterfaces, + ) + setDistinguishable( + "Dict", + allBut(nonUserObjects + unionsWithCallback + callbacks, nullables + undefineds), + ) + setDistinguishable( + "Dict2", + allBut(nonUserObjects + unionsWithCallback + callbacks, nullables + undefineds), + ) + setDistinguishable( + "sequence", + allBut(argTypes, sequences + ["object"]), + ) + setDistinguishable( + "sequence", + allBut(argTypes, sequences + ["object"]), + ) + setDistinguishable( + "record", + allBut(nonUserObjects + unionsWithCallback + callbacks, undefineds), + ) + setDistinguishable( + "record", + allBut(nonUserObjects + unionsWithCallback + callbacks, undefineds), + ) # JSString not supported in records - setDistinguishable("record", allBut(nonUserObjects, undefineds)) - setDistinguishable("record", allBut(nonUserObjects, undefineds)) + setDistinguishable( + "record", + allBut(nonUserObjects + unionsWithCallback + callbacks, undefineds), + ) + setDistinguishable( + "record", + allBut(nonUserObjects + unionsWithCallback + callbacks, undefineds), + ) setDistinguishable("any", []) setDistinguishable("Promise", []) setDistinguishable("Promise?", []) @@ -358,9 +394,13 @@ def WebIDLTest(parser, harness): setDistinguishable( "Uint16Array", allBut(argTypes, ["ArrayBufferView", "Uint16Array", "object"]) ) - setDistinguishable("(long or Callback)", allBut(nonUserObjects, numerics)) setDistinguishable( - "(long or Dict)", allBut(nonUserObjects, numerics + nullables + undefineds) + "(long or Callback)", + allBut(nonUserObjects + dicts + records + callbackInterfaces, numerics), + ) + setDistinguishable( + "(long or Dict)", + allBut(nonUserObjects + callbacks, numerics + nullables + undefineds), ) def areDistinguishable(type1, type2): @@ -377,6 +417,7 @@ def WebIDLTest(parser, harness): callback interface CallbackInterface2 {}; callback Callback = any(); callback Callback2 = long(short arg); + [LegacyTreatNonObjectAsNull] callback LegacyCallback1 = any(); // Give our dictionaries required members so we don't need to // mess with optional and default values. dictionary Dict { required long member; }; -- cgit v1.2.3