Skip to content

Use optional for the Blob constructor #33

Closed

Description

@Ms2ger

Currently, the spec has (boring parts omitted):

[Constructor, Constructor(sequence<...> blobParts, optional BlobPropertyBag options)] 
interface Blob {

It would probably be better to use

[Constructor(optional sequence<...> blobParts, optional BlobPropertyBag options)] 
interface Blob {

Note that this handles

new Blob(undefined)

differently: the current spec throws a TypeError; after the change, it would be equivalent to new Blob().

CC @bzbarsky

Activity

  1. bzbarsky commented on Mar 2, 2016

    @bzbarsky

    I don't have strong views on how this should work, but yeah, the only difference I can think of is in how new Blob(undefined) is handled. At least that's the case as long as we don't add more overloads of the constructor.

  2. annevk commented on Mar 2, 2016

    @annevk
    Member

    This is part of the reason why we should avoid overloads I think. new Blob(undefined) not being new Blob() is weird and we should fix that here. (We cannot change it at the IDL-level unfortunately as that would break XMLHttpRequest, though if that's the only case maybe we should fix that specially somehow?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions