Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/withCredentials-after-send.html

Issue 2496933002: XMLHttpRequest: implement "send() flag" tracking and updating per spec. (Closed)
Patch Set: add missing field initialization Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698