blob: 17a0bf922bae4b8aa19958484f1a7a00307f69ac [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="../../../resources/js-test.js"></script>
<script src="resources/clearSessionStorage.js"></script>
<input id="testInput" type="text"></input>
<script>
description("Tests updating sessionStorage in the keydown handler and makes sure the value is updated synchronously.");
function keydownHandler()
{
debug("Setting setItemSynchronousKeydownTestValue to 1 in keydown handler.");
sessionStorage.setItemSynchronousKeydownTestValue = 1;
}
testInput.focus();
testInput.onkeydown = keydownHandler;
sessionStorage.setItemSynchronousKeydownTestValue = 0;
shouldBeEqualToString("sessionStorage.setItemSynchronousKeydownTestValue", "0");
// keydownHandler() should be called synchronously.
if (window.eventSender)
eventSender.keyDown('a');
shouldBeEqualToString("sessionStorage.setItemSynchronousKeydownTestValue", "1");
</script>
<script>
sessionStorage.removeItem("setItemSynchronousKeydownTestValue");
</script>
</body>
</html>