Index: third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/onloadstart-send.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/onloadstart-send.html b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/onloadstart-send.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c9c203ad82d2263b11df2424b15981ebd8655e6c |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/onloadstart-send.html |
@@ -0,0 +1,27 @@ |
+<!doctype html> |
+<html> |
+<head> |
+<title>XMLHttpRequest: send() during onloadstart</title> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+</head> |
+<body> |
+<script> |
+var testAsync = async_test("Attempting a send() during onloadstart"); |
+testAsync.step(() => { |
+ var xhr = new XMLHttpRequest(); |
+ xhr.open("POST", "resources/delay.php?iteration=1&delay=1000"); |
+ xhr.onloadstart = testAsync.step_func(() => { |
+ assert_equals(xhr.readyState, XMLHttpRequest.OPENED); |
+ // Step 2 of send(): "If the send() flag is set, throw an InvalidStateError exception." |
+ assert_throws('InvalidStateError', () => { xhr.send(); }); |
+ }); |
+ xhr.onloadend = testAsync.step_func(() => { |
+ assert_equals(xhr.readyState, XMLHttpRequest.DONE); |
+ testAsync.done(); |
+ }); |
+ xhr.send(); |
+}); |
+</script> |
+</body> |
+</html> |