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"); |