Index: third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/withCredentials-after-send.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/withCredentials-after-send.html b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/withCredentials-after-send.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..df731120bf326b485dc061a8d6e5511f9b117c55 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/withCredentials-after-send.html |
@@ -0,0 +1,40 @@ |
+<!doctype html> |
+<html> |
+<head> |
+<title>XMLHttpRequest: setting withCredentials while sending data</title> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+</head> |
+<body> |
+<script> |
+var testAsync = async_test("Setting withCredentials, post-send() (async)"); |
+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); |
+ assert_throws('InvalidStateError', () => { xhr.withCredentials = true; }); |
+ }); |
+ xhr.onloadend = testAsync.step_func(() => { |
+ assert_equals(xhr.readyState, XMLHttpRequest.DONE); |
+ testAsync.done(); |
+ }); |
+ xhr.send(); |
+}); |
+ |
+var testSync = async_test("Setting withCredentials, post-send() (sync)"); |
+testSync.step(() => { |
+ var xhr = new XMLHttpRequest(); |
+ xhr.open("POST", "resources/delay.php?iteration=1&delay=1000", false); |
+ xhr.onprogress = testSync.step_func(() => { |
+ assert_throws('InvalidStateError', () => { xhr.withCredentials = true }); |
+ }); |
+ xhr.onloadend = testSync.step_func(() => { |
+ assert_equals(xhr.readyState, XMLHttpRequest.DONE); |
+ testSync.done(); |
+ }); |
+ xhr.send(); |
+}); |
+</script> |
+</body> |
+</html> |