Search code examples
urlbrowserw3cfileapi

What does implementation-defined value in FileAPI/unicodeBlobURL mean?


In https://w3c.github.io/FileAPI/#unicodeBlobURL:

The Serialization of a Blob URL is the value returned by the following algorithm, which is invoked by URL.createObjectURL():

  1. Let result be the empty string. Append the string "blob" (that is, the Unicode code point sequence U+0062, U+006C, U+006F, U+0062) to result.

  2. Append the ":" (U+003A COLON) character to result.

  3. Let settings be the current settings object

  4. Let origin be settings’s origin.

  5. Let serialized be the ASCII serialization of origin.

  6. If serialized is "null", set it to an implementation-defined value.

    ...

What is this implementation-defined value?

UPDATE: I try to implement this on jsdom, so want to figure out what should I do.


Solution

  • As an implementer, It's up to you, as long as it's not a valid origin.

    Most browsers (tested in FF, chrome and Safari) seems to set it to 'null'.

    We can check it thanks to the sand-boxed iframe of stacksnippet.

    console.log(URL.createObjectURL(new Blob([])));