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

Unified Diff: LayoutTests/http/tests/xmlhttprequest/resources/cross-origin-unsupported-url.js

Issue 1240503004: Revert of [XMLHttpRequest] Stop throwing for network error in async mode (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 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/resources/cross-origin-unsupported-url.js
diff --git a/LayoutTests/http/tests/xmlhttprequest/resources/cross-origin-unsupported-url.js b/LayoutTests/http/tests/xmlhttprequest/resources/cross-origin-unsupported-url.js
index 28b9b8e91b9cf7bd6352e057ee94304a3c8a0445..6f920bcf4ac954263f4c6f04721de2c56f3a0bef 100644
--- a/LayoutTests/http/tests/xmlhttprequest/resources/cross-origin-unsupported-url.js
+++ b/LayoutTests/http/tests/xmlhttprequest/resources/cross-origin-unsupported-url.js
@@ -20,7 +20,24 @@
if (contentType)
xhr.setRequestHeader('Content-Type', contentType);
- shouldNotThrow('xhr.send()');
+ if (self.importScripts) {
+ // Initiating the load on the main thread is not performed synchronously,
+ // so send() will not have an exception code set by the time it
+ // completes in the Worker case. Hence, no exception will be
+ // thrown by the operation.
+ shouldNotThrow('xhr.send()');
+ } else {
+ // The implementation of send() throws an exception if an
+ // exception code has been set, regardless of the sync flag.
+ // The spec restricts this to sync only, but as error progress
+ // events provide no actionable information, it is more helpful
+ // to the user to not follow spec.
+ //
+ // As the initiation of the request happens synchronously in send(),
+ // and it is determined that it is to an unsupported CORS URL, an
+ // exception is expected to be thrown.
+ shouldThrow('xhr.send()');
+ }
}
var withContentType = true;

Powered by Google App Engine
This is Rietveld 408576698