blob: 9a55cc10a90cb4c9bf3f9d7265ab9c654eb26d16 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test.js"></script>
<script src="../resources/accessibility-helper.js"></script>
</head>
<body>
<input type="text" value="hello" id="textfield">
<script>
description("This tests that when an auto fill element is removed we won't crash accessing an old value.");
if (window.accessibilityController) {
window.jsTestIsAsync = true;
var platformName = accessibilityController.platformName;
var axTextField = accessibilityController.accessibleElementById("textfield");
var domTextField = document.getElementById("textfield");
window.internals.setShowAutoFillButton(domTextField, "Contacts");
var expectedChildrenCount = platformName == "atk" ? "1" : "2";
setTimeout(async function() {
await expectAsyncExpression("axTextField.childrenCount", expectedChildrenCount);
// Verify the autofill button is represented in the accessibility tree.
await expectAsyncExpression("axTextField.childAtIndex(expectedChildrenCount - 1).description", "'AXDescription: contact info AutoFill'");
// Don't crash!
window.internals.setShowAutoFillButton(domTextField, "None");
await expectAsyncExpression("axTextField.childrenCount", platformName == "atk" ? "0" : "1");
finishJSTest();
}, 0);
}
</script>
</body>
</html>