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

Unified Diff: LayoutTests/fast/files/apply-blob-url-to-xhr.html

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
« no previous file with comments | « no previous file | LayoutTests/fast/files/apply-blob-url-to-xhr-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/files/apply-blob-url-to-xhr.html
diff --git a/LayoutTests/fast/files/apply-blob-url-to-xhr.html b/LayoutTests/fast/files/apply-blob-url-to-xhr.html
index a00418f031c5dcd7e8ecc7863f1a934b5cf96d96..7b9eda17ce460d116dfac7af42a9a4b13bce571a 100644
--- a/LayoutTests/fast/files/apply-blob-url-to-xhr.html
+++ b/LayoutTests/fast/files/apply-blob-url-to-xhr.html
@@ -4,13 +4,43 @@
<input type="file" name="file" id="file" onchange="onInputFileChange()">
<pre id='console'></pre>
-<script src="resources/apply-blob-url-to-xhr.js"></script>
<script>
+function log(message)
+{
+ document.getElementById('console').appendChild(document.createTextNode(message + "\n"));
+}
+
+function sendXMLHttpRequest(method, url)
+{
+ var xhr = new XMLHttpRequest();
+ xhr.open(method, url, false);
+ try {
+ xhr.send();
+ log("Status: " + xhr.status);
+ log("Response: " + xhr.responseText);
+ } catch (error) {
+ log("Received exception, code: " + error.code + ", name: " + error.name + ", message: " + error.message);
+ }
+}
+
function onInputFileChange()
{
var file = document.getElementById("file").files[0];
+ var fileURL = window.URL.createObjectURL(file);
- runXHRs(file);
+ log("Test that XMLHttpRequest GET succeeds.");
+ sendXMLHttpRequest("GET", fileURL);
+
+ log("Test that XMLHttpRequest POST fails.");
+ sendXMLHttpRequest("POST", fileURL);
+
+ log("Test that XMLHttpRequest GET fails after the blob URL is revoked.");
+ window.URL.revokeObjectURL(fileURL);
+ sendXMLHttpRequest("GET", fileURL);
+
+ log("DONE");
+ if (testRunner.notifyDone)
+ testRunner.notifyDone();
}
function runTests()
« no previous file with comments | « no previous file | LayoutTests/fast/files/apply-blob-url-to-xhr-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698