On Thu, Dec 12, 2013 at 9:07 AM, Anne van Kesteren <ann...@annevk.nl> wrote:
> See https://www.w3.org/Bugs/Public/show_bug.cgi?id=24072 for context. > > What's the use case for close()? > > If we are to have close(), let's define it in such a way that once you > invoke it the Blob represents the empty byte sequence. This way other > code that takes and operates on Blob objects does not have to special > case closed Blob objects, but can just treat them as Blob objects that > happen to be empty. > Also, you can close() a Blob while an async XHR is taking place on it. That shouldn't affect the running operation. It also means you can say xhr.open("GET", blobURL); blob.close(); and have it work sensibly--the UA can throw away the data as soon as all current operations on it have completed. This could be handled by synchronously taking a reference to the underlying Blob data during the open() call. (There are other issues about blob URLs that need this, too, such as if a blob URL is revoked at various times during fetch.) If this is handled as part of parsing a URL string to a logical URL object, and if that's done synchronously, that could take care of a number of issues without any special casing. -- Glenn Maynard