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

Unified Diff: LayoutTests/http/tests/xmlhttprequest/ontimeout-event-override-after-preflight-failure.html

Issue 273993002: Allow XHR timeout attribute to be overridden after send(), per spec (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add CORS preflight-failure test case Created 6 years, 6 months 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: LayoutTests/http/tests/xmlhttprequest/ontimeout-event-override-after-preflight-failure.html
diff --git a/LayoutTests/http/tests/xmlhttprequest/ontimeout-event-override-after-preflight-failure.html b/LayoutTests/http/tests/xmlhttprequest/ontimeout-event-override-after-preflight-failure.html
new file mode 100644
index 0000000000000000000000000000000000000000..30aae735af4f9f744753aac66e804d82a63b810a
--- /dev/null
+++ b/LayoutTests/http/tests/xmlhttprequest/ontimeout-event-override-after-preflight-failure.html
@@ -0,0 +1,53 @@
+<html>
+<body>
+<pre id='console'></pre>
+<script type="text/javascript">
+function log(message)
+{
+ document.getElementById('console').appendChild(document.createTextNode(message + "\n"));
+}
+
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+
+(function() {
+ var xhr = new XMLHttpRequest;
+ var error = false;
+ var errorCalled = false;
+
+ function testSuccess() {
+ if (!error)
+ log("PASS: Timeout not overridden after preflight failure");
+ }
+
+ function performAssertions() {
+ if (!errorCalled)
+ log("FAIL: preflight failure not reported");
+ else
+ testSuccess();
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
+
+ xhr.onerror = function() {
+ xhr.timeout = 1;
+ errorCalled = true;
+ };
+
+ xhr.ontimeout = function() {
+ error = true;
+ log("FAIL: Timeout overridden after error");
tyoshino (SeeGerritForStatus) 2014/07/08 11:36:00 what we want to check is setting timeout doesn't s
+ }
+
+ xhr.open("GET", "http://localhost:8000/xmlhttprequest/resources/access-control-basic-denied.cgi");
+ xhr.timeout = 100;
+ // This is going to fail because the cgi script is not prepared for an OPTIONS request.
+ xhr.send();
+
+ setTimeout(performAssertions, 200);
+})();
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698