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() |