mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Throw a TypeError when unwrapping an interface argument fails.
This commit is contained in:
parent
7f707020be
commit
715ae6ab55
2 changed files with 17 additions and 4 deletions
|
@ -586,7 +586,15 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
|
||||||
"argument" % descriptor.interface.identifier.name)
|
"argument" % descriptor.interface.identifier.name)
|
||||||
|
|
||||||
if failureCode is None:
|
if failureCode is None:
|
||||||
unwrapFailureCode = "return 0; //XXXjdm return Throw(cx, rv);"
|
substitutions = {
|
||||||
|
"sourceDescription": sourceDescription,
|
||||||
|
"interface": descriptor.interface.identifier.name,
|
||||||
|
"exceptionCode": exceptionCode,
|
||||||
|
}
|
||||||
|
unwrapFailureCode = string.Template(
|
||||||
|
'throw_type_error(cx, "${sourceDescription} does not '
|
||||||
|
'implement interface ${interface}.");\n'
|
||||||
|
'${exceptionCode}').substitute(substitutions)
|
||||||
else:
|
else:
|
||||||
unwrapFailureCode = failureCode
|
unwrapFailureCode = failureCode
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
[Node-insertBefore.html]
|
[Node-insertBefore.html]
|
||||||
type: testharness
|
type: testharness
|
||||||
expected: TIMEOUT
|
[If the context node is a document, inserting a document or text node should throw a HierarchyRequestError.]
|
||||||
[Calling insertBefore with a non-Node first argument must throw TypeError.]
|
expected: FAIL
|
||||||
expected: TIMEOUT
|
|
||||||
|
[If the context node is a DocumentFragment, inserting a document or a doctype should throw a HierarchyRequestError.]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[If the context node is an element, inserting a document or a doctype should throw a HierarchyRequestError.]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue