mirror of
https://github.com/servo/servo.git
synced 2025-06-06 00:25:37 +00: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
|
@ -76,7 +76,7 @@ class Configuration:
|
|||
for key, val in filters.items():
|
||||
if key == 'webIDLFile':
|
||||
def getter(x):
|
||||
return x.interface.filename()
|
||||
return x.interface.location.filename
|
||||
elif key == 'hasInterfaceObject':
|
||||
def getter(x):
|
||||
return x.interface.hasInterfaceObject()
|
||||
|
@ -108,10 +108,10 @@ class Configuration:
|
|||
return curr
|
||||
|
||||
def getEnums(self, webIDLFile):
|
||||
return [e for e in self.enums if e.filename() == webIDLFile]
|
||||
return [e for e in self.enums if e.filename == webIDLFile]
|
||||
|
||||
def getTypedefs(self, webIDLFile):
|
||||
return [e for e in self.typedefs if e.filename() == webIDLFile]
|
||||
return [e for e in self.typedefs if e.filename == webIDLFile]
|
||||
|
||||
@staticmethod
|
||||
def _filterForFile(items, webIDLFile=""):
|
||||
|
@ -119,7 +119,7 @@ class Configuration:
|
|||
if not webIDLFile:
|
||||
return items
|
||||
|
||||
return [x for x in items if x.filename() == webIDLFile]
|
||||
return [x for x in items if x.filename == webIDLFile]
|
||||
|
||||
def getDictionaries(self, webIDLFile=""):
|
||||
return self._filterForFile(self.dictionaries, webIDLFile=webIDLFile)
|
||||
|
@ -471,7 +471,7 @@ def MakeNativeName(name):
|
|||
|
||||
|
||||
def getIdlFileName(object):
|
||||
return os.path.basename(object.location.filename()).split('.webidl')[0]
|
||||
return os.path.basename(object.location.filename).split('.webidl')[0]
|
||||
|
||||
|
||||
def getModuleFromObject(object):
|
||||
|
|
|
@ -28,11 +28,10 @@ use crate::dom::bindings::codegen::Bindings::TestBindingBinding::{
|
|||
use crate::dom::bindings::codegen::UnionTypes;
|
||||
use crate::dom::bindings::codegen::UnionTypes::{
|
||||
BlobOrBlobSequence, BlobOrBoolean, BlobOrString, BlobOrUnsignedLong, ByteStringOrLong,
|
||||
ByteStringSequenceOrLong, ByteStringSequenceOrLongOrString, DocumentOrTestTypedef,
|
||||
EventOrString, EventOrUSVString, HTMLElementOrLong, HTMLElementOrUnsignedLongOrStringOrBoolean,
|
||||
LongOrLongSequenceSequence, LongSequenceOrBoolean, LongSequenceOrTestTypedef, StringOrBoolean,
|
||||
StringOrLongSequence, StringOrStringSequence, StringOrUnsignedLong,
|
||||
StringSequenceOrUnsignedLong, UnsignedLongOrBoolean,
|
||||
ByteStringSequenceOrLong, ByteStringSequenceOrLongOrString, EventOrString, EventOrUSVString,
|
||||
HTMLElementOrLong, HTMLElementOrUnsignedLongOrStringOrBoolean, LongOrLongSequenceSequence,
|
||||
LongSequenceOrBoolean, StringOrBoolean, StringOrLongSequence, StringOrStringSequence,
|
||||
StringOrUnsignedLong, StringSequenceOrUnsignedLong, UnsignedLongOrBoolean,
|
||||
};
|
||||
use crate::dom::bindings::error::{Error, Fallible};
|
||||
use crate::dom::bindings::num::Finite;
|
||||
|
@ -655,8 +654,8 @@ impl TestBindingMethods for TestBinding {
|
|||
fn PassUnion9(&self, _: UnionTypes::TestDictionaryOrLong) {}
|
||||
fn PassUnion10(&self, _: SafeJSContext, _: UnionTypes::StringOrObject) {}
|
||||
fn PassUnion11(&self, _: UnionTypes::ArrayBufferOrArrayBufferView) {}
|
||||
fn PassUnionWithTypedef(&self, _: DocumentOrTestTypedef) {}
|
||||
fn PassUnionWithTypedef2(&self, _: LongSequenceOrTestTypedef) {}
|
||||
fn PassUnionWithTypedef(&self, _: UnionTypes::DocumentOrStringOrURLOrBlob) {}
|
||||
fn PassUnionWithTypedef2(&self, _: UnionTypes::LongSequenceOrStringOrURLOrBlob) {}
|
||||
fn PassAny(&self, _: SafeJSContext, _: HandleValue) {}
|
||||
fn PassObject(&self, _: SafeJSContext, _: *mut JSObject) {}
|
||||
fn PassCallbackFunction(&self, _: Rc<Function>) {}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// way to enforce security policy.
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#window
|
||||
[Global, Exposed=(Window,DissimilarOriginWindow), LegacyNoInterfaceObject]
|
||||
[Global=DissimilarOriginWindow, Exposed=(Window,DissimilarOriginWindow), LegacyNoInterfaceObject]
|
||||
interface DissimilarOriginWindow : GlobalScope {
|
||||
[LegacyUnforgeable] readonly attribute WindowProxy window;
|
||||
[BinaryName="Self_", Replaceable] readonly attribute WindowProxy self;
|
||||
|
|
|
@ -46,7 +46,7 @@ use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
|
|||
use crate::dom::bindings::codegen::Bindings::XMLHttpRequestBinding::{
|
||||
XMLHttpRequestMethods, XMLHttpRequestResponseType,
|
||||
};
|
||||
use crate::dom::bindings::codegen::UnionTypes::DocumentOrXMLHttpRequestBodyInit;
|
||||
use crate::dom::bindings::codegen::UnionTypes::DocumentOrBlobOrArrayBufferViewOrArrayBufferOrFormDataOrStringOrURLSearchParams as DocumentOrXMLHttpRequestBodyInit;
|
||||
use crate::dom::bindings::conversions::ToJSValConvertible;
|
||||
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
|
|
660
third_party/WebIDL/WebIDL.py
vendored
660
third_party/WebIDL/WebIDL.py
vendored
File diff suppressed because it is too large
Load diff
49
third_party/WebIDL/builtin-array.patch
vendored
Normal file
49
third_party/WebIDL/builtin-array.patch
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
--- WebIDL.py
|
||||
+++ WebIDL.py
|
||||
@@ -2549,6 +2549,17 @@ class IDLType(IDLObject):
|
||||
"object",
|
||||
# Funny stuff
|
||||
"interface",
|
||||
+ "int8array",
|
||||
+ "uint8array",
|
||||
+ "int16array",
|
||||
+ "uint16array",
|
||||
+ "int32array",
|
||||
+ "uint32array",
|
||||
+ "float32array",
|
||||
+ "float64array",
|
||||
+ "arrayBuffer",
|
||||
+ "arrayBufferView",
|
||||
+ "uint8clampedarray",
|
||||
"dictionary",
|
||||
"enum",
|
||||
"callback",
|
||||
@@ -3842,17 +3853,17 @@ class IDLBuiltinType(IDLType):
|
||||
Types.utf8string: IDLType.Tags.utf8string,
|
||||
Types.jsstring: IDLType.Tags.jsstring,
|
||||
Types.object: IDLType.Tags.object,
|
||||
- Types.ArrayBuffer: IDLType.Tags.interface,
|
||||
- Types.ArrayBufferView: IDLType.Tags.interface,
|
||||
- Types.Int8Array: IDLType.Tags.interface,
|
||||
- Types.Uint8Array: IDLType.Tags.interface,
|
||||
- Types.Uint8ClampedArray: IDLType.Tags.interface,
|
||||
- Types.Int16Array: IDLType.Tags.interface,
|
||||
- Types.Uint16Array: IDLType.Tags.interface,
|
||||
- Types.Int32Array: IDLType.Tags.interface,
|
||||
- Types.Uint32Array: IDLType.Tags.interface,
|
||||
- Types.Float32Array: IDLType.Tags.interface,
|
||||
- Types.Float64Array: IDLType.Tags.interface,
|
||||
+ Types.ArrayBuffer: IDLType.Tags.arrayBuffer,
|
||||
+ Types.ArrayBufferView: IDLType.Tags.arrayBufferView,
|
||||
+ Types.Int8Array: IDLType.Tags.int8array,
|
||||
+ Types.Uint8Array: IDLType.Tags.uint8array,
|
||||
+ Types.Uint8ClampedArray: IDLType.Tags.uint8clampedarray,
|
||||
+ Types.Int16Array: IDLType.Tags.int16array,
|
||||
+ Types.Uint16Array: IDLType.Tags.uint16array,
|
||||
+ Types.Int32Array: IDLType.Tags.int32array,
|
||||
+ Types.Uint32Array: IDLType.Tags.uint32array,
|
||||
+ Types.Float32Array: IDLType.Tags.float32array,
|
||||
+ Types.Float64Array: IDLType.Tags.float64array,
|
||||
Types.ReadableStream: IDLType.Tags.interface,
|
||||
}
|
||||
|
7
third_party/WebIDL/tests/test_any_null.py
vendored
7
third_party/WebIDL/tests/test_any_null.py
vendored
|
@ -1,3 +1,6 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
|
@ -9,8 +12,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
|
@ -9,8 +12,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
|
19
third_party/WebIDL/tests/test_argument_novoid.py
vendored
Normal file
19
third_party/WebIDL/tests/test_argument_novoid.py
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
interface VoidArgument1 {
|
||||
void foo(void arg2);
|
||||
};
|
||||
"""
|
||||
)
|
||||
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
8
third_party/WebIDL/tests/test_attr.py
vendored
8
third_party/WebIDL/tests/test_attr.py
vendored
|
@ -147,7 +147,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow [SetterThrows] on readonly attributes")
|
||||
|
||||
|
@ -162,7 +162,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should spell [Throws] correctly")
|
||||
|
||||
|
@ -177,7 +177,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw, "Should not allow [SameObject] on attributes not of interface type"
|
||||
|
@ -194,6 +194,6 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(not threw, "Should allow [SameObject] on attributes of interface type")
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
|
@ -9,8 +12,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Attribute type must not be a sequence type")
|
||||
|
@ -27,8 +30,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Attribute type must not be a union with a sequence member type")
|
||||
|
@ -45,8 +48,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -59,15 +62,15 @@ def WebIDLTest(parser, harness):
|
|||
threw = False
|
||||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
interface AttrUnionWithUnionWithSequenceType {
|
||||
attribute ((sequence<object> or DOMString) or AttrUnionWithUnionWithSequenceType) foo;
|
||||
};
|
||||
"""
|
||||
"\n"
|
||||
" interface AttrUnionWithUnionWithSequenceType {\n"
|
||||
" attribute ((sequence<object> or DOMString) or "
|
||||
"AttrUnionWithUnionWithSequenceType) foo;\n"
|
||||
" };\n"
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# Import the WebIDL module, so we can do isinstance checks and whatnot
|
||||
import WebIDL
|
||||
|
||||
|
||||
|
@ -46,7 +45,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(not threw, "Should not have thrown on parsing normal")
|
||||
|
@ -182,7 +181,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(not threw, "Should not have thrown on parsing normal")
|
||||
|
@ -341,22 +340,22 @@ def WebIDLTest(parser, harness):
|
|||
),
|
||||
]
|
||||
|
||||
for (name, template) in TEMPLATES:
|
||||
for name, template in TEMPLATES:
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse(template % ("", "long"))
|
||||
parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(not threw, "Template for %s parses without attributes" % name)
|
||||
for (attribute, type) in ATTRIBUTES:
|
||||
for attribute, type in ATTRIBUTES:
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse(template % (attribute, type))
|
||||
parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow %s on %s" % (attribute, name))
|
||||
|
||||
|
@ -369,7 +368,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should not allow mixing [Clamp] and [EnforceRange]")
|
||||
|
@ -383,7 +382,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should not allow mixing [Clamp] and [EnforceRange]")
|
||||
|
@ -398,7 +397,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should not allow mixing [Clamp] and [EnforceRange] via typedefs")
|
||||
|
@ -413,7 +412,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should not allow mixing [Clamp] and [EnforceRange] via typedefs")
|
||||
|
@ -437,7 +436,7 @@ def WebIDLTest(parser, harness):
|
|||
% type
|
||||
)
|
||||
parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should not allow [Clamp] on %s" % type)
|
||||
|
@ -452,7 +451,7 @@ def WebIDLTest(parser, harness):
|
|||
% type
|
||||
)
|
||||
parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should not allow [EnforceRange] on %s" % type)
|
||||
|
@ -466,7 +465,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should not allow [LegacyNullToEmptyString] on long")
|
||||
|
@ -480,7 +479,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should not allow [LegacyNullToEmptyString] on JSString")
|
||||
|
@ -494,7 +493,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -510,7 +509,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "[AllowShared] only allowed on buffer source types")
|
||||
|
||||
|
@ -523,7 +522,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "[AllowShared] must take no arguments")
|
||||
|
||||
|
@ -539,7 +538,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(not threw, "Should allow type attributes on unresolved types")
|
||||
harness.check(
|
||||
|
@ -560,11 +559,12 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(not threw, "Should allow type attributes on typedefs")
|
||||
harness.check(
|
||||
results[0].members[0].signatures()[0][1][0].type.hasClamp(),
|
||||
True,
|
||||
"Unresolved types that resolve to typedefs with attributes should correctly resolve with attributes",
|
||||
"Unresolved types that resolve to typedefs with attributes should correctly resolve with "
|
||||
"attributes",
|
||||
)
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
parser.parse(
|
||||
"""
|
||||
|
@ -11,4 +8,4 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
attr = parser.finish()[0].members[0]
|
||||
harness.check(attr.type.filename(), "<builtin>", "Filename on builtin type")
|
||||
harness.check(attr.type.filename, "<builtin>", "Filename on builtin type")
|
||||
|
|
8
third_party/WebIDL/tests/test_bytestring.py
vendored
8
third_party/WebIDL/tests/test_bytestring.py
vendored
|
@ -79,7 +79,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results2 = parser.finish()
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError as e:
|
||||
harness.ok(
|
||||
False,
|
||||
|
@ -96,7 +96,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results3 = parser.finish()
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError as e:
|
||||
harness.ok(
|
||||
False,
|
||||
|
@ -114,8 +114,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results4 = parser.finish()
|
||||
except WebIDL.WebIDLError as e:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
|
|
@ -59,7 +59,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -76,7 +76,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
|
|
@ -28,8 +28,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should not allow non-callback parent of callback interface")
|
||||
|
@ -46,8 +46,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should not allow callback parent of non-callback interface")
|
||||
|
@ -97,7 +97,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
for (i, iface) in enumerate(results):
|
||||
for i, iface in enumerate(results):
|
||||
harness.check(
|
||||
iface.isSingleOperationInterface(),
|
||||
i < 4,
|
||||
|
|
35
third_party/WebIDL/tests/test_cereactions.py
vendored
35
third_party/WebIDL/tests/test_cereactions.py
vendored
|
@ -1,3 +1,6 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
|
@ -9,8 +12,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown for [CEReactions] with an argument")
|
||||
|
@ -26,8 +29,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown for [CEReactions] with an argument")
|
||||
|
@ -43,7 +46,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
except Exception as e:
|
||||
harness.ok(
|
||||
False,
|
||||
|
@ -63,7 +66,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
except Exception as e:
|
||||
harness.ok(
|
||||
False,
|
||||
|
@ -83,8 +86,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -102,8 +105,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown for [CEReactions] used on a interface")
|
||||
|
@ -118,8 +121,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown for [CEReactions] used on a named getter")
|
||||
|
@ -134,8 +137,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown for [CEReactions] used on a legacycaller")
|
||||
|
@ -150,8 +153,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown for [CEReactions] used on a stringifier")
|
||||
|
|
4
third_party/WebIDL/tests/test_const.py
vendored
4
third_party/WebIDL/tests/test_const.py
vendored
|
@ -64,7 +64,7 @@ def WebIDLTest(parser, harness):
|
|||
len(iface.members), len(expected), "Expect %s members" % len(expected)
|
||||
)
|
||||
|
||||
for (const, (QName, name, type, value)) in zip(iface.members, expected):
|
||||
for const, (QName, name, type, value) in zip(iface.members, expected):
|
||||
harness.ok(isinstance(const, WebIDL.IDLConst), "Should be an IDLConst")
|
||||
harness.ok(const.isConst(), "Const is a const")
|
||||
harness.ok(not const.isAttr(), "Const is not an attr")
|
||||
|
@ -91,6 +91,6 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Nullable types are not allowed for consts.")
|
||||
|
|
50
third_party/WebIDL/tests/test_constructor.py
vendored
50
third_party/WebIDL/tests/test_constructor.py
vendored
|
@ -87,7 +87,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
sigpairs = zip(method.signatures(), signatures)
|
||||
for (gotSignature, expectedSignature) in sigpairs:
|
||||
for gotSignature, expectedSignature in sigpairs:
|
||||
(gotRetType, gotArgs) = gotSignature
|
||||
(expectedRetType, expectedArgs) = expectedSignature
|
||||
|
||||
|
@ -264,7 +264,7 @@ def WebIDLTest(parser, harness):
|
|||
parser.parse(
|
||||
"""
|
||||
interface TestFuncConstructor {
|
||||
[Func="Document::IsWebAnimationsEnabled"] constructor();
|
||||
[Func="IsNotUAWidget"] constructor();
|
||||
};
|
||||
"""
|
||||
)
|
||||
|
@ -277,17 +277,19 @@ def WebIDLTest(parser, harness):
|
|||
"::TestFuncConstructor::constructor",
|
||||
"constructor",
|
||||
[("TestFuncConstructor (Wrapper)", [])],
|
||||
func=["Document::IsWebAnimationsEnabled"],
|
||||
func=["IsNotUAWidget"],
|
||||
)
|
||||
|
||||
parser = parser.reset()
|
||||
parser.parse(
|
||||
"""
|
||||
interface TestPrefChromeOnlySCFuncConstructor {
|
||||
[ChromeOnly, Pref="dom.webidl.test1", SecureContext, Func="Document::IsWebAnimationsEnabled"]
|
||||
constructor();
|
||||
};
|
||||
"""
|
||||
(
|
||||
"\n"
|
||||
" interface TestPrefChromeOnlySCFuncConstructor {\n"
|
||||
' [ChromeOnly, Pref="dom.webidl.test1", SecureContext, '
|
||||
'Func="IsNotUAWidget"]\n'
|
||||
" constructor();\n"
|
||||
" };\n"
|
||||
)
|
||||
)
|
||||
results = parser.finish()
|
||||
harness.check(len(results), 1, "Should be one production")
|
||||
|
@ -298,7 +300,7 @@ def WebIDLTest(parser, harness):
|
|||
"::TestPrefChromeOnlySCFuncConstructor::constructor",
|
||||
"constructor",
|
||||
[("TestPrefChromeOnlySCFuncConstructor (Wrapper)", [])],
|
||||
func=["Document::IsWebAnimationsEnabled"],
|
||||
func=["IsNotUAWidget"],
|
||||
pref=["dom.webidl.test1"],
|
||||
chromeOnly=True,
|
||||
secureContext=True,
|
||||
|
@ -336,7 +338,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Can't have both a constructor and a ChromeOnly constructor")
|
||||
|
@ -353,7 +355,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "HTMLConstructor should take no argument")
|
||||
|
@ -370,7 +372,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "HTMLConstructor can't be used on a callback interface")
|
||||
|
@ -388,7 +390,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Can't have both a constructor and a HTMLConstructor")
|
||||
|
@ -406,7 +408,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Can't have both a throwing constructor and a HTMLConstructor")
|
||||
|
@ -423,7 +425,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Can't have both a HTMLConstructor and a constructor operation")
|
||||
|
@ -441,7 +443,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -463,7 +465,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Can't have both a ChromeOnly constructor and a HTMLConstructor")
|
||||
|
@ -481,7 +483,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -502,7 +504,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -523,7 +525,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -544,7 +546,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -567,7 +569,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Can't have a constructor operation on a partial interface")
|
||||
|
@ -588,7 +590,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Can't have a constructor operation on a mixin")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import traceback
|
||||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
|
@ -6,15 +6,15 @@ def WebIDLTest(parser, harness):
|
|||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
[Global, Exposed=TestConstructorGlobal]
|
||||
[Global=TestConstructorGlobal, Exposed=TestConstructorGlobal]
|
||||
interface TestConstructorGlobal {
|
||||
constructor();
|
||||
};
|
||||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -24,14 +24,14 @@ def WebIDLTest(parser, harness):
|
|||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
[Global, Exposed=TestLegacyFactoryFunctionGlobal,
|
||||
[Global=TestLegacyFactoryFunctionGlobal, Exposed=TestLegacyFactoryFunctionGlobal,
|
||||
LegacyFactoryFunction=FooBar]
|
||||
interface TestLegacyFactoryFunctionGlobal {
|
||||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -41,14 +41,14 @@ def WebIDLTest(parser, harness):
|
|||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
[LegacyFactoryFunction=FooBar, Global,
|
||||
[LegacyFactoryFunction=FooBar, Global=TestLegacyFactoryFunctionGlobal,
|
||||
Exposed=TestLegacyFactoryFunctionGlobal]
|
||||
interface TestLegacyFactoryFunctionGlobal {
|
||||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -58,15 +58,15 @@ def WebIDLTest(parser, harness):
|
|||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
[Global, Exposed=TestHTMLConstructorGlobal]
|
||||
[Global=TestHTMLConstructorGlobal, Exposed=TestHTMLConstructorGlobal]
|
||||
interface TestHTMLConstructorGlobal {
|
||||
[HTMLConstructor] constructor();
|
||||
};
|
||||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
|
@ -10,8 +13,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -40,8 +43,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
|
3
third_party/WebIDL/tests/test_deduplicate.py
vendored
3
third_party/WebIDL/tests/test_deduplicate.py
vendored
|
@ -1,6 +1,3 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
parser.parse(
|
||||
"""
|
||||
|
|
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")
|
||||
|
|
112
third_party/WebIDL/tests/test_distinguishability.py
vendored
112
third_party/WebIDL/tests/test_distinguishability.py
vendored
|
@ -1,4 +1,4 @@
|
|||
import traceback
|
||||
import WebIDL
|
||||
|
||||
|
||||
def firstArgType(method):
|
||||
|
@ -143,8 +143,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -167,8 +167,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should throw when there is no distinguishing index")
|
||||
|
@ -228,7 +228,9 @@ def WebIDLTest(parser, harness):
|
|||
and (a != "any" and a != "Promise<any>" and a != "Promise<any>?")
|
||||
]
|
||||
|
||||
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?"]
|
||||
|
@ -246,7 +248,6 @@ def WebIDLTest(parser, harness):
|
|||
]
|
||||
nonStrings = allBut(argTypes, strings)
|
||||
nonObjects = undefineds + primitives + strings
|
||||
objects = allBut(argTypes, nonObjects)
|
||||
bufferSourceTypes = ["ArrayBuffer", "ArrayBufferView", "Uint8Array", "Uint16Array"]
|
||||
interfaces = [
|
||||
"Interface",
|
||||
|
@ -266,7 +267,7 @@ def WebIDLTest(parser, harness):
|
|||
"Date?",
|
||||
"any",
|
||||
"Promise<any>?",
|
||||
] + allBut(unions, ["(long or Callback)"])
|
||||
] + unionsNoCallback
|
||||
sequences = ["sequence<long>", "sequence<short>"]
|
||||
nonUserObjects = nonObjects + interfaces + sequences
|
||||
otherObjects = allBut(argTypes, nonUserObjects + ["object"])
|
||||
|
@ -283,17 +284,14 @@ def WebIDLTest(parser, harness):
|
|||
"record<ByteString, long>",
|
||||
"record<UTF8String, long>",
|
||||
] # 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.
|
||||
|
@ -328,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<long>", allBut(argTypes, sequences + ["object"]))
|
||||
setDistinguishable("sequence<short>", allBut(argTypes, sequences + ["object"]))
|
||||
setDistinguishable("record<DOMString, object>", allBut(nonUserObjects, undefineds))
|
||||
setDistinguishable("record<USVString, Dict>", 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<long>",
|
||||
allBut(argTypes, sequences + ["object"]),
|
||||
)
|
||||
setDistinguishable(
|
||||
"sequence<short>",
|
||||
allBut(argTypes, sequences + ["object"]),
|
||||
)
|
||||
setDistinguishable(
|
||||
"record<DOMString, object>",
|
||||
allBut(nonUserObjects + unionsWithCallback + callbacks, undefineds),
|
||||
)
|
||||
setDistinguishable(
|
||||
"record<USVString, Dict>",
|
||||
allBut(nonUserObjects + unionsWithCallback + callbacks, undefineds),
|
||||
)
|
||||
# JSString not supported in records
|
||||
setDistinguishable("record<ByteString, long>", allBut(nonUserObjects, undefineds))
|
||||
setDistinguishable("record<UTF8String, long>", allBut(nonUserObjects, undefineds))
|
||||
setDistinguishable(
|
||||
"record<ByteString, long>",
|
||||
allBut(nonUserObjects + unionsWithCallback + callbacks, undefineds),
|
||||
)
|
||||
setDistinguishable(
|
||||
"record<UTF8String, long>",
|
||||
allBut(nonUserObjects + unionsWithCallback + callbacks, undefineds),
|
||||
)
|
||||
setDistinguishable("any", [])
|
||||
setDistinguishable("Promise<any>", [])
|
||||
setDistinguishable("Promise<any>?", [])
|
||||
|
@ -359,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):
|
||||
|
@ -378,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; };
|
||||
|
@ -401,8 +441,8 @@ def WebIDLTest(parser, harness):
|
|||
threw = False
|
||||
try:
|
||||
parser.parse(idl)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
if areDistinguishable(type1, type2):
|
||||
|
|
7
third_party/WebIDL/tests/test_double_null.py
vendored
7
third_party/WebIDL/tests/test_double_null.py
vendored
|
@ -1,3 +1,6 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
|
@ -9,8 +12,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
|
@ -9,8 +12,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -25,8 +28,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -41,8 +44,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -57,8 +60,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
|
4
third_party/WebIDL/tests/test_empty_enum.py
vendored
4
third_party/WebIDL/tests/test_empty_enum.py
vendored
|
@ -11,7 +11,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
harness.ok(False, "Should have thrown!")
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
harness.ok(True, "Parsing TestEmptyEnum enum should fail")
|
||||
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
|
|
|
@ -13,7 +13,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Constant cannot have [] as a default value")
|
||||
|
|
4
third_party/WebIDL/tests/test_enum.py
vendored
4
third_party/WebIDL/tests/test_enum.py
vendored
|
@ -86,8 +86,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should not allow a bogus default value for an enum")
|
||||
|
|
|
@ -12,5 +12,5 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
harness.ok(False, "Should have thrown!")
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
harness.ok(True, "Enum TestEnumDuplicateValue should throw")
|
||||
|
|
2
third_party/WebIDL/tests/test_error_colno.py
vendored
2
third_party/WebIDL/tests/test_error_colno.py
vendored
|
@ -8,7 +8,7 @@ def WebIDLTest(parser, harness):
|
|||
input = "interface ?"
|
||||
try:
|
||||
parser.parse(input)
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError as e:
|
||||
threw = True
|
||||
lines = str(e).split("\n")
|
||||
|
|
|
@ -14,7 +14,7 @@ interface Foo {
|
|||
interface ?"""
|
||||
try:
|
||||
parser.parse(input)
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError as e:
|
||||
threw = True
|
||||
lines = str(e).split("\n")
|
||||
|
|
|
@ -4,7 +4,7 @@ import WebIDL
|
|||
def WebIDLTest(parser, harness):
|
||||
parser.parse(
|
||||
"""
|
||||
[Global, Exposed=Foo] interface Foo {};
|
||||
[Global=Foo, Exposed=Foo] interface Foo {};
|
||||
[Global=(Bar, Bar1,Bar2), Exposed=Bar] interface Bar {};
|
||||
[Global=(Baz, Baz2), Exposed=Baz] interface Baz {};
|
||||
|
||||
|
@ -70,7 +70,7 @@ def WebIDLTest(parser, harness):
|
|||
parser = parser.reset()
|
||||
parser.parse(
|
||||
"""
|
||||
[Global, Exposed=Foo] interface Foo {};
|
||||
[Global=Foo, Exposed=Foo] interface Foo {};
|
||||
[Global=(Bar, Bar1, Bar2), Exposed=Bar] interface Bar {};
|
||||
[Global=(Baz, Baz2), Exposed=Baz] interface Baz {};
|
||||
|
||||
|
@ -108,7 +108,7 @@ def WebIDLTest(parser, harness):
|
|||
parser = parser.reset()
|
||||
parser.parse(
|
||||
"""
|
||||
[Global, Exposed=Foo] interface Foo {};
|
||||
[Global=Foo, Exposed=Foo] interface Foo {};
|
||||
[Global=(Bar, Bar1, Bar2), Exposed=Bar] interface Bar {};
|
||||
[Global=(Baz, Baz2), Exposed=Baz] interface Baz {};
|
||||
|
||||
|
@ -162,7 +162,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown on invalid Exposed value on interface.")
|
||||
|
@ -180,7 +180,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown on invalid Exposed value on attribute.")
|
||||
|
@ -198,7 +198,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown on invalid Exposed value on operation.")
|
||||
|
@ -216,7 +216,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown on invalid Exposed value on constant.")
|
||||
|
@ -226,8 +226,8 @@ def WebIDLTest(parser, harness):
|
|||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
[Global, Exposed=Foo] interface Foo {};
|
||||
[Global, Exposed=Bar] interface Bar {};
|
||||
[Global=Foo, Exposed=Foo] interface Foo {};
|
||||
[Global=Bar, Exposed=Bar] interface Bar {};
|
||||
|
||||
[Exposed=Foo]
|
||||
interface Baz {
|
||||
|
@ -238,7 +238,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -248,8 +248,8 @@ def WebIDLTest(parser, harness):
|
|||
parser = parser.reset()
|
||||
parser.parse(
|
||||
"""
|
||||
[Global, Exposed=Foo] interface Foo {};
|
||||
[Global, Exposed=Bar] interface Bar {};
|
||||
[Global=Foo, Exposed=Foo] interface Foo {};
|
||||
[Global=Bar, Exposed=Bar] interface Bar {};
|
||||
|
||||
[Exposed=Foo]
|
||||
interface Baz {
|
||||
|
@ -294,8 +294,8 @@ def WebIDLTest(parser, harness):
|
|||
parser = parser.reset()
|
||||
parser.parse(
|
||||
"""
|
||||
[Global, Exposed=Foo] interface Foo {};
|
||||
[Global, Exposed=Bar] interface Bar {};
|
||||
[Global=Foo, Exposed=Foo] interface Foo {};
|
||||
[Global=Bar, Exposed=Bar] interface Bar {};
|
||||
|
||||
[Exposed=*]
|
||||
interface Baz {
|
||||
|
@ -342,8 +342,8 @@ def WebIDLTest(parser, harness):
|
|||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
[Global, Exposed=Foo] interface Foo {};
|
||||
[Global, Exposed=Bar] interface Bar {};
|
||||
[Global=Foo, Exposed=Foo] interface Foo {};
|
||||
[Global=Bar, Exposed=Bar] interface Bar {};
|
||||
|
||||
[Exposed=Foo]
|
||||
interface Baz {
|
||||
|
@ -354,7 +354,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -366,8 +366,8 @@ def WebIDLTest(parser, harness):
|
|||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
[Global, Exposed=Foo] interface Foo {};
|
||||
[Global, Exposed=Bar] interface Bar {};
|
||||
[Global=Foo, Exposed=Foo] interface Foo {};
|
||||
[Global=Bar, Exposed=Bar] interface Bar {};
|
||||
|
||||
[Exposed=(Foo,*)]
|
||||
interface Baz {
|
||||
|
@ -377,7 +377,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown on a wildcard in an identifier list.")
|
||||
|
|
|
@ -11,7 +11,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
|
||||
parser = parser.reset()
|
||||
parser.parse(
|
||||
|
@ -23,7 +23,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
|
||||
parser = parser.reset()
|
||||
parser.parse(
|
||||
|
@ -49,8 +49,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "[LegacyLenientThis] must take no arguments")
|
||||
|
@ -86,8 +86,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "[Clamp] must take no arguments")
|
||||
|
@ -124,8 +124,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "[EnforceRange] must take no arguments")
|
||||
|
|
12
third_party/WebIDL/tests/test_float_types.py
vendored
12
third_party/WebIDL/tests/test_float_types.py
vendored
|
@ -55,7 +55,7 @@ def WebIDLTest(parser, harness):
|
|||
method = iface.members[6]
|
||||
harness.ok(isinstance(method, WebIDL.IDLMethod), "Should be an IDLMethod")
|
||||
argtypes = [a.type for a in method.signatures()[0][1]]
|
||||
for (idx, type) in enumerate(argtypes):
|
||||
for idx, type in enumerate(argtypes):
|
||||
harness.ok(type.isFloat(), "Type %d should be float" % idx)
|
||||
harness.check(
|
||||
type.isUnrestricted(),
|
||||
|
@ -74,7 +74,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "[LenientFloat] only allowed on methods returning undefined")
|
||||
|
||||
|
@ -89,7 +89,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw, "[LenientFloat] only allowed on methods with unrestricted float args"
|
||||
|
@ -106,7 +106,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw, "[LenientFloat] only allowed on methods with unrestricted float args (2)"
|
||||
|
@ -123,7 +123,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw, "[LenientFloat] only allowed on methods with unrestricted float args (3)"
|
||||
|
@ -140,6 +140,6 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "[LenientFloat] only allowed on writable attributes")
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
parser.parse(
|
||||
"""
|
||||
|
@ -13,6 +10,6 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
|
||||
harness.ok(True, "TestForwardDeclared interface parsed without error.")
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
parser.parse(
|
||||
"""
|
||||
[Global, Exposed=Foo]
|
||||
[Global=Foo, Exposed=Foo]
|
||||
interface Foo : Bar {
|
||||
getter any(DOMString name);
|
||||
};
|
||||
|
@ -26,15 +29,15 @@ def WebIDLTest(parser, harness):
|
|||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
[Global, Exposed=Foo]
|
||||
[Global=Foo, Exposed=Foo]
|
||||
interface Foo {
|
||||
getter any(DOMString name);
|
||||
setter undefined(DOMString name, any arg);
|
||||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -47,15 +50,15 @@ def WebIDLTest(parser, harness):
|
|||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
[Global, Exposed=Foo]
|
||||
[Global=Foo, Exposed=Foo]
|
||||
interface Foo {
|
||||
getter any(DOMString name);
|
||||
deleter undefined(DOMString name);
|
||||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -68,13 +71,13 @@ def WebIDLTest(parser, harness):
|
|||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
[Global, LegacyOverrideBuiltIns, Exposed=Foo]
|
||||
[Global=Foo, LegacyOverrideBuiltIns, Exposed=Foo]
|
||||
interface Foo {
|
||||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -88,7 +91,7 @@ def WebIDLTest(parser, harness):
|
|||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
[Global, Exposed=Foo]
|
||||
[Global=Foo, Exposed=Foo]
|
||||
interface Foo : Bar {
|
||||
};
|
||||
[LegacyOverrideBuiltIns, Exposed=Foo]
|
||||
|
@ -96,8 +99,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -111,7 +114,7 @@ def WebIDLTest(parser, harness):
|
|||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
[Global, Exposed=Foo]
|
||||
[Global=Foo, Exposed=Foo]
|
||||
interface Foo {
|
||||
};
|
||||
[Exposed=Foo]
|
||||
|
@ -119,11 +122,30 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
threw,
|
||||
"Should have thrown for [Global] used on an interface with a " "descendant",
|
||||
)
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
[Global, Exposed=Foo]
|
||||
interface Foo {
|
||||
};
|
||||
"""
|
||||
)
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
threw,
|
||||
"Should have thrown for [Global] without a right hand side value",
|
||||
)
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
# Import the WebIDL module, so we can do isinstance checks and whatnot
|
||||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
try:
|
||||
parser.parse(
|
||||
|
@ -10,7 +6,7 @@ def WebIDLTest(parser, harness):
|
|||
interface Foo;
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
harness.ok(False, "Should fail to parse")
|
||||
except Exception as e:
|
||||
harness.ok(
|
||||
|
@ -25,7 +21,7 @@ def WebIDLTest(parser, harness):
|
|||
enum Foo { "a" };
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
harness.ok(False, "Should fail to parse")
|
||||
except Exception as e:
|
||||
harness.ok(
|
||||
|
@ -40,7 +36,7 @@ def WebIDLTest(parser, harness):
|
|||
enum Foo { "b" };
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
harness.ok(False, "Should fail to parse")
|
||||
except Exception as e:
|
||||
harness.ok(
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
parser.parse(
|
||||
"""
|
||||
|
|
38
third_party/WebIDL/tests/test_interface.py
vendored
38
third_party/WebIDL/tests/test_interface.py
vendored
|
@ -70,7 +70,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should not allow cycles in interface inheritance chains")
|
||||
|
@ -86,7 +86,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -103,7 +103,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -223,7 +223,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow two non-partial interfaces with the same name")
|
||||
|
||||
|
@ -241,7 +241,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Must have a non-partial interface for a given name")
|
||||
|
||||
|
@ -259,7 +259,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw,
|
||||
|
@ -281,7 +281,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw, "Should not allow a name collision between interface " "and other object"
|
||||
|
@ -299,7 +299,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw,
|
||||
|
@ -319,7 +319,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw,
|
||||
|
@ -351,14 +351,14 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow unknown extended attributes on interfaces")
|
||||
|
||||
parser = parser.reset()
|
||||
parser.parse(
|
||||
"""
|
||||
[Global, Exposed=Window] interface Window {};
|
||||
[Global=Window, Exposed=Window] interface Window {};
|
||||
[Exposed=Window, LegacyWindowAlias=A]
|
||||
interface B {};
|
||||
[Exposed=Window, LegacyWindowAlias=(C, D)]
|
||||
|
@ -383,7 +383,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow [LegacyWindowAlias] with no value")
|
||||
|
||||
|
@ -397,7 +397,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow [LegacyWindowAlias] without Window exposure")
|
||||
|
||||
|
@ -406,7 +406,7 @@ def WebIDLTest(parser, harness):
|
|||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
[Global, Exposed=Window] interface Window {};
|
||||
[Global=Window, Exposed=Window] interface Window {};
|
||||
[Exposed=Window]
|
||||
interface A {};
|
||||
[Exposed=Window, LegacyWindowAlias=A]
|
||||
|
@ -414,7 +414,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw, "Should not allow [LegacyWindowAlias] to conflict with other identifiers"
|
||||
|
@ -425,7 +425,7 @@ def WebIDLTest(parser, harness):
|
|||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
[Global, Exposed=Window] interface Window {};
|
||||
[Global=Window, Exposed=Window] interface Window {};
|
||||
[Exposed=Window, LegacyWindowAlias=A]
|
||||
interface B {};
|
||||
[Exposed=Window]
|
||||
|
@ -433,7 +433,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw, "Should not allow [LegacyWindowAlias] to conflict with other identifiers"
|
||||
|
@ -444,7 +444,7 @@ def WebIDLTest(parser, harness):
|
|||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
[Global, Exposed=Window] interface Window {};
|
||||
[Global=Window, Exposed=Window] interface Window {};
|
||||
[Exposed=Window, LegacyWindowAlias=A]
|
||||
interface B {};
|
||||
[Exposed=Window, LegacyWindowAlias=A]
|
||||
|
@ -452,7 +452,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw, "Should not allow [LegacyWindowAlias] to conflict with other identifiers"
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
|
@ -10,8 +13,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
|
@ -10,12 +13,13 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
harness.ok(threw, "Should have thrown for IdentifierConflictAcrossMembers1.")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse(
|
||||
|
@ -27,12 +31,13 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
harness.ok(threw, "Should have thrown for IdentifierConflictAcrossMembers2.")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse(
|
||||
|
@ -44,25 +49,123 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
harness.ok(threw, "Should have thrown for IdentifierConflictAcrossMembers3.")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
interface IdentifierConflictAcrossMembers1 {
|
||||
interface IdentifierConflictAcrossMembers4 {
|
||||
const byte thing1 = 1;
|
||||
long thing1();
|
||||
};
|
||||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
harness.ok(threw, "Should have thrown for IdentifierConflictAcrossMembers4.")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
interface IdentifierConflictAcrossMembers5 {
|
||||
static long thing1();
|
||||
undefined thing1();
|
||||
};
|
||||
"""
|
||||
)
|
||||
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
not threw, "Should not have thrown for IdentifierConflictAcrossMembers5."
|
||||
)
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
interface mixin IdentifierConflictAcrossMembers6Mixin {
|
||||
undefined thing1();
|
||||
};
|
||||
interface IdentifierConflictAcrossMembers6 {
|
||||
static long thing1();
|
||||
};
|
||||
IdentifierConflictAcrossMembers6 includes IdentifierConflictAcrossMembers6Mixin;
|
||||
"""
|
||||
)
|
||||
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
not threw, "Should not have thrown for IdentifierConflictAcrossMembers6."
|
||||
)
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
interface IdentifierConflictAcrossMembers7 {
|
||||
const byte thing1 = 1;
|
||||
static readonly attribute long thing1;
|
||||
};
|
||||
"""
|
||||
)
|
||||
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown for IdentifierConflictAcrossMembers7.")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
interface IdentifierConflictAcrossMembers8 {
|
||||
readonly attribute long thing1 = 1;
|
||||
static readonly attribute long thing1;
|
||||
};
|
||||
"""
|
||||
)
|
||||
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown for IdentifierConflictAcrossMembers8.")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
interface IdentifierConflictAcrossMembers9 {
|
||||
void thing1();
|
||||
static readonly attribute long thing1;
|
||||
};
|
||||
"""
|
||||
)
|
||||
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown for IdentifierConflictAcrossMembers9.")
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import WebIDL
|
||||
import traceback
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
|
@ -20,7 +19,10 @@ def WebIDLTest(parser, harness):
|
|||
expectedMembers = list(expectedMembers)
|
||||
for m in results[0].members:
|
||||
name = m.identifier.name
|
||||
if (name, type(m)) in expectedMembers:
|
||||
if m.isMethod() and m.isStatic():
|
||||
# None of the expected members are static methods, so ignore those.
|
||||
harness.ok(True, "%s - %s - Should be a %s" % (prefix, name, type(m)))
|
||||
elif (name, type(m)) in expectedMembers:
|
||||
harness.ok(True, "%s - %s - Should be a %s" % (prefix, name, type(m)))
|
||||
expectedMembers.remove((name, type(m)))
|
||||
else:
|
||||
|
@ -45,7 +47,7 @@ def WebIDLTest(parser, harness):
|
|||
p.parse(iface)
|
||||
p.finish()
|
||||
harness.ok(False, prefix + " - Interface passed when should've failed")
|
||||
except WebIDL.WebIDLError as e:
|
||||
except WebIDL.WebIDLError:
|
||||
harness.ok(True, prefix + " - Interface failed as expected")
|
||||
except Exception as e:
|
||||
harness.ok(
|
||||
|
@ -66,12 +68,6 @@ def WebIDLTest(parser, harness):
|
|||
setRWMembers = [
|
||||
(x, WebIDL.IDLMethod) for x in ["add", "clear", "delete"]
|
||||
] + setROMembers
|
||||
setROChromeMembers = [
|
||||
(x, WebIDL.IDLMethod) for x in ["__add", "__clear", "__delete"]
|
||||
] + setROMembers
|
||||
setRWChromeMembers = [
|
||||
(x, WebIDL.IDLMethod) for x in ["__add", "__clear", "__delete"]
|
||||
] + setRWMembers
|
||||
mapROMembers = (
|
||||
[(x, WebIDL.IDLMethod) for x in ["get", "has"]]
|
||||
+ [("__maplike", WebIDL.IDLMaplikeOrSetlike)]
|
||||
|
@ -81,9 +77,6 @@ def WebIDLTest(parser, harness):
|
|||
mapRWMembers = [
|
||||
(x, WebIDL.IDLMethod) for x in ["set", "clear", "delete"]
|
||||
] + mapROMembers
|
||||
mapRWChromeMembers = [
|
||||
(x, WebIDL.IDLMethod) for x in ["__set", "__clear", "__delete"]
|
||||
] + mapRWMembers
|
||||
|
||||
# OK, now that we've used iterableMembers to set up the above, append
|
||||
# __iterable to it for the iterable<> case.
|
||||
|
@ -101,12 +94,23 @@ def WebIDLTest(parser, harness):
|
|||
valueAsyncIterableMembers = [("__iterable", WebIDL.IDLAsyncIterable)]
|
||||
valueAsyncIterableMembers.append(("values", WebIDL.IDLMethod))
|
||||
|
||||
disallowedIterableNames = ["keys", "entries", "values"]
|
||||
disallowedMemberNames = ["forEach", "has", "size"] + disallowedIterableNames
|
||||
mapDisallowedMemberNames = ["get"] + disallowedMemberNames
|
||||
disallowedNonMethodNames = ["clear", "delete"]
|
||||
mapDisallowedNonMethodNames = ["set"] + disallowedNonMethodNames
|
||||
setDisallowedNonMethodNames = ["add"] + disallowedNonMethodNames
|
||||
disallowedIterableNames = [
|
||||
("keys", WebIDL.IDLMethod),
|
||||
("entries", WebIDL.IDLMethod),
|
||||
("values", WebIDL.IDLMethod),
|
||||
]
|
||||
disallowedMemberNames = [
|
||||
("forEach", WebIDL.IDLMethod),
|
||||
("has", WebIDL.IDLMethod),
|
||||
("size", WebIDL.IDLAttribute),
|
||||
] + disallowedIterableNames
|
||||
mapDisallowedMemberNames = [("get", WebIDL.IDLMethod)] + disallowedMemberNames
|
||||
disallowedNonMethodNames = [
|
||||
("clear", WebIDL.IDLMethod),
|
||||
("delete", WebIDL.IDLMethod),
|
||||
]
|
||||
mapDisallowedNonMethodNames = [("set", WebIDL.IDLMethod)] + disallowedNonMethodNames
|
||||
setDisallowedNonMethodNames = [("add", WebIDL.IDLMethod)] + disallowedNonMethodNames
|
||||
unrelatedMembers = [
|
||||
("unrelatedAttribute", WebIDL.IDLAttribute),
|
||||
("unrelatedMethod", WebIDL.IDLMethod),
|
||||
|
@ -570,7 +574,9 @@ def WebIDLTest(parser, harness):
|
|||
# Member name collision tests
|
||||
#
|
||||
|
||||
def testConflictingMembers(likeMember, conflictName, expectedMembers, methodPasses):
|
||||
def testConflictingMembers(
|
||||
likeMember, conflict, expectedMembers, methodPasses, numProductions=1
|
||||
):
|
||||
"""
|
||||
Tests for maplike/setlike member generation against conflicting member
|
||||
names. If methodPasses is True, this means we expect the interface to
|
||||
|
@ -578,6 +584,7 @@ def WebIDLTest(parser, harness):
|
|||
list of interface members to check against on the passing interface.
|
||||
|
||||
"""
|
||||
(conflictName, conflictType) = conflict
|
||||
if methodPasses:
|
||||
shouldPass(
|
||||
"Conflicting method: %s and %s" % (likeMember, conflictName),
|
||||
|
@ -616,16 +623,30 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
% (conflictName, likeMember),
|
||||
)
|
||||
shouldFail(
|
||||
"Conflicting static method: %s and %s" % (likeMember, conflictName),
|
||||
"""
|
||||
interface Foo1 {
|
||||
%s;
|
||||
static undefined %s(long test1, double test2, double test3);
|
||||
};
|
||||
"""
|
||||
% (likeMember, conflictName),
|
||||
)
|
||||
if conflictType == WebIDL.IDLAttribute:
|
||||
shouldFail(
|
||||
"Conflicting static method: %s and %s" % (likeMember, conflictName),
|
||||
"""
|
||||
interface Foo1 {
|
||||
%s;
|
||||
static undefined %s(long test1, double test2, double test3);
|
||||
};
|
||||
"""
|
||||
% (likeMember, conflictName),
|
||||
)
|
||||
else:
|
||||
shouldPass(
|
||||
"Conflicting static method: %s and %s" % (likeMember, conflictName),
|
||||
"""
|
||||
interface Foo1 {
|
||||
%s;
|
||||
static undefined %s(long test1, double test2, double test3);
|
||||
};
|
||||
"""
|
||||
% (likeMember, conflictName),
|
||||
expectedMembers,
|
||||
numProductions=numProductions,
|
||||
)
|
||||
shouldFail(
|
||||
"Conflicting attribute: %s and %s" % (likeMember, conflictName),
|
||||
"""
|
||||
|
@ -658,7 +679,9 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
for member in disallowedIterableNames:
|
||||
testConflictingMembers("iterable<long, long>", member, iterableMembers, False)
|
||||
testConflictingMembers(
|
||||
"iterable<long, long>", member, iterableMembers, False, numProductions=2
|
||||
)
|
||||
for member in mapDisallowedMemberNames:
|
||||
testConflictingMembers("maplike<long, long>", member, mapRWMembers, False)
|
||||
for member in disallowedMemberNames:
|
||||
|
|
48
third_party/WebIDL/tests/test_interfacemixin.py
vendored
48
third_party/WebIDL/tests/test_interfacemixin.py
vendored
|
@ -155,7 +155,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw, "Should not allow two non-partial interface mixins with the same name"
|
||||
|
@ -175,7 +175,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Must have a non-partial interface mixin for a given name")
|
||||
|
||||
|
@ -193,7 +193,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw,
|
||||
|
@ -215,7 +215,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw,
|
||||
|
@ -234,7 +234,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw,
|
||||
|
@ -254,7 +254,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw, "Should not allow unknown extended attributes on interface mixins"
|
||||
|
@ -271,7 +271,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow getters on interface mixins")
|
||||
|
||||
|
@ -286,7 +286,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow setters on interface mixins")
|
||||
|
||||
|
@ -301,7 +301,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow deleters on interface mixins")
|
||||
|
||||
|
@ -316,7 +316,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow legacycallers on interface mixins")
|
||||
|
||||
|
@ -331,7 +331,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow inherited attribute on interface mixins")
|
||||
|
||||
|
@ -348,7 +348,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should fail if the right side does not point an interface mixin")
|
||||
|
||||
|
@ -365,7 +365,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should fail if the left side does not point an interface")
|
||||
|
||||
|
@ -380,7 +380,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should fail if an interface mixin includes iterable")
|
||||
|
||||
|
@ -395,7 +395,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should fail if an interface mixin includes setlike")
|
||||
|
||||
|
@ -410,7 +410,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should fail if an interface mixin includes maplike")
|
||||
|
||||
|
@ -429,7 +429,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw, "Should fail if the included mixin interface has duplicated member"
|
||||
|
@ -452,7 +452,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw, "Should fail if the included mixin interfaces have duplicated member"
|
||||
|
@ -461,8 +461,8 @@ def WebIDLTest(parser, harness):
|
|||
parser = parser.reset()
|
||||
parser.parse(
|
||||
"""
|
||||
[Global, Exposed=Window] interface Window {};
|
||||
[Global, Exposed=Worker] interface Worker {};
|
||||
[Global=Window, Exposed=Window] interface Window {};
|
||||
[Global=Worker, Exposed=Worker] interface Worker {};
|
||||
[Exposed=Window]
|
||||
interface Base {};
|
||||
interface mixin Mixin {
|
||||
|
@ -483,8 +483,8 @@ def WebIDLTest(parser, harness):
|
|||
parser = parser.reset()
|
||||
parser.parse(
|
||||
"""
|
||||
[Global, Exposed=Window] interface Window {};
|
||||
[Global, Exposed=Worker] interface Worker {};
|
||||
[Global=Window, Exposed=Window] interface Window {};
|
||||
[Global=Worker, Exposed=Worker] interface Worker {};
|
||||
[Exposed=Window]
|
||||
interface Base {};
|
||||
[Exposed=Window]
|
||||
|
@ -504,8 +504,8 @@ def WebIDLTest(parser, harness):
|
|||
parser = parser.reset()
|
||||
parser.parse(
|
||||
"""
|
||||
[Global, Exposed=Window] interface Window {};
|
||||
[Global, Exposed=Worker] interface Worker {};
|
||||
[Global=Window, Exposed=Window] interface Window {};
|
||||
[Global=Worker, Exposed=Worker] interface Worker {};
|
||||
[Exposed=Window]
|
||||
interface Base1 {};
|
||||
[Exposed=Worker]
|
||||
|
|
11
third_party/WebIDL/tests/test_legacyTreatNonObjectAsNull.py
vendored
Normal file
11
third_party/WebIDL/tests/test_legacyTreatNonObjectAsNull.py
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
def WebIDLTest(parser, harness):
|
||||
parser.parse(
|
||||
"""
|
||||
[LegacyTreatNonObjectAsNull] callback Function = any(any... arguments);
|
||||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
|
||||
callback = results[0]
|
||||
harness.check(callback._treatNonObjectAsNull, True, "Got the expected value")
|
|
@ -2,6 +2,8 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import WebIDL
|
||||
|
||||
|
||||
def should_throw(parser, harness, message, code):
|
||||
parser = parser.reset()
|
||||
|
@ -9,7 +11,7 @@ def should_throw(parser, harness, message, code):
|
|||
try:
|
||||
parser.parse(code)
|
||||
parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown: %s" % message)
|
||||
|
|
20
third_party/WebIDL/tests/test_method.py
vendored
20
third_party/WebIDL/tests/test_method.py
vendored
|
@ -90,7 +90,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
sigpairs = zip(method.signatures(), signatures)
|
||||
for (gotSignature, expectedSignature) in sigpairs:
|
||||
for gotSignature, expectedSignature in sigpairs:
|
||||
(gotRetType, gotArgs) = gotSignature
|
||||
(expectedRetType, expectedArgs) = expectedSignature
|
||||
|
||||
|
@ -267,7 +267,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(not threw, "Should allow integer to float type corecion")
|
||||
|
||||
|
@ -282,7 +282,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow [GetterThrows] on methods")
|
||||
|
||||
|
@ -297,7 +297,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow [SetterThrows] on methods")
|
||||
|
||||
|
@ -312,7 +312,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should spell [Throws] correctly on methods")
|
||||
|
||||
|
@ -327,7 +327,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow __noSuchMethod__ methods")
|
||||
|
||||
|
@ -345,7 +345,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(not threw, "Should allow LenientFloat to be only in a specific overload")
|
||||
|
||||
|
@ -383,7 +383,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw,
|
||||
|
@ -404,7 +404,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw,
|
||||
|
@ -425,6 +425,6 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should prevent overloads from getting redundant [LenientFloat]")
|
||||
|
|
21
third_party/WebIDL/tests/test_namespace.py
vendored
21
third_party/WebIDL/tests/test_namespace.py
vendored
|
@ -1,3 +1,6 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
parser.parse(
|
||||
"""
|
||||
|
@ -71,7 +74,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
|
@ -87,7 +90,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
|
@ -107,7 +110,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
|
@ -127,7 +130,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
|
@ -147,7 +150,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
|
@ -167,7 +170,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
|
@ -187,7 +190,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
|
@ -207,7 +210,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
|
@ -227,6 +230,6 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
|
18
third_party/WebIDL/tests/test_newobject.py
vendored
18
third_party/WebIDL/tests/test_newobject.py
vendored
|
@ -1,7 +1,7 @@
|
|||
# Import the WebIDL module, so we can do isinstance checks and whatnot
|
||||
import WebIDL
|
||||
|
||||
|
||||
# Import the WebIDL module, so we can do isinstance checks and whatnot
|
||||
def WebIDLTest(parser, harness):
|
||||
# Basic functionality
|
||||
parser.parse(
|
||||
|
@ -25,8 +25,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "[NewObject] attributes must depend on something")
|
||||
|
||||
|
@ -40,8 +40,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "[NewObject] methods must depend on something")
|
||||
|
||||
|
@ -55,8 +55,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "[NewObject] attributes must not be [Cached]")
|
||||
|
||||
|
@ -70,7 +70,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "[NewObject] attributes must not be [StoreInSlot]")
|
||||
|
|
|
@ -105,13 +105,17 @@ def checkEquivalent(iface, harness):
|
|||
if callable(a1):
|
||||
try:
|
||||
v1 = a1()
|
||||
except:
|
||||
# Can't call a1 with no args, so skip this attriute.
|
||||
except AssertionError:
|
||||
# Various methods assert that they're called on objects of
|
||||
# the right type, skip them if the assert fails.
|
||||
continue
|
||||
except TypeError:
|
||||
# a1 requires positional arguments, so skip this attribute.
|
||||
continue
|
||||
|
||||
try:
|
||||
a2 = getattr(type2, attr)
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
harness.ok(
|
||||
False,
|
||||
"Missing %s attribute on type %s in %s" % (attr, type2, iface),
|
||||
|
@ -131,7 +135,7 @@ def checkEquivalent(iface, harness):
|
|||
else:
|
||||
try:
|
||||
a2 = getattr(type2, attr)
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
harness.ok(
|
||||
False,
|
||||
"Missing %s attribute on type %s in %s" % (attr, type2, iface),
|
||||
|
|
19
third_party/WebIDL/tests/test_nullable_void.py
vendored
Normal file
19
third_party/WebIDL/tests/test_nullable_void.py
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
interface NullableVoid {
|
||||
void? foo();
|
||||
};
|
||||
"""
|
||||
)
|
||||
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
|
||||
# Test dictionary as inner type
|
||||
harness.should_throw(
|
||||
parser,
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
|
@ -9,8 +12,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
|
45
third_party/WebIDL/tests/test_promise.py
vendored
45
third_party/WebIDL/tests/test_promise.py
vendored
|
@ -1,3 +1,6 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
|
@ -8,9 +11,9 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow Promise return values for legacycaller.")
|
||||
|
||||
|
@ -25,8 +28,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw,
|
||||
|
@ -45,8 +48,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw,
|
||||
|
@ -64,8 +67,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow nullable Promise return values.")
|
||||
|
||||
|
@ -79,8 +82,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow nullable Promise arguments.")
|
||||
|
||||
|
@ -93,7 +96,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
|
||||
harness.ok(
|
||||
True, "Should allow overloads which only have Promise and return " "types."
|
||||
|
@ -109,8 +112,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow writable Promise-typed attributes.")
|
||||
|
||||
|
@ -124,8 +127,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw, "Should not allow [LegacyLenientSetter] Promise-typed attributes."
|
||||
|
@ -141,8 +144,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow [PutForwards] Promise-typed attributes.")
|
||||
|
||||
|
@ -156,8 +159,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow [Replaceable] Promise-typed attributes.")
|
||||
|
||||
|
@ -171,7 +174,7 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow [SameObject] Promise-typed attributes.")
|
||||
|
|
15
third_party/WebIDL/tests/test_prototype_ident.py
vendored
15
third_party/WebIDL/tests/test_prototype_ident.py
vendored
|
@ -1,3 +1,6 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
|
@ -8,8 +11,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "The identifier of a static attribute must not be 'prototype'")
|
||||
|
@ -24,8 +27,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "The identifier of a static operation must not be 'prototype'")
|
||||
|
@ -40,8 +43,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "The identifier of a constant must not be 'prototype'")
|
||||
|
|
27
third_party/WebIDL/tests/test_putForwards.py
vendored
27
third_party/WebIDL/tests/test_putForwards.py
vendored
|
@ -1,3 +1,6 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
|
@ -9,8 +12,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -28,8 +31,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -48,8 +51,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -68,8 +71,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -88,8 +91,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -112,8 +115,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
|
4
third_party/WebIDL/tests/test_record.py
vendored
4
third_party/WebIDL/tests/test_record.py
vendored
|
@ -38,7 +38,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw, "Should have thrown because record can't have undefined as value type."
|
||||
|
@ -56,6 +56,6 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should have thrown on dictionary containing itself via record.")
|
||||
|
|
4
third_party/WebIDL/tests/test_replaceable.py
vendored
4
third_party/WebIDL/tests/test_replaceable.py
vendored
|
@ -2,6 +2,8 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import WebIDL
|
||||
|
||||
|
||||
def should_throw(parser, harness, message, code):
|
||||
parser = parser.reset()
|
||||
|
@ -9,7 +11,7 @@ def should_throw(parser, harness, message, code):
|
|||
try:
|
||||
parser.parse(code)
|
||||
parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown: %s" % message)
|
||||
|
|
|
@ -41,11 +41,17 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
harness.ok(
|
||||
results[0].members[3].getExtendedAttribute("SecureContext"),
|
||||
"[SecureContext] should propagate from interface to constant members from partial interface",
|
||||
(
|
||||
"[SecureContext] should propagate from interface to "
|
||||
"constant members from partial interface"
|
||||
),
|
||||
)
|
||||
harness.ok(
|
||||
results[0].members[4].getExtendedAttribute("SecureContext"),
|
||||
"[SecureContext] should propagate from interface to attribute members from partial interface",
|
||||
(
|
||||
"[SecureContext] should propagate from interface to "
|
||||
"attribute members from partial interface"
|
||||
),
|
||||
)
|
||||
harness.ok(
|
||||
results[0].members[5].getExtendedAttribute("SecureContext"),
|
||||
|
@ -93,15 +99,24 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
harness.ok(
|
||||
results[1].members[3].getExtendedAttribute("SecureContext"),
|
||||
"[SecureContext] should propagate from interface to constant members from partial interface",
|
||||
(
|
||||
"[SecureContext] should propagate from interface to constant members from "
|
||||
"partial interface"
|
||||
),
|
||||
)
|
||||
harness.ok(
|
||||
results[1].members[4].getExtendedAttribute("SecureContext"),
|
||||
"[SecureContext] should propagate from interface to attribute members from partial interface",
|
||||
(
|
||||
"[SecureContext] should propagate from interface to attribute members from "
|
||||
"partial interface"
|
||||
),
|
||||
)
|
||||
harness.ok(
|
||||
results[1].members[5].getExtendedAttribute("SecureContext"),
|
||||
"[SecureContext] should propagate from interface to method members from partial interface",
|
||||
(
|
||||
"[SecureContext] should propagate from interface to method members from partial "
|
||||
"interface"
|
||||
),
|
||||
)
|
||||
|
||||
parser = parser.reset()
|
||||
|
@ -132,15 +147,24 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
harness.ok(
|
||||
results[0].members[0].getExtendedAttribute("SecureContext") is None,
|
||||
"[SecureContext] should not propagate from a partial interface to the interface's constant members",
|
||||
(
|
||||
"[SecureContext] should not propagate from a partial interface to the interface's "
|
||||
"constant members"
|
||||
),
|
||||
)
|
||||
harness.ok(
|
||||
results[0].members[1].getExtendedAttribute("SecureContext") is None,
|
||||
"[SecureContext] should not propagate from a partial interface to the interface's attribute members",
|
||||
(
|
||||
"[SecureContext] should not propagate from a partial interface to the interface's "
|
||||
"attribute members"
|
||||
),
|
||||
)
|
||||
harness.ok(
|
||||
results[0].members[2].getExtendedAttribute("SecureContext") is None,
|
||||
"[SecureContext] should not propagate from a partial interface to the interface's method members",
|
||||
(
|
||||
"[SecureContext] should not propagate from a partial interface to the interface's "
|
||||
"method members"
|
||||
),
|
||||
)
|
||||
harness.ok(
|
||||
results[0].members[3].getExtendedAttribute("SecureContext"),
|
||||
|
@ -297,7 +321,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "[SecureContext] must take no arguments (testing on interface)")
|
||||
|
||||
|
@ -316,11 +340,14 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw,
|
||||
"If [SecureContext] appears on an overloaded operation, then it MUST appear on all overloads",
|
||||
(
|
||||
"If [SecureContext] appears on an overloaded operation, then it MUST appear on all "
|
||||
"overloads"
|
||||
),
|
||||
)
|
||||
|
||||
parser = parser.reset()
|
||||
|
@ -339,7 +366,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
not threw,
|
||||
|
@ -359,7 +386,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw, "[SecureContext] must not appear on an interface and interface member"
|
||||
|
@ -380,11 +407,14 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw,
|
||||
"[SecureContext] must not appear on a partial interface and one of the partial interface's member's",
|
||||
(
|
||||
"[SecureContext] must not appear on a partial interface and one of the partial "
|
||||
"interface's member's"
|
||||
),
|
||||
)
|
||||
|
||||
parser = parser.reset()
|
||||
|
@ -402,11 +432,14 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw,
|
||||
"[SecureContext] must not appear on an interface and one of its partial interface's member's",
|
||||
(
|
||||
"[SecureContext] must not appear on an interface and one of its partial interface's "
|
||||
"member's"
|
||||
),
|
||||
)
|
||||
|
||||
parser = parser.reset()
|
||||
|
@ -423,11 +456,14 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw,
|
||||
"[SecureContext] must appear on interfaces that inherit from another [SecureContext] interface",
|
||||
(
|
||||
"[SecureContext] must appear on interfaces that inherit from another [SecureContext] "
|
||||
"interface"
|
||||
),
|
||||
)
|
||||
|
||||
# Test 'includes'.
|
||||
|
@ -450,7 +486,10 @@ def WebIDLTest(parser, harness):
|
|||
harness.check(
|
||||
len(results[0].members),
|
||||
4,
|
||||
"TestSecureContextInterfaceThatImplementsNonSecureContextInterface should have four members",
|
||||
(
|
||||
"TestSecureContextInterfaceThatImplementsNonSecureContextInterface should have four "
|
||||
"members"
|
||||
),
|
||||
)
|
||||
harness.ok(
|
||||
results[0].getExtendedAttribute("SecureContext"),
|
||||
|
@ -458,7 +497,10 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
harness.ok(
|
||||
results[0].members[0].getExtendedAttribute("SecureContext"),
|
||||
"[SecureContext] should propagate from interface to constant members even when other members are copied from a non-[SecureContext] interface",
|
||||
(
|
||||
"[SecureContext] should propagate from interface to constant members even when other "
|
||||
"members are copied from a non-[SecureContext] interface"
|
||||
),
|
||||
)
|
||||
harness.ok(
|
||||
results[0].members[1].getExtendedAttribute("SecureContext") is None,
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
|
@ -9,8 +12,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -25,8 +28,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -41,8 +44,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -57,8 +60,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -73,8 +76,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -89,8 +92,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -105,8 +108,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -121,8 +124,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -137,8 +140,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -153,8 +156,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -169,8 +172,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -185,8 +188,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -201,8 +204,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -217,8 +220,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -233,8 +236,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -249,8 +252,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
|
|
@ -111,7 +111,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "There are no indexed deleters")
|
||||
|
|
|
@ -13,8 +13,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -30,8 +30,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -47,8 +47,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
|
10
third_party/WebIDL/tests/test_stringifier.py
vendored
10
third_party/WebIDL/tests/test_stringifier.py
vendored
|
@ -30,7 +30,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should not allow two 'stringifier;'")
|
||||
|
@ -48,7 +48,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should not allow a 'stringifier;' and a 'stringifier()'")
|
||||
|
@ -156,7 +156,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should not allow ByteString")
|
||||
|
@ -173,7 +173,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should not allow a 'stringifier;' and a stringifier attribute")
|
||||
|
@ -190,7 +190,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should not allow multiple stringifier attributes")
|
||||
|
|
27
third_party/WebIDL/tests/test_toJSON.py
vendored
27
third_party/WebIDL/tests/test_toJSON.py
vendored
|
@ -1,3 +1,6 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
|
@ -8,8 +11,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(not threw, "Should allow a toJSON method.")
|
||||
|
||||
|
@ -24,8 +27,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow overloads of a toJSON method.")
|
||||
|
||||
|
@ -39,8 +42,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should not allow a toJSON method with arguments.")
|
||||
|
||||
|
@ -54,8 +57,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(not threw, "Should allow a toJSON method with 'long' as return type.")
|
||||
|
||||
|
@ -69,8 +72,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
not threw, "Should allow a default toJSON method with 'object' as return type."
|
||||
|
@ -86,8 +89,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw,
|
||||
|
|
|
@ -36,7 +36,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -57,7 +57,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
@ -74,7 +74,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
|
9
third_party/WebIDL/tests/test_typedef.py
vendored
9
third_party/WebIDL/tests/test_typedef.py
vendored
|
@ -1,3 +1,6 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
parser.parse(
|
||||
"""
|
||||
|
@ -32,7 +35,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown on nullable inside nullable arg.")
|
||||
|
@ -49,7 +52,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown on nullable inside nullable const.")
|
||||
|
@ -66,7 +69,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
|
|
@ -8,7 +8,7 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
except Exception as e:
|
||||
exception = e
|
||||
|
||||
|
|
48
third_party/WebIDL/tests/test_undefined.py
vendored
48
third_party/WebIDL/tests/test_undefined.py
vendored
|
@ -11,8 +11,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "undefined must not be used as the type of a dictionary member")
|
||||
|
@ -28,8 +28,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -49,8 +49,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -70,8 +70,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -91,8 +91,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -112,8 +112,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -133,8 +133,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -152,8 +152,8 @@ def WebIDLTest(parser, harness):
|
|||
callback Callback = undefined (undefined foo);
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -173,8 +173,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -195,8 +195,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -216,8 +216,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -236,8 +236,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
def WebIDLTest(parser, harness):
|
||||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
parser.parse(
|
||||
"""
|
||||
interface Foo {};
|
||||
|
@ -27,7 +29,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
|
@ -44,7 +46,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
|
@ -66,6 +68,6 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
|
19
third_party/WebIDL/tests/test_unforgeable.py
vendored
19
third_party/WebIDL/tests/test_unforgeable.py
vendored
|
@ -1,3 +1,6 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
parser.parse(
|
||||
"""
|
||||
|
@ -95,7 +98,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw,
|
||||
|
@ -118,7 +121,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw,
|
||||
|
@ -141,7 +144,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw,
|
||||
|
@ -164,7 +167,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except Exception as x:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw,
|
||||
|
@ -210,7 +213,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -240,7 +243,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -270,7 +273,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -305,7 +308,7 @@ def WebIDLTest(parser, harness):
|
|||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown for static [LegacyUnforgeable] attribute.")
|
||||
|
|
10
third_party/WebIDL/tests/test_union.py
vendored
10
third_party/WebIDL/tests/test_union.py
vendored
|
@ -1,7 +1,7 @@
|
|||
import WebIDL
|
||||
import itertools
|
||||
import string
|
||||
|
||||
import WebIDL
|
||||
|
||||
# We'd like to use itertools.chain but it's 2.6 or higher.
|
||||
|
||||
|
||||
|
@ -91,7 +91,7 @@ def WebIDLTest(parser, harness):
|
|||
interface PrepareForTest {
|
||||
"""
|
||||
)
|
||||
for (i, type) in enumerate(types):
|
||||
for i, type in enumerate(types):
|
||||
interface += string.Template(
|
||||
"""
|
||||
readonly attribute ${type} attr${i};
|
||||
|
@ -157,7 +157,7 @@ def WebIDLTest(parser, harness):
|
|||
interface TestUnion {
|
||||
"""
|
||||
)
|
||||
for (i, type) in enumerate(validUnionTypes):
|
||||
for i, type in enumerate(validUnionTypes):
|
||||
interface += string.Template(
|
||||
"""
|
||||
undefined method${i}(${type} arg);
|
||||
|
@ -190,7 +190,7 @@ def WebIDLTest(parser, harness):
|
|||
try:
|
||||
parser.parse(interface)
|
||||
results = parser.finish()
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
|
7
third_party/WebIDL/tests/test_union_any.py
vendored
7
third_party/WebIDL/tests/test_union_any.py
vendored
|
@ -1,3 +1,6 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
|
@ -9,8 +12,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
|
132
third_party/WebIDL/tests/test_union_callback_dict.py
vendored
Normal file
132
third_party/WebIDL/tests/test_union_callback_dict.py
vendored
Normal file
|
@ -0,0 +1,132 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
dictionary TestDict {
|
||||
DOMString member;
|
||||
};
|
||||
[LegacyTreatNonObjectAsNull] callback TestCallback = undefined ();
|
||||
typedef (TestCallback or TestDict) TestUnionCallbackDict;
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw,
|
||||
"Should not allow Dict/Callback union where callback is [LegacyTreatNonObjectAsNull]",
|
||||
)
|
||||
|
||||
parser = parser.reset()
|
||||
|
||||
threw = False
|
||||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
dictionary TestDict {
|
||||
DOMString member;
|
||||
};
|
||||
[LegacyTreatNonObjectAsNull] callback TestCallback = undefined ();
|
||||
typedef (TestDict or TestCallback) TestUnionCallbackDict;
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
harness.ok(
|
||||
threw,
|
||||
"Should not allow Dict/Callback union where callback is [LegacyTreatNonObjectAsNull]",
|
||||
)
|
||||
|
||||
parser = parser.reset()
|
||||
|
||||
parser.parse(
|
||||
"""
|
||||
dictionary TestDict {
|
||||
DOMString member;
|
||||
};
|
||||
callback TestCallback = undefined ();
|
||||
typedef (TestCallback or TestDict) TestUnionCallbackDict;
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
|
||||
harness.ok(True, "TestUnionCallbackDict interface parsed without error")
|
||||
harness.check(len(results), 3, "Document should have 3 types")
|
||||
|
||||
myDict = results[0]
|
||||
harness.ok(isinstance(myDict, WebIDL.IDLDictionary), "Expect an IDLDictionary")
|
||||
|
||||
myCallback = results[1]
|
||||
harness.ok(isinstance(myCallback, WebIDL.IDLCallback), "Expect an IDLCallback")
|
||||
|
||||
myUnion = results[2]
|
||||
harness.ok(isinstance(myUnion, WebIDL.IDLTypedef), "Expect a IDLTypedef")
|
||||
harness.ok(
|
||||
isinstance(myUnion.innerType, WebIDL.IDLUnionType), "Expect a IDLUnionType"
|
||||
)
|
||||
harness.ok(
|
||||
isinstance(myUnion.innerType.memberTypes[0], WebIDL.IDLCallbackType),
|
||||
"Expect a IDLCallbackType",
|
||||
)
|
||||
harness.ok(
|
||||
isinstance(myUnion.innerType.memberTypes[1], WebIDL.IDLWrapperType),
|
||||
"Expect a IDLDictionary",
|
||||
)
|
||||
harness.ok(
|
||||
(myUnion.innerType.memberTypes[0].callback == myCallback),
|
||||
"Expect left Union member to be MyCallback",
|
||||
)
|
||||
harness.ok(
|
||||
(myUnion.innerType.memberTypes[1].inner == myDict),
|
||||
"Expect right Union member to be MyDict",
|
||||
)
|
||||
|
||||
parser = parser.reset()
|
||||
|
||||
parser.parse(
|
||||
"""
|
||||
dictionary TestDict {
|
||||
DOMString member;
|
||||
};
|
||||
callback TestCallback = undefined ();
|
||||
typedef (TestDict or TestCallback) TestUnionCallbackDict;
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
|
||||
harness.ok(True, "TestUnionCallbackDict interface parsed without error")
|
||||
harness.check(len(results), 3, "Document should have 3 types")
|
||||
|
||||
myDict = results[0]
|
||||
harness.ok(isinstance(myDict, WebIDL.IDLDictionary), "Expect an IDLDictionary")
|
||||
|
||||
myCallback = results[1]
|
||||
harness.ok(isinstance(myCallback, WebIDL.IDLCallback), "Expect an IDLCallback")
|
||||
|
||||
myUnion = results[2]
|
||||
harness.ok(isinstance(myUnion, WebIDL.IDLTypedef), "Expect a IDLTypedef")
|
||||
harness.ok(
|
||||
isinstance(myUnion.innerType, WebIDL.IDLUnionType), "Expect a IDLUnionType"
|
||||
)
|
||||
harness.ok(
|
||||
isinstance(myUnion.innerType.memberTypes[0], WebIDL.IDLWrapperType),
|
||||
"Expect a IDLDictionary",
|
||||
)
|
||||
harness.ok(
|
||||
isinstance(myUnion.innerType.memberTypes[1], WebIDL.IDLCallbackType),
|
||||
"Expect a IDLCallbackType",
|
||||
)
|
||||
harness.ok(
|
||||
(myUnion.innerType.memberTypes[0].inner == myDict),
|
||||
"Expect right Union member to be MyDict",
|
||||
)
|
||||
harness.ok(
|
||||
(myUnion.innerType.memberTypes[1].callback == myCallback),
|
||||
"Expect left Union member to be MyCallback",
|
||||
)
|
15
third_party/WebIDL/tests/test_union_nullable.py
vendored
15
third_party/WebIDL/tests/test_union_nullable.py
vendored
|
@ -1,3 +1,6 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
|
@ -9,8 +12,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Two nullable member types of a union should have thrown.")
|
||||
|
@ -27,8 +30,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -50,8 +53,8 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
parser.parse(
|
||||
"""
|
||||
|
@ -8,6 +5,6 @@ def WebIDLTest(parser, harness):
|
|||
"""
|
||||
)
|
||||
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
|
||||
harness.ok(True, "TestVariadicCallback callback parsed without error.")
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
import WebIDL
|
||||
|
||||
|
||||
def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
|
@ -8,9 +11,9 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -28,8 +31,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -47,9 +50,9 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
parser.finish()
|
||||
|
||||
except:
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(
|
||||
|
@ -67,8 +70,8 @@ def WebIDLTest(parser, harness):
|
|||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except:
|
||||
parser.finish()
|
||||
except WebIDL.WebIDLError:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown on variadic argument with default value.")
|
||||
|
|
1
third_party/WebIDL/update.sh
vendored
1
third_party/WebIDL/update.sh
vendored
|
@ -6,6 +6,7 @@ patch < union-typedef.patch
|
|||
patch < inline.patch
|
||||
patch < readable-stream.patch
|
||||
patch < like-as-iterable.patch
|
||||
patch < builtin-array.patch
|
||||
|
||||
wget https://hg.mozilla.org/mozilla-central/archive/tip.zip/dom/bindings/parser/tests/ -O tests.zip
|
||||
rm -r tests
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue