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

Unified Diff: LayoutTests/http/tests/xmlhttprequest/cross-origin-preflight-get-response-type-blob.html

Issue 23444058: Use downloadToFile option when XHR downloads a Blob (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 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/cross-origin-preflight-get-response-type-blob.html
diff --git a/LayoutTests/http/tests/xmlhttprequest/cross-origin-preflight-get.html b/LayoutTests/http/tests/xmlhttprequest/cross-origin-preflight-get-response-type-blob.html
similarity index 62%
copy from LayoutTests/http/tests/xmlhttprequest/cross-origin-preflight-get.html
copy to LayoutTests/http/tests/xmlhttprequest/cross-origin-preflight-get-response-type-blob.html
index 7a026c3c2bef6dfe047f5a78c5a725c67594386e..6d35b5cda226a85ace904274cc06addb0dfce951 100644
--- a/LayoutTests/http/tests/xmlhttprequest/cross-origin-preflight-get.html
+++ b/LayoutTests/http/tests/xmlhttprequest/cross-origin-preflight-get-response-type-blob.html
@@ -1,6 +1,6 @@
<html>
<body>
-<p>The "Origin" header must be sent with a "non-simple" cross-origin resource sharing request that uses the GET method.</p>
+<p>The "Origin" header must be sent with a "non-simple" cross-origin resource sharing request that uses the GET method and specifies "blob" as response type.</p>
<pre id="console"></pre>
<script>
if (window.testRunner) {
@@ -17,14 +17,22 @@ function log(message)
function test()
{
var xhr = new XMLHttpRequest();
+ xhr.responseType = 'blob';
xhr.open("GET", "http://localhost:8000/xmlhttprequest/resources/cross-origin-preflight-get.php", true);
// Make this a "non-simple" cross-origin request by adding a custom header.
xhr.setRequestHeader("X-Proprietary-Header", "foo");
xhr.onerror = function() { log("onerror") }
xhr.onload = function() {
- log(xhr.responseText);
- if (window.testRunner)
- testRunner.notifyDone();
+ var reader = new FileReader;
+ reader.onload = function(evt) {
+ log(evt.target.result);
+ if (window.testRunner)
+ testRunner.notifyDone();
+ };
+ reader.onerror = function () {
+ log('reader.onerror');
+ }
+ reader.readAsText(xhr.response);
}
xhr.send(null);
}

Powered by Google App Engine
This is Rietveld 408576698