blob: 412743c7dd1e353e5fdae963c1f3a87f94a2fd01 [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 == "atspi" ? "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 == "atspi" ? "0" : "1");
finishJSTest();
}, 0);
}
</script>
</body>
</html>