blob: 14e80f4af2c4075cae6fe0d407b7bb1298f0cdd2 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body id="body">
asdf
<div id="content" tabindex="0">test</div>
asdf
<p id="description"></p>
<div id="console"></div>
<script>
description("This protects against a crash when AXUIElementForTextMarker is queried with an empty text marker.");
if (window.accessibilityController) {
document.getElementById("content").focus();
var content = accessibilityController.focusedElement;
// get a marker that is invalid (the next one after the end of the body).
var textMarkerRange = content.textMarkerRangeForElement(content);
var endMarker = content.endTextMarkerForTextMarkerRange(textMarkerRange);
// Remove "content" so that the text marker becomes invalid.
document.getElementById("body").removeChild(document.getElementById("content"));
document.getElementById("body").focus();
var body = accessibilityController.focusedElement;
// Ask for the ui element for that marker (should not crash).
body.accessibilityElementForTextMarker(endMarker);
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>