blob: 698fa3ad8e3869d1b959673589d50e870e0b87bb [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<body>
<script src="../../../../resources/js-test.js"></script>
<script>
description("Test that we can send textarea data containing null characters.");
function runTest()
{
// We can't use testSendingFormData because PHP escapes
// null bytes on Windows.
var xhr = new XMLHttpRequest();
xhr.open('POST', 'http://127.0.0.1:8000/xmlhttprequest/resources/post-echo.cgi', false);
var formData = new FormData();
formData.append('textarea', 'hello\u0000world');
xhr.send(formData);
if (xhr.readyState !== 4 || xhr.status !== 200) {
testFailed('xhr.readyState = ' + xhr.readyState + ', xhr.status = ' + xhr.status);
return;
}
if (xhr.response.indexOf('name="textarea"\r\n\r\nhello\u0000world') >= 0) {
testPassed('the string containing a null byte is echoed correctly.');
} else {
testFailed('the string containing a null byte is not echoed correctly.');
}
}
if (window.eventSender) {
runTest();
} else {
testFailed("This test is not interactive, please run in a testing environment.");
}
</script>
</body>
</html>