chromium/third_party/blink/web_tests/svg/dom/undefined-null.html

<!DOCTYPE html>
<script src="../../resources/js-test.js"></script>
<svg>
    <circle></circle>
    <text></text>
</svg>
<script>
description(
    'Check that |undefined| and |null| arguments do not cause crashes, ' +
    'but do throw exceptions.');

var svg = document.querySelector('svg');
var circle = document.querySelector('circle');
var text = document.querySelector('text');

var matrix = svg.createSVGMatrix();
var point = svg.createSVGPoint();
var rect = svg.createSVGRect();


debug('SVGGeometryElement');
// SVGGeometryElement is an abstract class: instantiate object of derived class

debug('');
debug('isPointInFill(SVGPoint point)');
shouldNotThrow('circle.isPointInFill(point)');
shouldThrow('circle.isPointInFill(undefined)');
shouldThrow('circle.isPointInFill(null)');

debug('');
debug('isPointInStroke(SVGPoint point)');
shouldNotThrow('circle.isPointInStroke(point)');
shouldThrow('circle.isPointInStroke(undefined)');
shouldThrow('circle.isPointInStroke(null)');


debug('');
debug('');
debug('SVGSVGElement');

debug('');
debug('getIntersectionList(SVGRect rect, SVGElement? referenceElement)');
shouldNotThrow('svg.getIntersectionList(rect, svg)');
shouldThrow('svg.getIntersectionList(undefined, svg)');
shouldThrow('svg.getIntersectionList(null, svg)');
shouldNotThrow('svg.getIntersectionList(rect, undefined)');
shouldNotThrow('svg.getIntersectionList(rect, null)');

debug('');
debug('getEnclosureList(SVGRect rect, SVGElement? referenceElement)');
shouldNotThrow('svg.getEnclosureList(rect, svg)');
shouldThrow('svg.getEnclosureList(undefined, svg)');
shouldThrow('svg.getEnclosureList(null, svg)');
shouldNotThrow('svg.getEnclosureList(rect, undefined)');
shouldNotThrow('svg.getEnclosureList(rect, null)');

debug('');
debug('checkIntersection(SVGElement element, SVGRect rect)');
shouldNotThrow('svg.checkIntersection(svg, rect)');
shouldThrow('svg.checkIntersection(undefined, rect)');
shouldThrow('svg.checkIntersection(null, rect)');
shouldThrow('svg.checkIntersection(svg, undefined)');
shouldThrow('svg.checkIntersection(svg, null)');

debug('');
debug('checkEnclosure(SVGElement element, SVGRect rect)');
shouldNotThrow('svg.checkEnclosure(svg, rect)');
shouldThrow('svg.checkEnclosure(undefined, rect)');
shouldThrow('svg.checkEnclosure(null, rect)');
shouldThrow('svg.checkEnclosure(svg, undefined)');
shouldThrow('svg.checkEnclosure(svg, null)');

debug('');
debug('SVGTransform createSVGTransformFromMatrix(SVGMatrix matrix)');
shouldThrow('svg.createSVGTransformFromMatrix()');
shouldNotThrow('svg.createSVGTransformFromMatrix(matrix)');
shouldThrow('svg.createSVGTransformFromMatrix(undefined)');
shouldThrow('svg.createSVGTransformFromMatrix(null)');


debug('');
debug('');
debug('SVGTextContentElement');

debug('');
debug('getCharNumAtPosition(SVGPoint point)');
shouldNotThrow('text.getCharNumAtPosition(point)');
shouldThrow('text.getCharNumAtPosition(undefined)');
shouldThrow('text.getCharNumAtPosition(null)');

</script>