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

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: Rebase test style and XHR Created 7 years 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 55%
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..191946944ebf4b054c7b747e7911251e1d889350 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) {
@@ -10,21 +10,29 @@ if (window.testRunner) {
function log(message)
{
- document.getElementById('console').appendChild(document.createTextNode(message + '\n'));
+ document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
}
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