Skip to content

blob url fetch with no mime type set is undefined #1436

Closed
@dlrobertson

Description

@dlrobertson

I could be mistaken, but I couldn't find anything that specifies what should be returned when we fetch a blob url that is backed by a blob, but the mime type was not set. I wanted to add a test like the following to web-platform-tests/wpt#33941, but each engine returns a different value for the mime type.

diff --git a/fetch/api/basic/scheme-blob.sub.any.js b/fetch/api/basic/scheme-blob.sub.any.js
index 6e63cbecaa..b25b412507 100644
--- a/fetch/api/basic/scheme-blob.sub.any.js
+++ b/fetch/api/basic/scheme-blob.sub.any.js
@@ -2,7 +2,9 @@
 
 function checkFetchResponse(url, data, mime, size, desc) {
   promise_test(function(test) {
-    size = size.toString();
+    if (size !== null) {
+      size = size.toString();
+    }
     return fetch(url).then(function(resp) {
       assert_equals(resp.status, 200, "HTTP status is 200");
       assert_equals(resp.type, "basic", "response type is basic");
@@ -42,4 +44,8 @@ invalidRequestMethods.forEach(function(method) {
   checkKoUrl(URL.createObjectURL(blob2), method, "Fetching [" + method + "] URL.createObjectURL(blob) is KO");
 });
 
+var blob3 = new Blob([]);
+checkFetchResponse(URL.createObjectURL(blob3), "", "application/x-unknown-content-type", null,
+                  "Fetching [GET] URL.createObjectURL(blob3) is OK");
+
 done();
Content-Type value browser
application/x-unknown-content-type firefox
null chrome
"" safari

Please let me know if I've missed something!

Metadata

Metadata

Assignees

No one assigned

    Labels

    interopImplementations are not interoperable with each other

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions