Throw a TypeError when unwrapping an interface argument fails.

This commit is contained in:
Ms2ger 2014-08-04 15:27:56 +02:00
parent 7f707020be
commit 715ae6ab55
2 changed files with 17 additions and 4 deletions

View file

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

View file

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