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

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

Issue 2250203003: Sync XHR on Worker should not crash when response arrives immediately (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fetch-data-loader-for-bytes-consumer
Patch Set: Created 4 years, 4 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: third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/cross-origin-unsupported-url.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/cross-origin-unsupported-url.js b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/cross-origin-unsupported-url.js
index 28b9b8e91b9cf7bd6352e057ee94304a3c8a0445..ac1e26f14bbceda0a801ccc18a0b11d50cac2d31 100644
--- a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/cross-origin-unsupported-url.js
+++ b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/cross-origin-unsupported-url.js
@@ -10,7 +10,22 @@ var errorEvent;
function issueRequest(url, contentType)
{
xhr = new XMLHttpRequest();
- xhr.open('POST', url);
+ // async = false
+ xhr.open('POST', url, false);
+ xhr.onerror = () => testFailed("onerror callback should not be called.");
+ // Assumed a Content-Type that turns it into a non-simple CORS request.
+ if (contentType)
+ xhr.setRequestHeader('Content-Type', contentType);
+ try {
+ xhr.send();
+ } catch(e) {
+ errorEvent = e;
+ shouldBeEqualToString("errorEvent.name", "NetworkError");
+ }
+
+ xhr = new XMLHttpRequest();
+ // async = true
+ xhr.open('POST', url, true);
xhr.onerror = function (a) {
errorEvent = a;
shouldBeEqualToString("errorEvent.type", "error");

Powered by Google App Engine
This is Rietveld 408576698