Index: LayoutTests/http/tests/fetch/script-tests/fetch.js |
diff --git a/LayoutTests/http/tests/fetch/script-tests/fetch.js b/LayoutTests/http/tests/fetch/script-tests/fetch.js |
index 60974662b01e9fcf195a5b93bcbff316afe1fe4c..d9178b7385ffaafd6c79836cef2300d72279b337 100644 |
--- a/LayoutTests/http/tests/fetch/script-tests/fetch.js |
+++ b/LayoutTests/http/tests/fetch/script-tests/fetch.js |
@@ -20,6 +20,31 @@ promise_test(function(t) { |
function() {}); |
}, 'fetch non-HTTP(S) CORS'); |
+// Tests for blob: scheme. |
+promise_test(function(t) { |
+ var url = URL.createObjectURL(new Blob(['fox'], {type: 'text/fox'})); |
+ return fetch(url) |
+ .then(function(response) { |
+ assert_equals(response.status, 200); |
+ assert_equals(response.statusText, 'OK'); |
+ assert_equals(response.headers.get('Content-Type'), 'text/fox'); |
+ assert_equals(response.headers.get('Content-Length'), '3'); |
+ assert_equals(size(response.headers), 2); |
+ return response.text(); |
+ }) |
+ .then(function(text) { |
+ assert_equals(text, 'fox'); |
+ }); |
+ }, 'fetch blob: URL'); |
+ |
+promise_test(function(t) { |
+ var url = URL.createObjectURL(new Blob(['fox'], {type: 'text/fox'})); |
+ return fetch(url + 'invalid') |
+ .then( |
+ t.unreached_func('fetching non-existent blob: URL must fail'), |
+ function() {}); |
+ }, 'fetch non-existent blob: URL'); |
+ |
// https://fetch.spec.whatwg.org/#concept-basic-fetch |
// The last statement: |
// Otherwise |